-
Notifications
You must be signed in to change notification settings - Fork 20
237 lines (200 loc) · 6.64 KB
/
ci_cd.yml
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
name: CI/CD
on:
push:
branches:
- '*'
- '*/*'
- '**'
release:
types: [published, edited]
env:
python-version: "3.9"
jobs:
CI-Build:
name: CI-build
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
cache: "pip"
- name: Install Dependencies
run: pip install -r requirements.txt
- name: build vcell-cli-utils package
run: |
cd vcell-cli-utils
poetry install
poetry run python -m pytest
- name: build vcell-admin package
run: |
cd docker/swarm/vcell-admin
poetry install
poetry run python -m pytest
- name: build pythonCopasiOpt package
run: |
cd pythonCopasiOpt/vcell-opt
poetry install
poetry run python -m pytest
- name: build pythonVtk package
run: |
cd pythonVtk
poetry install
poetry run python -m pytest
- name: setup java 17 with maven cache
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Add Linux dependencies
shell: bash
run: |
mvn -version
java -version
mvn --batch-mode clean install dependency:copy-dependencies -DskipTests=true
- name: Test building of docker image
run: |
docker build \
--file Dockerfile \
.
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ failure() }}
CI-Test:
runs-on: ubuntu-20.04
strategy:
matrix:
test-group: [Fast, MathGen_IT, SBML_IT, SEDML_SBML_IT, SEDML_VCML_IT, BSTS_IT]
fail-fast: false
if: ${{ github.event_name == 'push' }}
name: CI-Test-group-${{ matrix.test-group }}
steps:
- uses: actions/checkout@v3
- name: Install hdf5 tools needed for testing
run: sudo apt-get -y update && sudo apt-get -y install hdf5-tools
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
cache: "pip"
- name: Install Dependencies
run: pip install -r requirements.txt
- name: build vcell-cli-utils package
run: |
cd vcell-cli-utils
poetry install
poetry run python -m pytest
- name: build vcell-admin package
run: |
cd docker/swarm/vcell-admin
poetry install
poetry run python -m pytest
- name: build pythonCopasiOpt package
run: |
cd pythonCopasiOpt/vcell-opt
poetry install
poetry run python -m pytest
- name: build pythonVtk package
run: |
cd pythonVtk
poetry install
poetry run python -m pytest
- name: setup java 17 with maven cache
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Add Linux dependencies
shell: bash
run: |
mvn -version
java -version
mvn --batch-mode clean install dependency:copy-dependencies -Dgroups="org.vcell.test.${{ matrix.test-group }}"
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# if: ${{ failure() }}
CD:
name: CD
runs-on: ubuntu-20.04
if: ${{ github.event_name == 'release' }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
cache: "pip"
- name: Install Dependencies
run: pip install -r requirements.txt
- name: build vcell-cli-utils package
run: |
cd vcell-cli-utils
poetry install
poetry run python -m pytest
- name: build vcell-admin package
run: |
cd docker/swarm/vcell-admin
poetry install
poetry run python -m pytest
- name: build pythonCopasiOpt package
run: |
cd pythonCopasiOpt/vcell-opt
poetry install
poetry run python -m pytest
- name: build pythonVtk package
run: |
cd pythonVtk
poetry install
poetry run python -m pytest
- name: setup java 17 with maven cache
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Get the VCell version from tags
id: version
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
- name: Add Linux dependencies
shell: bash
run: |
mvn -version
java -version
mvn --batch-mode clean install dependency:copy-dependencies -Dgroups="org.vcell.test.Fast"
- name: Build Docker image and push with latest tag
run: |
set -ux
REVISION=$(git rev-parse HEAD)
CREATED=$(date --rfc-3339=seconds | sed 's/ /T/')
sed -i 's/_VC_VERSION_TAG_/${{steps.version.outputs.tag}}/g' biosimulators.json
echo ${{ secrets.ACTION_TOKEN }} | docker login ghcr.io -u ${{ secrets.ACTION_USER }} --password-stdin
docker build \
--no-cache \
--file Dockerfile \
--build-arg SIMULATOR_VERSION=${{steps.version.outputs.tag}} \
--tag ghcr.io/virtualcell/biosimulators_vcell:latest \
--label org.opencontainers.image.revision=${REVISION} \
--label org.opencontainers.image.created=${CREATED} \
--label org.opencontainers.image.version=${{steps.version.outputs.tag}} \
--label org.opencontainers.image.license=MIT \
.
docker tag ghcr.io/virtualcell/biosimulators_vcell:latest ghcr.io/virtualcell/biosimulators_vcell:${{steps.version.outputs.tag}}
docker push --all-tags ghcr.io/virtualcell/biosimulators_vcell
- name: Get release upload URL
id: get_url
uses: pdamianik/[email protected]
with:
tag: ${{ steps.version.outputs.tag }}
token: ${{ github.token }}
- name: Upload edited specifications file
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ steps.get_url.outputs.uploadUrl }}
asset_path: biosimulators.json
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ failure() }}