-
Notifications
You must be signed in to change notification settings - Fork 2
310 lines (265 loc) · 10.1 KB
/
ci.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
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: CI
on:
push:
branches:
- master
- releases/*
pull_request:
branches:
- master
- releases/*
# Global Settings
env:
PYTHON_VERSION: "3.9"
# TODO: cannot update to 1.4 yet, see https://github.com/python-poetry/poetry/issues/7611
POETRY_VERSION: 1.3.2
WINFSP_VERSION: 1.8.20304
FORCE_MATURIN_RELEASE: 1
PYTEST_ARGS: >-
--numprocesses=auto
--verbose
concurrency:
group: ci-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# Github PR merging is configured to only require this job to pass
ci-is-happy:
name: ⭐ CI is happy ⭐
needs:
- linux-client
- linux-server
- windows-client
runs-on: ubuntu-latest
if: always()
# Just a fail-safe timeout, see the fine grain per-task timeout instead
timeout-minutes: 2
steps:
# The Needs context value contains only:
# - the final state of a job (if it fails or not)
# - its output (currently, none of our jobs are configuring outputs variable)
#
# https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context
- name: Debug the needs context values
env:
NEEDS: ${{ toJSON(needs) }}
run: printenv NEEDS
- name: We're very sorry
run: |
echo "Oh No, we have jobs that have failed/cancelled/skipped :("
exit 21
if: >-
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'skipped')
|| contains(needs.*.result, 'cancelled')
|| ! contains(needs.*.result, 'success')
- name: It's showtime
run: echo "My job here is done !"
#################################
# Linux #
#################################
linux-client:
name: 🐧 Linux client
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4 # [email protected]
with:
submodules: true
- name: Install fuse
run: sudo apt-get install -y libfuse2
- name: Install poetry-${{ env.POETRY_VERSION }}
shell: bash
run: |
set -eux
set -o pipefail
export POETRY_HOME="$HOME/.poetry"
mkdir -p "$POETRY_HOME"
if ! curl -sSL https://install.python-poetry.org | python3 - --version=${{ env.POETRY_VERSION }}; then
tail -n +0 ${{ github.workspace }}/poetry-installer*.log
exit 3
fi
echo "$POETRY_HOME/bin" >> "$GITHUB_PATH"
- name: Set up Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # [email protected]
id: setup-python
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Configure poetry to use the installed python
shell: bash
run: poetry env use ${{ steps.setup-python.outputs.python-path }}
working-directory: client
- name: Debug python & poetry versions
run: |
python --version
poetry --version
poetry env info
working-directory: client
- name: Generate cache key
id: cache-key
run: |
echo "key=linux-client-2-${{ hashFiles('client/poetry.lock', 'client/submodules/parsec-cloud/**') }}" >> $GITHUB_OUTPUT
# Using this workaround to cache `poetry` dependencies until
# https://github.com/actions/setup-python/issues/476 is resolved
- name: Restore python dependencies
uses: actions/cache/restore@704facf57e6136b1bc63b828d79edcd491f0ee84 # pin v3.3.2
id: restore
with:
key: ${{ steps.cache-key.outputs.key }}
path: /home/runner/.cache/pypoetry/virtualenvs/resana-secure-ZeXD18oj-py3.9
- name: Cache rust artifact
uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # pin v2.6.2
with:
workspaces: client/submodules/parsec-cloud -> target
cache-targets: true
cache-all-crates: true
- name: Install Project
run: poetry install -v
working-directory: client
- name: Verify poetry lock is up to date with submodule dependency parsec-cloud
run: |
set -o pipefail -e
POETRY_PARSEC_VERSION=$(poetry show parsec-cloud | sed -n 's/^\s\+version\s\+: \(v\S\+\)\s\+$/\1/p')
SUBMOD_PARSEC_VERSION=$(sed -n 's/^__version__ = "\(.*\)"$/\1/p' submodules/parsec-cloud/parsec/_version.py)
if [ -z "$POETRY_PARSEC_VERSION" ]; then
echo "Empty poetry version" >&2
exit 1
fi
if [ -z "$SUBMOD_PARSEC_VERSION" ]; then
echo "Empty submodule version" >&2
exit 1
fi
if [ "$POETRY_PARSEC_VERSION" != "$SUBMOD_PARSEC_VERSION" ]; then
(
echo "The versions between poetry and submodule don't match (\`$POETRY_PARSEC_VERSION\` != \`$SUBMOD_PARSEC_VERSION\`)"
echo "This is likely because someone forgot to update \`poetry.lock\` file"
echo "To update \`poetry.lock\` use:"
echo
echo "\`poetry lock --no-update\`"
) >&2
exit 1
fi
working-directory: client
- name: Check fuse
run: poetry run python -c "import fuse"
working-directory: client
- name: Run Tests
run: poetry run py.test client_tests ${{ env.PYTEST_ARGS }}
timeout-minutes: 10
working-directory: client
# Using this workaround to cache `poetry` dependencies until
# https://github.com/actions/setup-python/issues/476 is resolved
- name: Save python dependencies before `pre-commit`
uses: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # pin v3.3.2
if: steps.restore.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-key.outputs.key }}
path: /home/runner/.cache/pypoetry/virtualenvs/resana-secure-ZeXD18oj-py3.9
- name: "[Quality] Run pre-commit with mypy-client"
uses: pre-commit/[email protected]
linux-server:
name: 🐧 Linux server
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
steps:
- name: Checkout
uses: actions/checkout@v4 # [email protected]
with:
submodules: true
- name: Install poetry-${{ env.POETRY_VERSION }}
shell: bash
run: |
set -eux
set -o pipefail
export POETRY_HOME="$HOME/.poetry"
mkdir -p "$POETRY_HOME"
if ! curl -sSL https://install.python-poetry.org | python3 - --version=${{ env.POETRY_VERSION }}; then
tail -n +0 ${{ github.workspace }}/poetry-installer*.log
exit 3
fi
echo "$POETRY_HOME/bin" >> "$GITHUB_PATH"
- name: Set up Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # [email protected]
id: setup-python
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Configure poetry to use the installed python
shell: bash
run: poetry env use ${{ steps.setup-python.outputs.python-path }}
- name: Debug python & poetry versions
run: |
python --version
poetry --version
poetry env info
# Using this workaround to cache `poetry` dependencies until
# https://github.com/actions/setup-python/issues/476 is resolved
- name: Cache python dependencies
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # pin v3.3.2
with:
key: linux-server-2-${{ hashFiles('server/poetry.lock') }}
path: /home/runner/.cache/pypoetry/virtualenvs/resana-server-OVnVNowq-py3.9
- name: Install Project
run: poetry install -v
- name: Run Tests
run: poetry run py.test server_tests ${{ env.PYTEST_ARGS }}
timeout-minutes: 10
#################################
# Windows #
#################################
windows-client:
name: 🏁 Windows client
runs-on: windows-latest
defaults:
run:
working-directory: client
steps:
- name: Checkout
uses: actions/checkout@v4 # [email protected]
with:
submodules: true
- name: Install poetry-${{ env.POETRY_VERSION }}
shell: bash
run: |
set -eux
export POETRY_HOME=${APPDATA}/.poetry
curl -sSL https://install.python-poetry.org \
| python3 - --version=${{ env.POETRY_VERSION }}
echo "${APPDATA}\.poetry\bin" >> "$GITHUB_PATH"
- name: Set up Python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # [email protected]
id: setup-python
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Configure poetry to use the installed python
shell: pwsh
run: poetry env use ${{ steps.setup-python.outputs.python-path }}
- name: Debug python & poetry versions
shell: bash
run: |
python --version
poetry --version
poetry env info
- name: Install WinFSP
shell: bash
run: |
set -eux
choco install -y --limit-output winfsp --version=${{ env.WINFSP_VERSION }}
# Using this workaround to cache `poetry` dependencies until
# https://github.com/actions/setup-python/issues/476 is resolved
- name: Cache python dependencies
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # pin v3.3.2
with:
key: windows-build-${{ hashFiles('client/poetry.lock', 'client/submodules/parsec-cloud/**') }}
path: C:\Users\runneradmin\AppData\Local\pypoetry\Cache\virtualenvs\resana-secure-*
- name: Cache rust artifact
uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # pin v2.6.2
with:
workspaces: client/submodules/parsec-cloud -> target
cache-targets: true
cache-all-crates: true
- name: Install project
run: poetry install -v
- name: Run tests
run: poetry run py.test client_tests ${{ env.PYTEST_ARGS }}
timeout-minutes: 10