-
Notifications
You must be signed in to change notification settings - Fork 1
289 lines (256 loc) · 9.74 KB
/
build.yml
File metadata and controls
289 lines (256 loc) · 9.74 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
---
name: Build and test
on:
push:
pull_request:
schedule:
- cron: '40 6,15 * * *'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Building the RJM python package
- name: Build the package
run: python -m pip install .[dev]
- name: Check rjm_batch_submit command installed
run: rjm_batch_submit --help
- name: Check rjm_batch_wait command installed
run: rjm_batch_wait --help
- name: Display rjm version
run: rjm_batch_submit --version
# Run unit tests
- name: Run tests
run: pytest
pyinstaller:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
# Building the RJM python package
- name: Build the package
run: python -m pip install .[dev]
# Build executables using PyInstaller
- name: Build rjm_batch_submit
run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_batch_submit.py
working-directory: ./extra/pyinstaller
- name: Build rjm_batch_wait
run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_batch_wait.py
working-directory: ./extra/pyinstaller
- name: Build rjm_authenticate
run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_authenticate.py
working-directory: ./extra/pyinstaller
- name: Build rjm_config
run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_config.py
working-directory: ./extra/pyinstaller
- name: Build rjm_health_check
run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_health_check.py
working-directory: ./extra/pyinstaller
- name: Build rjm_batch_cancel
run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_batch_cancel.py
working-directory: ./extra/pyinstaller
- name: Build rjm_batch_run
run: pyinstaller --additional-hooks-dir=. -F ../../src/rjm/cli/rjm_batch_run.py
working-directory: ./extra/pyinstaller
- name: Dump license files
run: |
pip-licenses -f plain-vertical -l --output-file dist/bundled_licenses.txt
echo "Python license: https://docs.python.org/3/license.html" >> dist/bundled_licenses.txt
working-directory: ./extra/pyinstaller
# test the pyinstaller built health check runs
- name: Display pyinstaller built health check help
run: dist/rjm_health_check.exe --help
working-directory: ./extra/pyinstaller
- name: Display RJM version
run: dist/rjm_batch_submit.exe --version
working-directory: ./extra/pyinstaller
- name: Check pyinstaller build rjm_config help
run: dist/rjm_config.exe --help
working-directory: ./extra/pyinstaller
# archive the binaries
- name: Archive binaries
uses: thedoctor0/zip-release@master
with:
type: zip
directory: extra/pyinstaller/dist
filename: RemoteJobManager-${{ runner.os }}.zip
# upload archive as an artifact of the build
- uses: actions/upload-artifact@v4
with:
name: RemoteJobManager-${{ runner.os }}
path: extra/pyinstaller/dist/RemoteJobManager-*.zip
realtestpyinstaller:
needs: pyinstaller
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
name: Download artifact archive
with:
name: RemoteJobManager-${{ runner.os }}
- run: ls
- name: Extract artifact archive
run: 7z x RemoteJobManager-*.zip
- run: ls
# display version
- name: Display RJM version
run: ./rjm_batch_wait --version
# Secrets required for running real tests
- run: mkdir -p ~/.rjm
- run: printf "${RJM_CONFIG}" > ${RJM_CONFIG_FILE_TEMP}
shell: bash
env:
RJM_CONFIG: ${{ secrets.RJM_CONFIG }}
RJM_CONFIG_FILE_TEMP: ${{ runner.temp }}/rjm_config.ini
if: env.RJM_CONFIG != null
- run: ln -sf ${RJM_CONFIG_FILE_TEMP} ~/.rjm/rjm_config.ini
shell: bash
env:
RJM_CONFIG: ${{ secrets.RJM_CONFIG }}
RJM_CONFIG_FILE_TEMP: ${{ runner.temp }}/rjm_config.ini
if: env.RJM_CONFIG != null
- run: printf "${RJM_TOKENS}" > ${RJM_TOKENS_FILE_TEMP}
shell: bash
env:
RJM_TOKENS: ${{ secrets.RJM_TOKENS }}
RJM_TOKENS_FILE_TEMP: ${{ runner.temp }}/rjm_tokens.json
if: env.RJM_TOKENS != null
- run: ln -sf ${RJM_TOKENS_FILE_TEMP} ~/.rjm/rjm_tokens.json
shell: bash
env:
RJM_TOKENS: ${{ secrets.RJM_TOKENS }}
RJM_TOKENS_FILE_TEMP: ${{ runner.temp }}/rjm_tokens.json
if: env.RJM_TOKENS != null
- name: "Check if RJM secrets are set"
id: rjm_config_files
shell: bash
run: |
if [[ -r ~/.rjm/rjm_tokens.json ]] && [[ -r ~/.rjm/rjm_config.ini ]]; then
echo 'files_exist=true' >> $GITHUB_OUTPUT
else
echo 'files_exist=false' >> $GITHUB_OUTPUT
fi
# If the secrets were set, run some real tests
- name: Run the health check script
run: ./rjm_health_check -ll debug --retries --logextra
if: steps.rjm_config_files.outputs.files_exist == 'true'
timeout-minutes: 10
- name: Run batch_submit for nonmem example
run: ../../rjm_batch_submit -f localdirs.txt -ll debug -n --logextra
working-directory: ./examples/nonmem
if: steps.rjm_config_files.outputs.files_exist == 'true'
timeout-minutes: 10
- name: Run batch_wait for nonmem example
run: ../../rjm_batch_wait -f localdirs.txt -ll debug -n --logextra
working-directory: ./examples/nonmem
if: steps.rjm_config_files.outputs.files_exist == 'true'
timeout-minutes: 10
# Cleanup rjm config directory
- run: rm ~/.rjm/*
if: steps.rjm_config_files.outputs.files_exist == 'true'
releasepyinstaller:
runs-on: windows-latest
needs:
- realtestpyinstaller
- realtest
- test
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
name: Download artifact archive
with:
name: RemoteJobManager-${{ runner.os }}
# only if it's a tag, add the archive to the release
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: RemoteJobManager-*.zip
realtest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.11']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Building the RJM python package
- name: Build the package
run: python -m pip install .[dev]
# display version
- name: Display RJM version
run: rjm_batch_wait --version
# Secrets required for running real tests
- run: mkdir -p ~/.rjm
- run: printf "${RJM_CONFIG}" > ${RJM_CONFIG_FILE_TEMP}
shell: bash
env:
RJM_CONFIG: ${{ secrets.RJM_CONFIG }}
RJM_CONFIG_FILE_TEMP: ${{ runner.temp }}/rjm_config.ini
if: env.RJM_CONFIG != null
- run: ln -sf ${RJM_CONFIG_FILE_TEMP} ~/.rjm/rjm_config.ini
shell: bash
env:
RJM_CONFIG: ${{ secrets.RJM_CONFIG }}
RJM_CONFIG_FILE_TEMP: ${{ runner.temp }}/rjm_config.ini
if: env.RJM_CONFIG != null
- run: printf "${RJM_TOKENS}" > ${RJM_TOKENS_FILE_TEMP}
shell: bash
env:
RJM_TOKENS: ${{ secrets.RJM_TOKENS }}
RJM_TOKENS_FILE_TEMP: ${{ runner.temp }}/rjm_tokens.json
if: env.RJM_TOKENS != null
- run: ln -sf ${RJM_TOKENS_FILE_TEMP} ~/.rjm/rjm_tokens.json
shell: bash
env:
RJM_TOKENS: ${{ secrets.RJM_TOKENS }}
RJM_TOKENS_FILE_TEMP: ${{ runner.temp }}/rjm_tokens.json
if: env.RJM_TOKENS != null
- name: "Check if RJM secrets are set"
id: rjm_config_files
shell: bash
run: |
if [[ -r ~/.rjm/rjm_tokens.json ]] && [[ -r ~/.rjm/rjm_config.ini ]]; then
echo 'files_exist=true' >> $GITHUB_OUTPUT
else
echo 'files_exist=false' >> $GITHUB_OUTPUT
fi
# If the secrets were set, run some real tests
- name: Run the health check script
run: rjm_health_check -ll debug --retries --logextra
if: steps.rjm_config_files.outputs.files_exist == 'true'
timeout-minutes: 10
- name: Run batch_submit for nonmem example
run: rjm_batch_submit -f localdirs.txt -ll debug -n --logextra
working-directory: ./examples/nonmem
if: steps.rjm_config_files.outputs.files_exist == 'true'
timeout-minutes: 10
- name: Run batch_wait for nonmem example
run: rjm_batch_wait -f localdirs.txt -ll debug -n --logextra
working-directory: ./examples/nonmem
if: steps.rjm_config_files.outputs.files_exist == 'true'
timeout-minutes: 10
# Cleanup rjm config directory
- run: rm ~/.rjm/*
if: steps.rjm_config_files.outputs.files_exist == 'true'