-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (108 loc) · 3.58 KB
/
build_runtime_images.yaml
File metadata and controls
121 lines (108 loc) · 3.58 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
111
112
113
114
115
116
117
118
119
120
121
name: Build FAST runtime docker images
on:
push:
workflow_dispatch:
inputs:
deploy:
description: Deploy to packages
type: boolean
required: true
default: false
permissions:
contents: read
packages: write
jobs:
get-latest-version:
runs-on: ubuntu-latest
outputs:
fast-version: ${{ steps.get.outputs.result }}
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Get latest FAST version
id: get
run: |
FAST_VERSION=$(python3 get_latest_fast_version.py)
echo "result=$FAST_VERSION" >> $GITHUB_OUTPUT
build-test-deploy:
runs-on: ubuntu-latest
needs: get-latest-version
strategy:
fail-fast: false
matrix:
type: [library, python]
x_server: [xvfb, none]
opencl: [pocl, intel]
vgl: [true, false]
exclude:
- vgl: true
x_server: none
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set variables
run: |
FAST_VERSION=${{ needs.get-latest-version.outputs.fast-version }}
echo "FAST_VERSION=$FAST_VERSION" >> "$GITHUB_ENV"
if [ "${{ matrix.vgl }}" = "true" ]; then
VGL_TAG=-vgl
else
VGL_TAG=
fi
if [ "${{ matrix.x_server }}" = "none" ]; then
X_TAG=no_x
else
X_TAG=${{ matrix.x_server }}
fi
IMAGE_NAME=ghcr.io/fast-imaging/fast-${{ matrix.type }}:${FAST_VERSION}-${{ matrix.opencl }}-${X_TAG}${VGL_TAG}
IMAGE_FILENAME=fast-${{ matrix.type }}-${FAST_VERSION}-${{ matrix.opencl }}-${X_TAG}${VGL_TAG}.tar
echo "IMAGE_NAME=$IMAGE_NAME" >> "$GITHUB_ENV"
echo "IMAGE_FILENAME=$IMAGE_FILENAME" >> "$GITHUB_ENV"
- name: Build
run: |
docker build . -f runtime.Dockerfile \
-t $IMAGE_NAME \
--build-arg TYPE=${{ matrix.type }} \
--build-arg X_SERVER=${{ matrix.x_server }} \
--build-arg OPENCL_PLATFORM=${{ matrix.opencl }} \
--build-arg VIRTUALGL=${{ matrix.vgl }} \
--build-arg FAST_VERSION=$FAST_VERSION
- name: Cache test data
# Intel OpenCL does not work in github action
if: ${{ matrix.opencl != 'intel' && matrix.type == 'python' }}
id: cache-test-dataset
uses: actions/cache@v4
with:
path: ~/FAST/data/
key: test-dataset
enableCrossOsArchive: true
- name: Test docker image
# Intel OpenCL does not work in github action
if: ${{ matrix.opencl != 'intel' }}
run: |
if [ "${{ matrix.opencl }}" = "intel" ]; then
docker run --rm -v ~/FAST/data/:/root/FAST/data/ --device=/dev/dri $IMAGE_NAME
else
docker run --rm -v ~/FAST/data/:/root/FAST/data/ $IMAGE_NAME
fi
- name: Save docker image to file
run: |
docker save -o $IMAGE_FILENAME $IMAGE_NAME
- name: Upload docker image file as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.IMAGE_FILENAME }}
path: ${{ env.IMAGE_FILENAME }}
if-no-files-found: error
retention-days: 3
- name: Login to GitHub Container Registry
if: ${{ inputs.deploy }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push container
if: ${{ inputs.deploy }}
run: |
docker push $IMAGE_NAME