2022-09-09 09:12:17 +00:00
|
|
|
name: 'Test the DMS Container Image'
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
cache-key:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
run-tests:
|
|
|
|
name: 'Test'
|
2023-01-28 12:53:17 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2022-11-25 21:58:16 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
part: [serial, parallel/set1, parallel/set2, parallel/set3]
|
2023-02-06 22:49:21 +00:00
|
|
|
fail-fast: false
|
2022-09-09 09:12:17 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# Required to retrieve bats (core + extras):
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
# Get the cached build layers from the build job:
|
|
|
|
# This should always be a cache-hit, thus `restore-keys` fallback is not used.
|
|
|
|
# No new cache uploads should ever happen for this job.
|
|
|
|
- name: 'Retrieve image built from build cache'
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: cache-buildx-${{ inputs.cache-key }}
|
|
|
|
|
2023-02-09 09:33:50 +00:00
|
|
|
# Configures buildx to use `docker-container` driver,
|
|
|
|
# Ensures consistent BuildKit version (not coupled to Docker Engine),
|
|
|
|
# and increased compatibility of the build cache vs mixing buildx drivers.
|
|
|
|
- name: 'Set up Docker Buildx'
|
2023-07-17 19:48:19 +00:00
|
|
|
uses: docker/setup-buildx-action@v2.9.1
|
2023-02-09 09:33:50 +00:00
|
|
|
|
2022-09-09 09:12:17 +00:00
|
|
|
# Importing from the cache should create the image within approx 30 seconds:
|
2023-02-09 09:33:50 +00:00
|
|
|
# NOTE: `qemu` step is not needed as we only test for AMD64.
|
2022-09-09 09:12:17 +00:00
|
|
|
- name: 'Build AMD64 image from cache'
|
2023-06-19 21:14:09 +00:00
|
|
|
uses: docker/build-push-action@v4.1.1
|
2022-09-09 09:12:17 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
tags: mailserver-testing:ci
|
|
|
|
# Export the built image to the Docker host for use with BATS:
|
|
|
|
load: true
|
|
|
|
# Rebuilds the AMD64 image from the cache:
|
|
|
|
platforms: linux/amd64
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
2023-02-07 23:07:56 +00:00
|
|
|
# Disable provenance attestation: https://docs.docker.com/build/attestations/slsa-provenance/
|
|
|
|
provenance: false
|
2022-09-09 09:12:17 +00:00
|
|
|
|
|
|
|
- name: 'Run tests'
|
2022-11-25 21:58:16 +00:00
|
|
|
run: make generate-accounts tests/${{ matrix.part }}
|