Skip to content

Commit bc66890

Browse files
committed
ci: expand image build matrix and standardize container tags
1 parent 13ded29 commit bc66890

1 file changed

Lines changed: 61 additions & 23 deletions

File tree

.github/workflows/build-push.yaml

Lines changed: 61 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,64 @@ on:
66
- main
77
- test
88

9+
permissions:
10+
contents: read
11+
packages: write
12+
913
jobs:
1014

1115
build-push:
12-
runs-on: [gpu]
16+
runs-on: ubuntu-latest
1317

1418
strategy:
19+
fail-fast: false
1520
matrix:
16-
target: [release, develop]
21+
include:
22+
- target: release
23+
os: ubuntu24.04
24+
cuda_version: 13.2.0
25+
optix_version: 9.1.0
26+
geant4_version: 11.4.1
27+
cmake_version: 4.3.1
28+
- target: release
29+
os: ubuntu24.04
30+
cuda_version: 13.0.2
31+
optix_version: 9.0.0
32+
geant4_version: 11.4.1
33+
cmake_version: 4.2.1
34+
- target: release
35+
os: ubuntu22.04
36+
cuda_version: 12.1.1
37+
optix_version: 8.0.0
38+
geant4_version: 11.3.2
39+
cmake_version: 3.22.1
40+
- target: develop
41+
os: ubuntu24.04
42+
cuda_version: 13.0.2
43+
optix_version: 9.0.0
44+
geant4_version: 11.4.1
45+
cmake_version: 4.2.1
46+
- target: develop
47+
os: ubuntu24.04
48+
cuda_version: 12.5.1
49+
optix_version: 9.0.0
50+
geant4_version: 11.4.1
51+
cmake_version: 3.28.3
52+
- target: develop
53+
os: ubuntu22.04
54+
cuda_version: 12.1.1
55+
optix_version: 8.0.0
56+
geant4_version: 11.3.2
57+
cmake_version: 3.22.1
1758

1859
steps:
1960
- name: Define environment variables
2061
run: |
21-
echo IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
22-
echo IMAGE_TAG=$(echo ${{ matrix.target }}) >> $GITHUB_ENV
23-
if [ "${{ matrix.target }}" = "release" ]; then
24-
echo IMAGE_TAG=latest >> $GITHUB_ENV
25-
fi
62+
IMAGE_NAME=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
63+
BUILD_VARIANT=cuda${{ matrix.cuda_version }}-${{ matrix.target }}-${{ matrix.os }}-optix${{ matrix.optix_version }}-geant4${{ matrix.geant4_version }}-cmake${{ matrix.cmake_version }}
64+
echo IMAGE_NAME=${IMAGE_NAME} >> $GITHUB_ENV
65+
echo IMAGE_TAG=${BUILD_VARIANT} >> $GITHUB_ENV
66+
echo CACHE_REF=${IMAGE_NAME}:buildcache-${BUILD_VARIANT} >> $GITHUB_ENV
2667
2768
- name: Checkout code
2869
uses: actions/checkout@v4
@@ -37,30 +78,27 @@ jobs:
3778
username: ${{ github.actor }}
3879
password: ${{ secrets.GITHUB_TOKEN }}
3980

40-
- name: Log in to Docker Hub
41-
uses: docker/login-action@v3
42-
with:
43-
username: ${{ secrets.DOCKERHUB_USERNAME }}
44-
password: ${{ secrets.DOCKERHUB_TOKEN }}
45-
4681
- name: Build and push to registries
4782
uses: docker/build-push-action@v6
4883
with:
84+
context: .
4985
push: true
5086
tags: |
51-
ghcr.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
52-
docker.io/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
87+
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
5388
target: ${{ matrix.target }}
54-
cache-from: type=local,src=/home/runner/.buildx-cache
55-
cache-to: type=local,dest=/home/runner/.buildx-cache-new,mode=max
89+
build-args: |
90+
OS=${{ matrix.os }}
91+
CUDA_VERSION=${{ matrix.cuda_version }}
92+
OPTIX_VERSION=${{ matrix.optix_version }}
93+
GEANT4_VERSION=${{ matrix.geant4_version }}
94+
CMAKE_VERSION=${{ matrix.cmake_version }}
95+
cache-from: type=registry,ref=${{ env.CACHE_REF }}
96+
cache-to: type=registry,ref=${{ env.CACHE_REF }},mode=max
5697

57-
- name: Move cache
58-
# Temp fix
59-
# https://github.com/docker/build-push-action/issues/252
60-
# https://github.com/moby/buildkit/issues/1896
98+
- name: Add devel alias tag for default CUDA
99+
if: ${{ github.ref_name == 'main' && matrix.target == 'develop' && matrix.os == 'ubuntu24.04' && matrix.cuda_version == '13.0.2' && matrix.optix_version == '9.0.0' && matrix.geant4_version == '11.4.1' && matrix.cmake_version == '4.2.1' }}
61100
run: |
62-
rm -rf /home/runner/.buildx-cache
63-
mv /home/runner/.buildx-cache-new /home/runner/.buildx-cache
101+
docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:develop ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
64102
65103
cleanup:
66104
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)