docker: default STIR_BUILD_EXECUTABLES=ON #502
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| pull_request: | |
| branches: [master] | |
| paths-ignore: | |
| - '**.md' | |
| - 'VirtualBox/**' | |
| - '.github/workflows/c-cpp.yml' | |
| - 'CITATION.cff' | |
| - '.mailmap' | |
| push: | |
| branches: [master] | |
| tags: ['v**'] | |
| paths-ignore: | |
| - '**.md' | |
| - 'VirtualBox/**' | |
| - '.github/workflows/c-cpp.yml' | |
| - 'CITATION.cff' | |
| - '.mailmap' | |
| schedule: [{cron: '37 13 * * SUN'}] # Sunday at 13:37 | |
| defaults: {run: {shell: 'bash -el {0}'}} | |
| jobs: | |
| build: | |
| if: github.event_name != 'schedule' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| type: [gpu, cpu] | |
| permissions: {contents: read, packages: write} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA | |
| - uses: docker/setup-buildx-action@v4 | |
| id: buildx | |
| - uses: docker/metadata-action@v6 | |
| id: meta | |
| with: | |
| images: | | |
| synerbi/sirf | |
| ghcr.io/synerbi/sirf | |
| flavor: | | |
| latest=auto | |
| suffix=${{ matrix.type == 'gpu' && '-gpu,onlatest=true' || '' }} | |
| tags: | | |
| type=edge | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| labels: | | |
| org.opencontainers.image.licenses=Apache-2.0${{ matrix.type == 'gpu' && ' AND BSD-3-Clause AND GPL-3.0' || '' }} | |
| - uses: docker/login-action@v4 | |
| if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/login-action@v4 | |
| if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') | |
| with: | |
| username: ${{ secrets.DOCKER_USR }} | |
| password: ${{ secrets.DOCKER_PWD }} | |
| - uses: jlumbroso/free-disk-space@v1.3.1 | |
| with: | |
| docker-images: true | |
| # don't remove these APT packages until we need the space (includes clang-* and some libs that we'd reinstall) | |
| large-packages: false | |
| - uses: actions/cache@v6 | |
| id: cache | |
| with: | |
| key: cache-docker-${{ matrix.type }}-${{ github.ref_name }}-${{ github.run_id }} | |
| restore-keys: | | |
| cache-docker-${{ matrix.type }}-${{ github.ref_name }} | |
| cache-docker-${{ matrix.type }} | |
| cache-docker | |
| path: docker/devel/cache | |
| - uses: reproducible-containers/buildkit-cache-dance@v3 | |
| with: | |
| builder: ${{ steps.buildx.outputs.name }} | |
| cache-dir: docker/devel/cache | |
| skip-extraction: ${{ steps.cache.outputs.cache-hit }} | |
| - id: pull | |
| name: pull | |
| run: | | |
| suffix=${{ matrix.type == 'gpu' && '-gpu' || '' }} | |
| # pull core image | |
| core_image=ghcr.io/synerbi/sirf:core$suffix | |
| docker pull $core_image || : | |
| # pull sirf image | |
| docker pull ghcr.io/synerbi/sirf:${{ fromJSON(steps.meta.outputs.json).tags[0] }} || : | |
| echo "suffix=$suffix" >> "$GITHUB_OUTPUT" | |
| echo "core_image=$core_image" >> "$GITHUB_OUTPUT" | |
| - id: build | |
| name: build | |
| run: | | |
| # rebuild sirf image | |
| ./docker/compose.sh -b${{ matrix.type == 'gpu' && 'g' || 'c' }} | |
| image=synerbi/sirf:latest${{ steps.pull.outputs.suffix }} | |
| echo "image=$image" >> "$GITHUB_OUTPUT" | |
| # tag potentially newer core image | |
| docker tag synerbi/jupyter:scipy-${{ matrix.type }} ${{ steps.pull.outputs.core_image }} | |
| # make a dummy Dockerfile to use with build-push-action | |
| context=$(mktemp -d) | |
| echo "FROM $image" >> "$context/Dockerfile" | |
| echo "context=$context" >> "$GITHUB_OUTPUT" | |
| - name: test CIL | |
| run: > | |
| docker run --rm -v ./.github/workflows:/gh --user $(id -u) --group-add users | |
| ${{ steps.build.outputs.image }} /gh/test_cil.sh | |
| - uses: docker/build-push-action@v7 | |
| with: | |
| context: ${{ steps.build.outputs.context }} | |
| push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| - if: github.ref == 'refs/heads/master' | |
| name: push core image | |
| run: docker push ${{ steps.pull.outputs.core_image }} | |
| devel: | |
| if: github.event_name == 'schedule' || github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| type: [gpu, cpu] | |
| permissions: {contents: read, packages: write} | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA | |
| - uses: docker/setup-buildx-action@v4 | |
| id: buildx | |
| - uses: docker/metadata-action@v6 | |
| id: meta | |
| with: | |
| images: | | |
| synerbi/sirf | |
| ghcr.io/synerbi/sirf | |
| flavor: | | |
| latest=false | |
| suffix=${{ matrix.type == 'gpu' && '-gpu,onlatest=true' || '' }} | |
| tags: devel | |
| labels: | | |
| org.opencontainers.image.licenses=Apache-2.0${{ matrix.type == 'gpu' && ' AND BSD-3-Clause AND GPL-3.0' || '' }} | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/login-action@v4 | |
| with: | |
| username: ${{ secrets.DOCKER_USR }} | |
| password: ${{ secrets.DOCKER_PWD }} | |
| - uses: jlumbroso/free-disk-space@v1.3.1 | |
| with: | |
| docker-images: false | |
| large-packages: false | |
| - uses: actions/cache@v6 | |
| id: cache | |
| with: | |
| key: cache-docker-${{ matrix.type }}-${{ github.ref_name }}-${{ github.run_id }} | |
| restore-keys: | | |
| cache-docker-${{ matrix.type }}-${{ github.ref_name }} | |
| cache-docker-${{ matrix.type }} | |
| cache-docker | |
| path: docker/devel/cache | |
| - uses: reproducible-containers/buildkit-cache-dance@v3 | |
| with: | |
| builder: ${{ steps.buildx.outputs.name }} | |
| cache-dir: docker/devel/cache | |
| skip-extraction: ${{ steps.cache.outputs.cache-hit }} | |
| - id: pull | |
| name: pull | |
| run: | | |
| suffix=${{ matrix.type == 'gpu' && '-gpu' || '' }} | |
| # pull core image | |
| core_image=ghcr.io/synerbi/sirf:core$suffix | |
| docker pull $core_image || : | |
| # pull sirf image | |
| docker pull ghcr.io/synerbi/sirf:${{ fromJSON(steps.meta.outputs.json).tags[0] }} || : | |
| echo "suffix=$suffix" >> "$GITHUB_OUTPUT" | |
| echo "core_image=$core_image" >> "$GITHUB_OUTPUT" | |
| - id: build | |
| name: build | |
| run: | | |
| # rebuild sirf image | |
| ./docker/compose.sh -db${{ matrix.type == 'gpu' && 'g' || 'c' }} | |
| image=synerbi/sirf:devel${{ steps.pull.outputs.suffix }} | |
| echo "image=$image" >> "$GITHUB_OUTPUT" | |
| - name: test CIL | |
| run: > | |
| docker run --rm -v ./.github/workflows:/gh --user $(id -u) --group-add users | |
| ${{ steps.build.outputs.image }} /gh/test_cil.sh |