-
Notifications
You must be signed in to change notification settings - Fork 77
264 lines (240 loc) · 8.61 KB
/
continuous-testing.yml
File metadata and controls
264 lines (240 loc) · 8.61 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
name: "Test and deploy"
on:
push:
branches: ['**']
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
pull_request:
branches: ['**']
jobs:
# Continuous testing
# ------------------
test-from-src:
runs-on: ubuntu-20.04
strategy:
matrix:
image:
- "ecoleai/ci-linux-src-clang10-py3.7"
- "ecoleai/ci-linux-src-gcc9-py3.7"
container:
image: ${{ matrix.image }}
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
steps:
- uses: actions/checkout@v2
- name: "Configure, build, and test ecole-lib and ecole-py-ext."
run: ./dev/run.sh --fix-pythonpath configure -- test-lib -- test-py
test-with-conda-py:
strategy:
matrix:
os:
- "ubuntu-20.04"
- "macos-10.15"
python: ["3.7", "3.8", "3.9", "3.10"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python=${{ matrix.python }}
- name: "Configure, build, and test ecole-lib and ecole-py-ext."
shell: bash -l {0}
run: ./dev/run.sh --fix-pythonpath configure -D CMAKE_BUILD_TYPE=CondaRelease -- test-lib -- test-py
test-with-conda-shared:
strategy:
matrix:
os:
- "ubuntu-20.04"
- "macos-10.15"
shared-lib: ["ON", "OFF"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Configure, build, and test ecole-lib and ecole-py-ext."
shell: bash -l {0}
run: |
./dev/run.sh --fix-pythonpath configure -D BUILD_SHARED_LIBS=${{ matrix.shared-lib }} \
-D CMAKE_BUILD_TYPE=CondaRelease -- test-lib -- test-py
# Currenlty only sanitize address without Python
test-with-sanitizer:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Configure, build, and test ecole-lib with sanitizer."
shell: bash -l {0}
# Using Ctest runner to avoid out of memory
run: ./dev/run.sh --fix-pythonpath configure -D SANITIZE_ADDRESS=ON -D CMAKE_BUILD_TYPE=CondaRelease -- ctest-lib
check-code:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Run pre-commit."
shell: bash -l {0}
run: ./dev/run.sh --fix-pythonpath configure -D CMAKE_BUILD_TYPE=CondaRelease -- check-code
test-doc:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python="3.9"
- name: "Configure and build ecole-py-ext. Build and test documentation."
shell: bash -l {0}
run: ./dev/run.sh --fix-pythonpath configure -D CMAKE_BUILD_TYPE=CondaRelease -- test-doc
test-dist:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Build and test dist"
shell: bash -l {0}
run: ./dev/run.sh test-dist
test-example-libecole:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Build and install libecole, test using the library through CMake"
shell: bash -l {0}
run: ./dev/run.sh configure -D ECOLE_BUILD_PY_EXT=OFF -D BUILD_SHARED_LIBS=ON -- test-example-libecole
test-example-configuring:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python="3.9"
- name: "Add external example dependencies (except ecole)"
shell: bash -l {0}
run: |
sed -E '/[[:blank:]]ecole([^a-zA-Z0-9-]|$)/d' examples/configuring-bandits/conda-requirements.yaml > env.yaml
micromamba install --file env.yaml
- name: "Build Ecole and test notebook"
shell: bash -l {0}
run: ./dev/run.sh --fix-pythonpath configure -- test-example-configuring
test-example-branching:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python="3.9"
- name: "Add external example dependencies (except ecole)"
shell: bash -l {0}
run: |
sed -E '/[[:blank:]]ecole([^a-zA-Z0-9-]|$)/d' examples/branching-imitation/conda-requirements.yaml > env.yaml
micromamba install --file env.yaml
- name: "Build Ecole and test notebook"
shell: bash -l {0}
run: ./dev/run.sh --fix-pythonpath configure -- test-example-branching
# Deploy checkpoint
# -----------------
all-tests:
needs:
- test-from-src
- test-with-conda-py
- test-with-conda-shared
- test-with-sanitizer
- test-doc
- test-dist
- test-example-libecole
- test-example-configuring
- test-example-branching
- check-code
runs-on: ubuntu-20.04
steps:
- name: "All tests were successful."
run: ""
# Continuous deploy
# -----------------
# Does not trigger for Pull Request to to the github.ref matching refs/pull/**
deploy-latest-doc:
if: ${{ github.ref == 'refs/heads/master' }}
needs: all-tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with: {fetch-depth: 0}
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python="3.9"
- name: "Build documentation."
shell: bash -l {0}
run: |
./dev/run.sh --fix-pythonpath --build-doc-dir=local/docs/latest \
configure -D CMAKE_BUILD_TYPE=CondaRelease -- build-doc
- name: "Symlink stable documentation."
run: |
version="$(./dev/run.sh git-version origin/master | grep -E -o '[0-9]+\.[0-9]+')" &&
cd local/docs/ &&
ln -sf "${version:?}" "stable"
- uses: ./.github/actions/push-to-repo
with:
git_email: "BotEcole@users.noreply.github.com"
git_user: "BotEcole"
ssh_key: "${{ secrets.BOT_ECOLE_SSH_KEY }}"
repository: "git@github.com:ds4dm/doc.ecole.ai.git"
repository_subdir: "py/en"
local_dir: "local/docs/"
delete_existing: true
# Release deploy
# --------------
# Does not trigger for Pull Request to to the github.ref matching refs/pull/**
test-version:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs: all-tests
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: "Check version file matches the version."
run: ./dev/run.sh test-version "${GITHUB_REF#refs/tags/}"
deploy-version-doc:
needs: test-version
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with:
environment-file: dev/conda.yaml
extra-specs: python="3.9"
- name: "Build documentation."
shell: bash -l {0}
run: |
version="$(echo "${GITHUB_REF#refs/tags/v}" | grep -E -o '[0-9]+\.[0-9]+')" &&
./dev/run.sh --fix-pythonpath --build-doc-dir="local/docs/${version}" \
configure -D CMAKE_BUILD_TYPE=CondaRelease -- build-doc
- uses: ./.github/actions/push-to-repo
with:
git_email: "BotEcole@users.noreply.github.com"
git_user: "BotEcole"
ssh_key: "${{ secrets.BOT_ECOLE_SSH_KEY }}"
repository: "git@github.com:ds4dm/doc.ecole.ai.git"
repository_subdir: "py/en"
local_dir: "local/docs/"
delete_existing: false
deploy-pypi:
runs-on: ubuntu-20.04
needs: test-version
steps:
- uses: actions/checkout@v2
- uses: mamba-org/provision-with-micromamba@v11
with: { environment-file: dev/conda.yaml }
- name: "Build, test, and deploy sdist"
shell: bash -l {0}
env:
TWINE_USERNAME: "${{ secrets.PYPI_USERNAME }}"
TWINE_PASSWORD: "${{ secrets.PYPI_PASSWORD }}"
run: ./dev/run.sh deploy-sdist