-
Notifications
You must be signed in to change notification settings - Fork 3
83 lines (78 loc) · 2.22 KB
/
main.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
name: CI
on:
push:
branches:
- main
tags:
- v*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install the package and the dependencies
run: pip install -e ".[dev]"
- name: Run tests with pytest
run: pytest
- name: Check that the version matches the tag
if: github.event_name == 'push' && github.ref_type == 'tag' && runner.os != 'Windows'
run: |
python3 -c "import astyle_py, sys; sys.exit(0 if f\"v{astyle_py.__version__}\" == \"${{ github.ref_name }}\" else 1)"
build_wheels:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- run: python3 -m pip install --upgrade setuptools build
- run: |
python3 -m build
find dist
- name: Upload wheels as job artifacts
if: github.event_name == 'push' && github.ref_type == 'tag'
uses: actions/upload-artifact@v1
with:
name: dist
path: dist
- name: Sanity-check the resulting wheel
run: |
python3 -m venv venv
. venv/bin/activate
pip install dist/*.whl
astyle_py --version
upload_wheels:
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: build_wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Download wheels from artifacts
uses: actions/download-artifact@v1
with:
name: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
repository_url: ${{ secrets.PYPI_URL }}