-
Notifications
You must be signed in to change notification settings - Fork 32
310 lines (281 loc) · 10.5 KB
/
CI-full.yml
File metadata and controls
310 lines (281 loc) · 10.5 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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
name: Build and Publish VCell Docker Images
on:
workflow_dispatch:
inputs:
tag:
description: "Repository tag (e.g., 7.7.0.37)"
required: true
release:
types: [published]
env:
python-version: "3.10"
jobs:
setup:
runs-on: ubuntu-22.04
outputs:
vcell_tag: ${{ steps.set-vars.outputs.vcell_tag }}
vcell_repo_namespace: ${{ steps.set-vars.outputs.vcell_repo_namespace }}
friendly_tag: ${{ steps.set-vars.outputs.friendly_tag }}
steps:
- uses: actions/checkout@v4
- name: set global environment variables
id: set-vars
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "friendly_tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "friendly_tag=${GITHUB_REF:10}" >> $GITHUB_OUTPUT
fi
echo "vcell_tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "vcell_repo_namespace=ghcr.io/virtualcell" >> $GITHUB_OUTPUT
maven-build:
runs-on: ubuntu-22.04
needs: setup
steps:
- name: Free up VM's disk space
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
sudo apt-get clean
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
cache: "pip"
- name: Install Dependencies
run: pip install -r requirements.txt
- name: build python packages
run: |
set -ux
for POETRY_DIR in vcell-cli-utils docker/swarm/vcell-admin pythonCopasiOpt/vcell-opt pythonVtk python-utils python-restclient pythonData;\
do pushd $POETRY_DIR;\
poetry install;\
poetry run python -m pytest;\
popd;\
done
- name: setup java 17 with maven cache
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Maven build
run: mvn --batch-mode clean install dependency:copy-dependencies -DskipTests=true
- name: Upload Maven artifacts
uses: actions/upload-artifact@v4
with:
name: maven-build-output
retention-days: 1
path: |
**/target/
localsolvers/
docker-build:
runs-on: ubuntu-22.04
needs: [setup, maven-build]
strategy:
fail-fast: false
matrix:
image:
- name: api
dockerfile: docker/build/Dockerfile-api-dev
context: .
needs_maven: true
needs_secrets: false
- name: rest
dockerfile: vcell-rest/src/main/docker/Dockerfile.jvm
context: vcell-rest
needs_maven: true
needs_secrets: false
pre_build: "mvn --batch-mode clean install dependency:copy-dependencies -DskipTests -Dvcell.exporter=false"
- name: exporter
dockerfile: vcell-rest/src/main/docker/Dockerfile.jvm
context: vcell-rest
needs_maven: true
needs_secrets: false
pre_build: "mvn --batch-mode clean install dependency:copy-dependencies -DskipTests -Dvcell.exporter=true"
- name: webapp-dev
dockerfile: webapp-ng/Dockerfile-webapp
context: webapp-ng
needs_maven: false
needs_secrets: false
build_args: "BUILD_COMMAND=build_dev"
- name: webapp-stage
dockerfile: webapp-ng/Dockerfile-webapp
context: webapp-ng
needs_maven: false
needs_secrets: false
build_args: "BUILD_COMMAND=build_stage"
- name: webapp-prod
dockerfile: webapp-ng/Dockerfile-webapp
context: webapp-ng
needs_maven: false
needs_secrets: false
build_args: "BUILD_COMMAND=build_prod"
- name: webapp-island
dockerfile: webapp-ng/Dockerfile-webapp
context: webapp-ng
needs_maven: false
needs_secrets: false
build_args: "BUILD_COMMAND=build_island"
- name: webapp-remote
dockerfile: webapp-ng/Dockerfile-webapp
context: webapp-ng
needs_maven: false
needs_secrets: false
build_args: "BUILD_COMMAND=build_remote"
- name: db
dockerfile: docker/build/Dockerfile-db-dev
context: .
needs_maven: true
needs_secrets: false
- name: sched
dockerfile: docker/build/Dockerfile-sched-dev
context: .
needs_maven: true
needs_secrets: false
- name: submit
dockerfile: docker/build/Dockerfile-submit-dev
context: .
needs_maven: true
needs_secrets: false
- name: data
dockerfile: docker/build/Dockerfile-data-dev
context: .
needs_maven: true
needs_secrets: false
- name: mongo
dockerfile: docker/build/mongo/Dockerfile
context: docker/build/mongo
needs_maven: false
needs_secrets: false
- name: batch
dockerfile: docker/build/Dockerfile-batch-dev
context: .
needs_maven: true
needs_secrets: false
- name: opt
dockerfile: pythonCopasiOpt/Dockerfile
context: pythonCopasiOpt
needs_maven: false
needs_secrets: false
- name: clientgen
dockerfile: docker/build/Dockerfile-clientgen-dev
context: .
needs_maven: true
needs_secrets: false
needs_installer_secrets: true
- name: admin
dockerfile: docker/build/Dockerfile-admin-dev
context: .
needs_maven: true
needs_secrets: false
steps:
- name: Free up VM's disk space
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
sudo apt-get clean
- uses: actions/checkout@v4
- name: setup java 17 with maven cache
if: ${{ matrix.image.pre_build }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Download Maven artifacts
if: ${{ matrix.image.needs_maven }}
uses: actions/download-artifact@v4
with:
name: maven-build-output
path: .
- name: setup ssh-agent for installer secrets
if: ${{ matrix.image.needs_installer_secrets }}
uses: webfactory/ssh-agent@v0.8.0
with:
ssh-private-key: ${{ secrets.VC_KEY }}
- name: get installer secrets
if: ${{ matrix.image.needs_installer_secrets }}
env:
VCELL_MANAGER_NODE: vcellapi.cam.uchc.edu
VCELL_DEPLOY_REMOTE_DIR: /share/apps/vcell3/deployed_github
run: |
ssh-keyscan ${VCELL_MANAGER_NODE} >> ~/.ssh/known_hosts
sudo mkdir /usr/local/deploy
sudo chmod 777 /usr/local/deploy
cd /usr/local/deploy
scp ${{ secrets.CD_FULL_USER }}@${VCELL_MANAGER_NODE}:${VCELL_DEPLOY_REMOTE_DIR}/deploy_dir_2025_03_18.tar .
cd ..
sudo tar -xvf deploy/deploy_dir_2025_03_18.tar
sudo chmod 777 -R deploy
- name: Pre-build step
if: ${{ matrix.image.pre_build }}
run: ${{ matrix.image.pre_build }}
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build and push Docker image
run: |
IMAGE_NAME="vcell-${{ matrix.image.name }}"
FULL_TAG="${{ needs.setup.outputs.vcell_repo_namespace }}/${IMAGE_NAME}:${{ needs.setup.outputs.vcell_tag }}"
BUILD_ARGS=""
if [ -n "${{ matrix.image.build_args || '' }}" ]; then
BUILD_ARGS="--build-arg ${{ matrix.image.build_args }}"
fi
echo "Building ${FULL_TAG}"
docker buildx build --platform=linux/amd64 \
${BUILD_ARGS} \
-f ${{ matrix.image.dockerfile }} \
--tag ${FULL_TAG} \
${{ matrix.image.context }}
docker push ${FULL_TAG}
tag-and-push:
runs-on: ubuntu-22.04
needs: [setup, docker-build]
steps:
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Tag and push all images
run: |
REPO="${{ needs.setup.outputs.vcell_repo_namespace }}"
TAG="${{ needs.setup.outputs.vcell_tag }}"
FRIENDLY="${{ needs.setup.outputs.friendly_tag }}"
CONTAINERS="vcell-exporter vcell-api vcell-rest vcell-webapp-prod vcell-webapp-dev vcell-webapp-stage vcell-webapp-island vcell-webapp-remote vcell-batch vcell-opt vcell-clientgen vcell-data vcell-db vcell-mongo vcell-sched vcell-submit vcell-admin"
for CONTAINER in ${CONTAINERS}; do
docker pull ${REPO}/${CONTAINER}:${TAG}
docker tag ${REPO}/${CONTAINER}:${TAG} ${REPO}/${CONTAINER}:latest
docker tag ${REPO}/${CONTAINER}:${TAG} ${REPO}/${CONTAINER}:${FRIENDLY}
docker push --all-tags ${REPO}/${CONTAINER}
done
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ failure() }}
build-and-publish-sif:
name: Build and publish Apptainer SIF images
runs-on: ubuntu-22.04
needs: [setup, tag-and-push]
steps:
- name: Install Apptainer
uses: eWaterCycle/setup-apptainer@v2
- name: Log in to GHCR (for pull and push)
run: apptainer registry login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} oras://ghcr.io
- name: Build, validate, and publish SIF images
run: |
set -eux
REPO="${{ needs.setup.outputs.vcell_repo_namespace }}"
TAG="${{ needs.setup.outputs.friendly_tag }}"
for IMG in vcell-opt vcell-batch; do
SIF_NAME="$(echo "${REPO}/${IMG}_singularity:${TAG}" | tr '/:' '__').img"
echo "Building SIF for ${REPO}/${IMG}:${TAG} -> ${SIF_NAME}"
apptainer build "${SIF_NAME}" "docker://${REPO}/${IMG}:${TAG}"
apptainer inspect "${SIF_NAME}" > /dev/null
echo "Publishing ${SIF_NAME} to oras://${REPO}/${IMG}_singularity:${TAG}"
apptainer push "${SIF_NAME}" "oras://${REPO}/${IMG}_singularity:${TAG}"
done
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ failure() }}