-
Notifications
You must be signed in to change notification settings - Fork 5
266 lines (250 loc) · 8.74 KB
/
test.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
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
name: Build
on:
push:
branches:
- main
tags:
pull_request:
jobs:
tests:
strategy:
matrix:
include:
- test: pytest
- test: github-tag-release
- test: github-tag-teams
- test: github-decimate-org
- test: github-fork-org
- test: github-get-ratelimit
- test: github-auth
- test: github-list-repos
- test: github-mv-repos-to-team
- test: github-auth-debug
env:
DM_SQUARE_DEBUG: 'bogus_non_int_able_value'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install deps
run: |
pip install --upgrade pip setuptools_scm 'setuptools==58'
#if [ "${{ matrix.test }}" == "github-tag-release" ]; then
python setup.py sdist
pip install dist/sqre-codekit-*.tar.gz
#fi
- name: Run Tests
env:
SQREADMIN_TOKEN: ${{ secrets.SQREADMIN_TOKEN }}
DM_SQUARE_DEBUG: ${{ matrix.env.DM_SQUARE_DEBUG || '' }}
run: |
set -e
TEST=${{ matrix.test }}
case "$TEST" in
pytest)
python setup.py test
;;
github-tag-release)
set -e
# check argparse help formatting for errors
"$TEST" -h
if [ -n "$SQREADMIN_TOKEN" ]; then
# verify a past weekly tag -- the eups tag name and git tag names are
# in sync except for s/_/-/
"$TEST" \
--verify \
--debug \
--limit 10 \
--org 'lsst' \
--allow-team 'Data Management' \
--allow-team 'DM Externals' \
--external-team 'DM Externals' \
--deny-team 'DM Auxilliaries' \
--email '[email protected]' \
--user 'sqreadmin' \
--token "$SQREADMIN_TOKEN" \
--ignore-git-tagger \
--ignore-git-message \
--manifest 'b3595' \
'w.2018.18'
# verify a past official release where the git tag was generated from
# an rcX eups tag. This validates the location of the git tags but
# does not inspect the official eups release tag at all.
"$TEST" \
--verify \
--debug \
--limit 10 \
--org 'lsst' \
--allow-team 'Data Management' \
--allow-team 'DM Externals' \
--external-team 'DM Externals' \
--deny-team 'DM Auxilliaries' \
--email '[email protected]' \
--user 'sqreadmin' \
--token "$SQREADMIN_TOKEN" \
--ignore-git-tagger \
--ignore-git-message \
--eups-tag 'v15_0_rc3' \
--manifest 'b3504' \
'15.0'
# verify a past official release using the eups tag. As the eups
# product version strings will be out of sync between the versiondb
# manifest it was based on and the eups tag, the eups product version
# strings have to be ignored.
"$TEST" \
--verify \
--debug \
--limit 10 \
--org 'lsst' \
--allow-team 'Data Management' \
--allow-team 'DM Externals' \
--external-team 'DM Externals' \
--deny-team 'DM Auxilliaries' \
--email '[email protected]' \
--user 'sqreadmin' \
--token "$SQREADMIN_TOKEN" \
--ignore-manifest-versions \
--ignore-git-tagger \
--ignore-git-message \
--manifest 'b3504' \
'15.0'
"$TEST" \
--dry-run \
--debug \
--limit 10 \
--org 'lsst' \
--allow-team 'Data Management' \
--allow-team 'DM Externals' \
--external-team 'DM Externals' \
--deny-team 'DM Auxilliaries' \
--email '[email protected]' \
--user 'sqreadmin' \
--token "$SQREADMIN_TOKEN" \
--ignore-manifest-versions \
--ignore-git-tagger \
--ignore-git-message \
--manifest 'b3595' \
--manifest-only \
'w.2018.18'
else
echo "Unable to test without secure env vars."
fi
;;
github-tag-teams)
"$TEST" -h
if [ -n "$SQREADMIN_TOKEN" ]; then
# check argparse help formatting for errors
# create
"$TEST" \
--debug \
--dry-run \
--org 'lsst' \
--allow-team 'DM Auxilliaries' \
--deny-team 'DM Externals' \
--token "$SQREADMIN_TOKEN" \
--user 'sqreadmin' \
--email '[email protected]' \
--tag 'foo' \
--tag 'bar'
# --delete
"$TEST" \
--debug \
--dry-run \
--delete \
--org 'lsst' \
--allow-team 'DM Auxilliaries' \
--deny-team 'DM Externals' \
--token "$SQREADMIN_TOKEN" \
--user 'sqreadmin' \
--email '[email protected]' \
--tag 'foo' \
--tag 'bar'
else
echo "Unable to test without travis secure env vars."
fi
;;
github-decimate-org)
"$TEST" -h
if [ -n "$SQREADMIN_TOKEN" ]; then
"$TEST" \
--dry-run \
--debug \
--org 'batmanuel-sandbox' \
--token "$SQREADMIN_TOKEN" \
--delete-repos \
--delete-repos-limit 3 \
--delete-teams \
--delete-teams-limit 3
else
echo "Unable to test without travis secure env vars."
fi
;;
github-fork-org)
# check argparse help formatting for errors
"$TEST" -h
if [ -n "$SQREADMIN_TOKEN" ]; then
"$TEST" \
--dry-run \
--debug \
--src-org 'lsst' \
--dst-org 'batmanuel-sandbox' \
--token "$SQREADMIN_TOKEN" \
--team 'DM Auxilliaries' \
--team 'DM Externals' \
--team 'Data Management' \
--limit 10
#--copy-teams
else
echo "Unable to test without travis secure env vars."
fi
;;
github-get-ratelimit)
# check argparse help formatting for errors
"$TEST" -h
if [ -n "$SQREADMIN_TOKEN" ]; then
"$TEST" \
--debug \
--token "$SQREADMIN_TOKEN"
else
echo "le to test without travis secure env vars."
fi
;;
github-auth-debug)
TEST=github-auth
# should fail
"$TEST" -u foo || true
#[[ $? == 1 ]]
;;
*)
"$TEST" -h
;;
esac
publish:
needs: tests
name: Upload release to PyPI
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
environment:
name: pypi
url: https://pypi.org/p/<your-pypi-project-name>
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.6'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1