This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
96 lines (96 loc) · 2.64 KB
/
cicd.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
name: "CI/CD"
on:
- push
- pull_request
env:
DEFAULT_PYTHON: 3.9
jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
python-version:
- 3.8
- 3.9
- '3.10'
- '3.11'
include:
- os: ubuntu-20.04
python-version: 3.5
runs-on: ${{ matrix.os }}
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: update build tools
run: python -m pip install --upgrade setuptools pip
- name: install test runner
run: python -m pip install tox tox-gh-actions
- name: run test suite
run: tox
env:
TOX_OS: ${{ matrix.os }}
build:
runs-on: ubuntu-latest
strategy:
matrix:
distribution:
- sdist
- wheel
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: install build tool
run: python -m pip install build
- name: build ${{ matrix.distribution }}
run: python -m build --$DIST
env:
DIST: ${{ matrix.distribution }}
- name: upload ${{ matrix.distribution }} artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.distribution }}
path: dist/
publish:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
needs:
- test
- build
steps:
- name: setup python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v4
- name: download sdist artifact
uses: actions/download-artifact@v3
with:
name: sdist
path: dist/
- name: download wheel artifact
uses: actions/download-artifact@v3
with:
name: wheel
path: dist/
- name: publish built artifacts to test.pypi.org
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: publish built artifacts to pypi.org
if: ${{ startsWith(github.ref, 'refs/tag') }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}