Skip to content

Commit

Permalink
cron weekly & master devel builds
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Jan 10, 2024
1 parent 8c8b178 commit 1346775
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 9 deletions.
94 changes: 85 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ on:
- '.github/workflows/c-cpp.yml'
- 'CITATION.cff'
- '.mailmap'
schedule: [{cron: '37 13 * * SUN'}] # Sunday at 13:37
defaults:
run:
shell: bash -l {0}
jobs:
build-test-push:
build:
if: github.event_name != 'schedule'
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -74,18 +76,18 @@ jobs:
name: build
run: |
suffix=${{ matrix.type == 'gpu' && '-gpu' || '' }}
# pull base image
base_image=ghcr.io/synerbi/sirf:core$suffix
docker pull $base_image || :
# 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] }} || :
# rebuild sirf image
./docker/compose.sh -r ${{ matrix.type == 'gpu' && '-C' || '-G' }}
image=synerbi/sirf:jupyter$suffix
echo "image=$image" >> "$GITHUB_OUTPUT"
# tag potentially newer base image
docker tag synerbi/jupyter:scipy-${{ matrix.type }} $base_image
echo "base_image=$base_image" >> "$GITHUB_OUTPUT"
# tag potentially newer core image
docker tag synerbi/jupyter:scipy-${{ matrix.type }} $core_image
echo "core_image=$core_image" >> "$GITHUB_OUTPUT"
# make a dummy Dockerfile to use with build-push-action
context=$(mktemp -d)
echo "FROM $image" >> "$context/Dockerfile"
Expand All @@ -101,5 +103,79 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- if: github.ref == 'refs/heads/master'
name: push base image
run: docker push ${{ steps.build.outputs.base_image }}
name: push core image
run: docker push ${{ steps.build.outputs.core_image }}
devel:
if: github.event_name == 'schedule' || github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
strategy:
matrix:
type: [gpu, cpu]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA
- uses: docker/metadata-action@v5
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@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USR }}
password: ${{ secrets.DOCKER_PWD }}
- name: increase disk space
run: ./.github/workflows/GHA_increase_disk_space.sh
- name: cache
uses: actions/cache@v3
with:
key: ccache-docker-${{ matrix.type }}-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
ccache-docker-${{ matrix.type }}-${{ github.ref_name }}
ccache-docker-${{ matrix.type }}
ccache-docker
ccache
path: docker/devel/.ccache
- id: build
name: build
run: |
suffix=${{ matrix.type == 'gpu' && '-gpu' || '' }}
core_image=ghcr.io/synerbi/sirf:core$suffix
# rebuild sirf image
./docker/compose.sh -r ${{ matrix.type == 'gpu' && '-C' || '-G' }} \
-- --build-arg EXTRA_BUILD_FLAGS="-DDEVEL_BUILD=ON -Dsiemens_to_ismrmrd_TAG=origin/master"
# TODO: remove *_TAG after https://github.com/SyneRBI/SIRF-SuperBuild/issues/851
image=synerbi/sirf:jupyter$suffix
echo "image=$image" >> "$GITHUB_OUTPUT"
# tag potentially newer core image
docker tag synerbi/jupyter:scipy-${{ matrix.type }} $core_image
echo "core_image=$core_image" >> "$GITHUB_OUTPUT"
# 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@v5
with:
context: ${{ steps.build.outputs.context }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: push core image
run: docker push ${{ steps.build.outputs.core_image }}
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ services:
BASE_CONTAINER: synerbi/jupyter:scipy-cpu
Gadgetron_USE_CUDA: "OFF"
BUILD_GPU: 0
# TODO: remove after https://github.com/SyneRBI/SIRF-SuperBuild/issues/851
EXTRA_BUILD_FLAGS: >
-DGadgetron_TAG=6202fb7352a14fb82817b57a97d928c988eb0f4b
-DISMRMRD_TAG=v1.13.7
Expand All @@ -50,6 +51,7 @@ services:
BASE_CONTAINER: synerbi/jupyter:scipy-cpu
Gadgetron_USE_CUDA: "OFF"
BUILD_GPU: 0
# TODO: remove after https://github.com/SyneRBI/SIRF-SuperBuild/issues/851
EXTRA_BUILD_FLAGS: >
-DGadgetron_TAG=6202fb7352a14fb82817b57a97d928c988eb0f4b
-DISMRMRD_TAG=v1.13.7
Expand Down

0 comments on commit 1346775

Please sign in to comment.