Repository navigation
executable file
·253 lines (247 loc) · 9.39 KB
/
Copy pathci.yml
File metadata and controls
executable file
·253 lines (247 loc) · 9.39 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# run pfcon unit tests (nosetests) and CUBE integration tests.
# If all tests pass, build a multi-arch image and push to DockerHub.
name: CI
on:
push:
branches: [ master ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:
branches: [ master ]
jobs:
test-pfcon:
name: tests (pfcon)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Build and run tests
run: ./make.sh -i -N -F fslink
- name: Tear down
run: |
./unmake.sh -N -F fslink
sudo rm -fr ./CHRIS_REMOTE_FS
test-pfcon-k8s:
name: tests (pfcon on kubernetes)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Start local Docker registry
run: |
docker run -d --restart=always \
-p 127.0.0.1:5005:5000 \
--name pfcon-k8s-registry registry:2
- name: Write kind config
run: |
# extraMounts exposes the workspace on the kind node at the same
# path, so the pfcon deployment's hostPath mounts of pfcon/ and
# tests/ (resolved from $SOURCEDIR by envsubst) work on the node.
cat > /tmp/kind-config.yaml <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraMounts:
- hostPath: ${{ github.workspace }}
containerPath: ${{ github.workspace }}
EOF
- name: Create kind cluster
uses: helm/kind-action@v1
with:
cluster_name: pfcon-k8s
config: /tmp/kind-config.yaml
- name: Connect registry to kind network
run: |
docker network connect kind pfcon-k8s-registry
# Configure containerd on kind nodes to resolve localhost:5005
# to the registry container on the kind docker network.
for node in $(kind get nodes --name pfcon-k8s); do
docker exec "$node" mkdir -p /etc/containerd/certs.d/localhost:5005
docker exec "$node" sh -c 'cat > /etc/containerd/certs.d/localhost:5005/hosts.toml <<TOML
[host."http://pfcon-k8s-registry:5000"]
capabilities = ["pull", "resolve"]
TOML'
docker exec "$node" systemctl restart containerd
done
# Wait for containerd and kubelet to recover after restart.
sleep 5
kubectl wait --for=condition=Ready nodes --all --timeout=120s
- name: Build and push opjob image
run: |
docker build -f opjob.Dockerfile -t localhost:5005/fnndsc/pfconopjob:dev .
docker push localhost:5005/fnndsc/pfconopjob:dev
- name: Build and run tests
env:
PFCON_OP_IMAGE: localhost:5005/fnndsc/pfconopjob:dev
run: ./make.sh -i -N -F fslink -O kubernetes
- name: Tear down
if: always()
run: |
./unmake.sh -N -F fslink -O kubernetes
sudo rm -fr ./CHRIS_REMOTE_FS
test-cube:
name: tests (CUBE)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- run: docker build -t localhost/fnndsc/pfcon .
- run: docker build -f opjob.Dockerfile -t ghcr.io/fnndsc/pfconopjob .
- uses: FNNDSC/ChRIS_ultron_backEnd@master
env:
PFCON_IMAGE: localhost/fnndsc/pfcon
build:
needs: [test-pfcon, test-pfcon-k8s, test-cube]
runs-on: ubuntu-24.04
# ghcr.io/fnndsc/pfcon* are FNNDSC's packages and this repository is HARBOR-Medical-AI's,
# so the push logs in with the FNNDSC account in GHCR_USERNAME and GHCR_TOKEN, not GITHUB_TOKEN.
permissions:
contents: read
env:
PIXI_COLOR: always
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install micromamba
uses: mamba-org/setup-micromamba@v2
with:
cache-downloads: true
- name: Install pixi
uses: prefix-dev/setup-pixi@194d461b21b6c5717c722ffc597fa91ed2ff29fa # v0.9.1
with:
pixi-version: v0.55.0
run-install: false
- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: |
ref_name='${{ github.ref_name }}'
version_number="${ref_name:1}"
pixi project version set "$version_number"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
docker.io/fnndsc/pfcon
ghcr.io/fnndsc/pfcon
tags: |
type=ref,event=branch
type=ref,event=pr
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Docker meta (opjob)
id: meta-opjob
uses: docker/metadata-action@v5
with:
images: |
docker.io/fnndsc/pfconopjob
ghcr.io/fnndsc/pfconopjob
tags: |
type=ref,event=branch
type=ref,event=pr
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Docker meta (opjob-swift)
id: meta-opjob-swift
uses: docker/metadata-action@v5
with:
images: |
docker.io/fnndsc/pfconopjob-swift
ghcr.io/fnndsc/pfconopjob-swift
tags: |
type=ref,event=branch
type=ref,event=pr
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Docker meta (opjob-s3)
id: meta-opjob-s3
uses: docker/metadata-action@v5
with:
images: |
docker.io/fnndsc/pfconopjob-s3
ghcr.io/fnndsc/pfconopjob-s3
tags: |
type=ref,event=branch
type=ref,event=pr
type=pep440,pattern={{version}}
type=pep440,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
# pixi and micromamba don't have ppc64le images available, so to build
# images for ppc64le, we create conda environments using micromamba
# which are then copied into the container images. This also happens
# to be more efficient than running a package manager during docker
# build using QEMU.
- name: Export conda-explicit-spec
run: pixi project export conda-explicit-spec --frozen --ignore-pypi-errors conda-specs
- name: Create env for linux/amd64
run: micromamba create --platform linux-64 --relocate-prefix /opt/conda-env -f conda-specs/prod_linux-64_conda_spec.txt -p ./envs/linux/amd64
- name: Create env for linux/arm64
run: micromamba create --platform linux-aarch64 --relocate-prefix /opt/conda-env -f conda-specs/prod_linux-aarch64_conda_spec.txt -p ./envs/linux/arm64
- name: Create env for linux/ppc64le
run: micromamba create --platform linux-ppc64le --relocate-prefix /opt/conda-env -f conda-specs/prod_linux-ppc64le_conda_spec.txt -p ./envs/linux/ppc64le
- name: Build wheel
run: pixi run build
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
id: login-dockerhub
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
id: login-ghcr
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: ${{ steps.login-dockerhub.outcome == 'success' && steps.login-ghcr.outcome == 'success' }}
context: .
file: ./prod.Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push (opjob)
uses: docker/build-push-action@v6
with:
push: ${{ steps.login-dockerhub.outcome == 'success' && steps.login-ghcr.outcome == 'success' }}
context: .
file: ./opjob.Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le
tags: ${{ steps.meta-opjob.outputs.tags }}
labels: ${{ steps.meta-opjob.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push (opjob-swift)
uses: docker/build-push-action@v6
with:
push: ${{ steps.login-dockerhub.outcome == 'success' && steps.login-ghcr.outcome == 'success' }}
context: .
file: ./opjob.Dockerfile
build-args: STORAGE_ENV=swift
platforms: linux/amd64,linux/arm64,linux/ppc64le
tags: ${{ steps.meta-opjob-swift.outputs.tags }}
labels: ${{ steps.meta-opjob-swift.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push (opjob-s3)
uses: docker/build-push-action@v6
with:
push: ${{ steps.login-dockerhub.outcome == 'success' && steps.login-ghcr.outcome == 'success' }}
context: .
file: ./opjob.Dockerfile
build-args: STORAGE_ENV=s3
platforms: linux/amd64,linux/arm64,linux/ppc64le
tags: ${{ steps.meta-opjob-s3.outputs.tags }}
labels: ${{ steps.meta-opjob-s3.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max