-
Notifications
You must be signed in to change notification settings - Fork 2
196 lines (170 loc) · 5.82 KB
/
ci.yaml
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
name: "CI"
on:
pull_request:
push:
branches:
- "main"
- "production"
env:
PRE_COMMIT_HOME: ".tox/pre-commit-home"
jobs:
lint:
name: "Lint"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repo"
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" # v4.1.7
- name: "Setup Python"
id: "setup-python"
uses: "actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3" # v5.2.0
with:
python-version: "3.12"
- name: "Detect Pythons"
uses: "kurtmckee/detect-pythons@38187a5464f266e93e5c1467699f7be2bf521d2e" # v1.1.0
- name: "Restore the cache"
id: "restore-cache"
uses: "actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" # v4.0.2
with:
path: |
.mypy_cache/
.tox/
.venv/
key: "lint-hash=${{ hashFiles('.github/workflows/ci.yaml', '.python-identifiers', 'pyproject.toml', 'tox.ini', 'requirements/*/*.txt') }}"
- name: "Create virtual environment"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
.venv/bin/pip install --upgrade pip setuptools wheel
.venv/bin/pip install tox
- name: "Lint type annotations"
run: |
.venv/bin/tox -e mypy
- name: "Lint documentation"
run: |
.venv/bin/tox -e docs
build:
name: "Build a shared wheel"
runs-on: "ubuntu-latest"
outputs:
wheel-filename: "${{ steps.build-wheel.outputs.wheel-filename }}"
steps:
- name: "Checkout the repo"
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" # v4.1.7
- name: "Identify the week number"
run: |
date +'%U' > week-number.txt
date +'week-number=%U' >> "$GITHUB_ENV"
- name: "Setup Python"
id: "setup-python"
uses: "actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3" # v5.2.0
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: |
.github/workflows/ci.yaml
pyproject.toml
tox.ini
week-number.txt
- name: "Build the wheel"
id: "build-wheel"
run: |
pip wheel .
echo "wheel-filename=$(find globus_action_provider_tools-*.whl | head -n 1)" >> "$GITHUB_OUTPUT"
- name: "Upload the artifact"
uses: "actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874" # v4.4.0
with:
name: "globus_action_provider_tools-${{ github.sha }}.whl"
path: "${{ steps.build-wheel.outputs.wheel-filename }}"
retention-days: 1
test:
name: "Test ${{ matrix.python-version }}${{ matrix.tox-extras }} on ${{ matrix.os.name }}"
needs: ["build"]
runs-on: "${{ matrix.os.value }}"
strategy:
matrix:
# Broadly test supported Python versions on Linux.
os:
- name: "Linux"
value: "ubuntu-latest"
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
tox-extras: [""]
include:
# Test Windows.
- os:
name: "Windows"
value: "windows-latest"
python-version: "3.12"
tox-extras: ""
# Test Mac.
- os:
name: "Mac"
value: "macos-latest"
python-version: "3.12"
tox-extras: ""
# Test minimum dependencies.
- os:
name: "Linux"
value: "ubuntu-latest"
python-version: "3.8"
tox-extras: "-minimum_flask"
- os:
name: "Linux"
value: "ubuntu-latest"
python-version: "3.12"
tox-extras: "-minimum_flask"
steps:
- name: "Checkout the repo"
uses: "actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332" # v4.1.7
- name: "Identify the week number"
shell: "bash"
run: |
date +'%U' > week-number.txt
date +'week-number=%U' >> "$GITHUB_ENV"
- name: "Setup Python"
id: "setup-python"
uses: "actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3" # v5.2.0
with:
python-version: "${{ matrix.python-version }}"
cache: "pip"
cache-dependency-path: |
.github/workflows/ci.yaml
pyproject.toml
tox.ini
week-number.txt
- name: "Restore cache"
id: "restore-cache"
uses: "actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9" # v4.0.2
with:
path: |
.tox/
.venv/
key: >
test
week=${{ env.week-number }}
os=${{ matrix.os.value }}
python=${{ steps.setup-python.outputs.python-version }}
hash=${{ hashFiles('.github/workflows/ci.yaml', 'pyproject.toml', 'tox.ini') }}
- name: "Identify virtual environment path"
shell: "bash"
run: |
echo 'venv-path=${{ runner.os == 'Windows' && '.venv/Scripts' || '.venv/bin' }}' >> "$GITHUB_ENV"
- name: "Install tox"
if: "steps.restore-cache.outputs.cache-hit == false"
run: |
python -m venv .venv
${{ env.venv-path }}/pip install --upgrade pip setuptools wheel
${{ env.venv-path }}/pip install tox
- name: "Download the artifact"
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16" # v4.1.8
with:
name: "globus_action_provider_tools-${{ github.sha }}.whl"
- name: "Test"
run: >
${{ env.venv-path }}/tox run
--installpkg="${{ needs.build.outputs.wheel-filename }}"
-e py${{ matrix.python-version}}${{ matrix.tox-extras }}