-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (115 loc) · 4.57 KB
/
container-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Container - Test
on:
push:
branches-ignore: [stable]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
container-test:
runs-on: ubuntu-latest
strategy:
# Set same as container-publish.yaml
matrix:
db_tool:
# awesome-mongodb-backup
# Valid versions can be found here https://www.mongodb.com/try/download/database-tools/releases/archive
- db_type: mongodb
version: 100.5.4
- db_type: mongodb
version: 100.6.1
- db_type: mongodb
version: 100.7.5
- db_type: mongodb
version: 100.8.0
- db_type: mongodb
version: 100.9.5
- db_type: mongodb
version: 100.10.0
# awesome-postgresql-backup
# Valid versions can be found here https://apt.postgresql.org/pub/repos/apt/dists/bullseye-pgdg/
- db_type: postgresql
version: 10
- db_type: postgresql
version: 11
- db_type: postgresql
version: 12
- db_type: postgresql
version: 13
- db_type: postgresql
version: 14
- db_type: postgresql
version: 15
- db_type: postgresql
version: 16
- db_type: postgresql
version: 17
# awesome-mariadb-backup
# Valid versions can be found here https://dlm.mariadb.com/rest/releases/mariadb_server/
- db_type: mariadb
version: 11.4.5
- db_type: mariadb
version: 11.7.2
- db_type: mariadb
version: 11.8.1
# awesome-file-backup
- db_type: file
steps:
- uses: actions/checkout@v4
- name: Set up metadata
id: pkg_meta
run: |
echo "package_filter=@awesome-database-backup/awesome-${{ matrix.db_tool.db_type }}-backup" >> $GITHUB_OUTPUT
echo "package_path=apps/awesome-${{ matrix.db_tool.db_type }}-backup" >> $GITHUB_OUTPUT
echo "package_image_name=weseek/awesome-${{ matrix.db_tool.db_type }}-backup" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key:
${{ runner.os }}-buildx-app-${{ matrix.db_tool.db_type }}-${{ matrix.db_tool.version }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-app-${{ matrix.db_tool.db_type }}-${{ matrix.db_tool.version }}-
${{ runner.os }}-buildx-app-${{ matrix.db_tool.db_type }}-
${{ runner.os }}-buildx-app-
- name: Build container (No push)
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64
load: true
build-args: |
packageFilter=${{ steps.pkg_meta.outputs.package_filter }}
packagePath=${{ steps.pkg_meta.outputs.package_path }}
dbType=${{ matrix.db_tool.db_type }}
dbToolVersion=${{ matrix.db_tool.version }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
tags: ${{ steps.pkg_meta.outputs.package_image_name }}:latest
# ref: https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#local-cache
# :warning: At the moment caches are copied over the existing cache so it [keeps growing](https://github.com/docker/build-push-action/issues/252).
# The `Move cache` step is used as a temporary fix (see https://github.com/moby/buildkit/issues/1896).
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Run structure tests
uses: brpaz/[email protected]
with:
image: ${{ steps.pkg_meta.outputs.package_image_name }}:latest
configFile: ./docker/test/${{ matrix.db_tool.db_type }}/structure-tests.yml
env:
BACKUP_TOOL_VERSION: ${{ matrix.db_tool.version }}
# In order to add a status check of the entire workflow as a condition in the ruleset, we define a job to be executed when the preceding job is successful.
# This is so that if the version of the DB tool is updated in the future, the rule set conditions will not need to be changed.
# You can only specify a job, and the job name is named by a combination of the matrix.
# (ex. container-test / (mariadb, 10.11.11)
check-all-tests:
needs: container-test
runs-on: ubuntu-latest
name: Container - Test is passed successfully
steps:
- run: echo "All tests passed successfully!"