Multi-stage docker build #148
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Docker Images | |
on: | |
workflow_call: | |
pull_request: | |
push: | |
branches: [ "latest" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Test Images | |
strategy: | |
fail-fast: false | |
matrix: | |
slurm-version: [ "20.02.5.1", "20.11.9.1", "22.05.2.1", "23.02.5.1" ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
load: true | |
tags: test-image | |
build-args: SLURM_VERSION=${{ matrix.slurm-version }} | |
- name: Test container is restartable | |
run: | | |
docker container create --name rerun_test_container test-image | |
docker container start -i rerun_test_container | |
docker container start -i rerun_test_container | |
docker container rm rerun_test_container | |
- name: Run bats tests | |
run: docker run -i -v $(pwd)/tests:/tests test-image bats /tests | |
# Use this job for branch protection rules | |
report-test-status: | |
name: Report Test Status | |
runs-on: ubuntu-latest | |
needs: build | |
if: always() | |
steps: | |
- name: Check build status | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |