-
Notifications
You must be signed in to change notification settings - Fork 3
110 lines (98 loc) · 3.56 KB
/
build-push.yaml
File metadata and controls
110 lines (98 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build Push Image
on:
push:
branches:
- main
- test
permissions:
contents: read
packages: write
jobs:
build-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: release
os: ubuntu24.04
cuda_version: 13.2.0
optix_version: 9.1.0
geant4_version: 11.4.1
cmake_version: 4.3.1
- target: release
os: ubuntu24.04
cuda_version: 13.0.2
optix_version: 9.0.0
geant4_version: 11.4.1
cmake_version: 4.2.1
- target: release
os: ubuntu22.04
cuda_version: 12.1.1
optix_version: 8.0.0
geant4_version: 11.3.2
cmake_version: 3.22.1
- target: develop
os: ubuntu24.04
cuda_version: 13.0.2
optix_version: 9.0.0
geant4_version: 11.4.1
cmake_version: 4.2.1
- target: develop
os: ubuntu24.04
cuda_version: 12.5.1
optix_version: 9.0.0
geant4_version: 11.4.1
cmake_version: 3.28.3
- target: develop
os: ubuntu22.04
cuda_version: 12.1.1
optix_version: 8.0.0
geant4_version: 11.3.2
cmake_version: 3.22.1
steps:
- name: Define environment variables
run: |
IMAGE_NAME=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
CACHE_IMAGE_NAME=${IMAGE_NAME}-buildcache
BUILD_VARIANT=cuda${{ matrix.cuda_version }}-${{ matrix.target }}-${{ matrix.os }}-optix${{ matrix.optix_version }}-geant4${{ matrix.geant4_version }}-cmake${{ matrix.cmake_version }}
echo IMAGE_NAME=${IMAGE_NAME} >> $GITHUB_ENV
echo IMAGE_TAG=${BUILD_VARIANT} >> $GITHUB_ENV
echo CACHE_REF=${CACHE_IMAGE_NAME}:${BUILD_VARIANT} >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push to registries
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
target: ${{ matrix.target }}
build-args: |
OS=${{ matrix.os }}
CUDA_VERSION=${{ matrix.cuda_version }}
OPTIX_VERSION=${{ matrix.optix_version }}
GEANT4_VERSION=${{ matrix.geant4_version }}
CMAKE_VERSION=${{ matrix.cmake_version }}
cache-from: type=registry,ref=${{ env.CACHE_REF }}
cache-to: type=registry,ref=${{ env.CACHE_REF }},mode=max
- name: Add devel alias tag for default CUDA
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' }}
run: |
docker buildx imagetools create -t ${{ env.IMAGE_NAME }}:develop ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
cleanup:
runs-on: ubuntu-latest
needs: build-push
steps:
- uses: dataaxiom/ghcr-cleanup-action@v1
with:
packages: ${{ github.event.repository.name }},${{ github.event.repository.name }}-buildcache