-
Notifications
You must be signed in to change notification settings - Fork 19
107 lines (98 loc) · 2.72 KB
/
pythonpackage.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
97
98
99
100
101
102
103
104
105
106
107
name: Python package
on:
push:
# Build on tags that look like releases
tags:
- v*
# Build when main is pushed to
branches:
- main
pull_request:
# Build when a pull request targets main
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and test on ${{ matrix.os }} with Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
defaults:
run:
shell: bash {0}
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pdm install -G ci
- name: Test with tox
run: |
pyversion="${{ matrix.python-version }}"
pdm run tox -e py${pyversion/./}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
notebooks:
name: Run the notebooks on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
fail-fast: false
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python-version }}
cache: true
- name: Install dependencies
run: pdm install --prod -G docs
- name: Run notebooks test
run: pdm notebooks
lint:
name: Lint the code
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: pdm-project/setup-pdm@v3
with:
python-version: "3.10"
cache: true
- name: Install dependencies
run: pdm install -G ci
- name: Test with tox
run: pdm run tox -e lint
pypi-build-and-upload:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- uses: pdm-project/setup-pdm@v3
name: Setup PDM
with:
python-version: "3.10"
cache: true
- name: Build
run: pdm build
- name: Publish
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.6.4
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}