-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (62 loc) · 2.31 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
name: Container - Test
on:
push:
branches-ignore: [stable]
paths-ignore:
- ".**"
- "**.md"
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
db_type:
- mongodb
- postgresql
- mariadb
- file
steps:
- uses: actions/checkout@v3
- name: Set up metadata
id: pkg_meta
run: |
echo "::set-output name=package_scope::@awesome-database-backup/awesome-${{ matrix.db_type }}-backup"
echo "::set-output name=package_path::apps/awesome-${{ matrix.db_type }}-backup"
echo "::set-output name=package_image_name::weseek/awesome-${{ matrix.db_type }}-backup"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key:
${{ runner.os }}-buildx-app-${{ matrix.db_type }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-app-${{ matrix.db_type }}-
${{ runner.os }}-buildx-app-
- name: Build container (No push)
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64
load: true
build-args: |
packageScope=${{ steps.pkg_meta.outputs.package_scope }}
packagePath=${{ steps.pkg_meta.outputs.package_path }}
dbType=${{ matrix.db_type }}
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_type }}/structure-tests.yml