-
Notifications
You must be signed in to change notification settings - Fork 1
112 lines (108 loc) · 3.5 KB
/
on-push.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
name: tests and deployment
on:
pull_request:
branches:
- main
push:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
python-version: [
"3.9", "3.10", "3.11", "3.12",
# "pypy-3.9", "pypy-3.10", # see <https://github.com/beartype/beartype/issues/324>
]
steps:
- uses: actions/checkout@v2
with:
# See <https://github.com/actions/checkout/issues/249>
fetch-depth: 0
- name: set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: test ${{ matrix.python-version }} with Tox
run: |
python -m pip install --upgrade 'pip>=23,!=23.1.2,!=23.2'
python -m pip install 'tox-gh-actions~=2.12.0'
git submodule update --init --recursive
tox --verbose
deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: test
if: |
github.ref_type == 'tag' && (
github.ref_name == 'latest' || startsWith(github.ref_name, 'v')
)
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ">=3.10"
- name: build and check dist and docs
run: |
python -m pip install --upgrade 'pip>=23,!=23.1.2,!=23.2'
python -m pip install \
tox \
'versioningit~=2.0'
. ./helpers/ci-vars.sh # defines PKG, TAG, VERS, etc.
if [ ${{ github.ref_name }} = "${TAG}" ] ; then
./helpers/propagate-version.sh
git update-index -q --refresh
if ! git diff-index --quiet HEAD -- ; then
git status
git diff
echo 1>&2 "$( basename "${0}" ): changes detected after substitutions"
exit 1
fi
else
[ ${{ github.ref_name }} = latest ] # assert
fi
git config user.name "$( git log --max-count 1 --pretty=format:%an )"
git config user.email "$( git log --max-count 1 --pretty=format:%ae )"
tox -e check
[ -f "dist/${PKG}-${VERS_PATCH}-py3-none-any.whl" ]
(
. .tox/check/bin/activate
mike deploy --rebase --update-aliases "${VERS}" latest
)
- name: publish to test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: |
github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: post test publish check and publish GHQ pages
if: |
github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
run: |
. ./helpers/ci-vars.sh
for i in {0..45} ; do
if pip install \
--index-url 'https://test.pypi.org/simple' \
--extra-index-url 'https://pypi.org/simple' \
"${PROJECT}==${VERS_PATCH}" ; then
break
fi
sleep 2
done
[ "$( python -c "from ${PKG} import __vers_str__ ; print(__vers_str__)" )" = "${VERS_PATCH}" ]
git push origin gh-pages
- name: publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: |
github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}