docker CI #356
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: docker CI | |
on: | |
push: | |
branches: | |
- "**" | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: "0 0 * * MON" | |
workflow_dispatch: | |
jobs: | |
test: | |
strategy: | |
matrix: | |
include: | |
- arch: amd64 | |
os: ubuntu-latest | |
database-type: PostgreSQL | |
- arch: amd64 | |
os: ubuntu-latest | |
database-type: SQLite3 | |
- arch: arm64 | |
os: ubuntu-24.04-arm | |
database-type: PostgreSQL | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: docker | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Create image | |
run: | | |
./create_image.sh | |
- name: Run tests with docker run | |
run: | | |
./run_tests.sh turing run ${{ matrix.database-type }} | |
./run_tests.sh mathrace_interaction/tests/unit run ${{ matrix.database-type }} | |
./run_tests.sh mathrace_interaction/tests/functional run ${{ matrix.database-type }} | |
./run_tests.sh mathrace_interaction/tests/integration run ${{ matrix.database-type }} | |
- name: Run tests with docker exec | |
if: matrix.database-type != 'SQLite3' | |
run: | | |
./create_volume.sh | |
./create_container.sh | |
./start_container.sh | |
./run_tests.sh turing exec ${{ matrix.database-type }} | |
./run_tests.sh mathrace_interaction/tests/unit exec ${{ matrix.database-type }} | |
./run_tests.sh mathrace_interaction/tests/functional exec ${{ matrix.database-type }} | |
./run_tests.sh mathrace_interaction/tests/integration exec ${{ matrix.database-type }} | |
./stop_container.sh | |
- name: Publish image to GitHub packages | |
if: matrix.database-type != 'SQLite3' && github.repository == 'dmf-unicatt/turing-dmf' && github.ref == 'refs/heads/main' | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
docker tag ghcr.io/dmf-unicatt/turing-dmf:latest ghcr.io/dmf-unicatt/turing-dmf:latest-${{ matrix.arch }} | |
docker push ghcr.io/dmf-unicatt/turing-dmf:latest-${{ matrix.arch }} | |
publish-multiarch-docker: | |
needs: [test] | |
if: github.repository == 'dmf-unicatt/turing-dmf' && github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Publish multiarch image to GitHub packages | |
run: | | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
docker buildx imagetools create \ | |
-t ghcr.io/dmf-unicatt/turing-dmf:latest \ | |
ghcr.io/dmf-unicatt/turing-dmf:latest-amd64 \ | |
ghcr.io/dmf-unicatt/turing-dmf:latest-arm64 | |
warn: | |
runs-on: ubuntu-latest | |
if: github.repository == 'dmf-unicatt/turing-dmf' && github.ref == 'refs/heads/main' && github.event_name == 'schedule' | |
steps: | |
- name: Warn if scheduled workflow is about to be disabled | |
uses: fem-on-colab/warn-workflow-about-to-be-disabled-action@main | |
with: | |
workflow-filename: docker_ci.yml | |
days-elapsed: 50 |