-
Notifications
You must be signed in to change notification settings - Fork 2
201 lines (176 loc) · 5.93 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
197
198
199
200
201
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@b4ffde65f46336ab88eb53be808477a3936bae11" # v4.1.1
- 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@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236" # v4.7.1
with:
python-version: "3.12"
cache: "pip"
cache-dependency-path: |
.github/workflows/ci.yaml
pyproject.toml
tox.ini
week-number.txt
- name: "Restore the cache"
id: "restore-cache"
uses: "actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84" # v3.3.2
with:
path: |
.tox/
.venv/
key: >
lint
week=${{ env.week-number }}
python=${{ steps.setup-python.outputs.python-version }}
hash=${{ hashFiles('.github/workflows/ci.yaml', 'pyproject.toml', 'tox.ini') }}
- name: "Install Tox"
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: "Run mypy"
run: ".venv/bin/tox -e mypy"
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@b4ffde65f46336ab88eb53be808477a3936bae11" # v4.1.1
- 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@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236" # v4.7.1
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=$(ls -1 globus_action_provider_tools-*.whl | head -n 1)" >> $GITHUB_OUTPUT
- name: "Upload the artifact"
uses: "actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32" # v3.1.3
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@b4ffde65f46336ab88eb53be808477a3936bae11" # v4.1.1
- 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@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236" # v4.7.1
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@704facf57e6136b1bc63b828d79edcd491f0ee84" # v3.3.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@9bc31d5ccc31df68ecc42ccf4149144866c47d8a" # v3.0.2
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 }}