-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (95 loc) · 2.85 KB
/
build-and-release.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
name: "build-and-release"
on:
schedule:
- cron: "0 10 * * *" # Every day at 10
push:
jobs:
ci:
name: "Run tests"
strategy:
fail-fast: false
matrix:
python-version: [
# "3.8", # Some dev dependencies aren't supported
# "3.9", # Coverage is messed up for some reason
"3.10",
"3.11",
"3.12",
]
poetry-version: ["1.6.1"]
os: [
ubuntu-latest,
macos-latest,
# windows-latest, # Disabling Windows to get build working
]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: poetry install --all-extras
- name: Run tests
run: poetry run pytest
code-coverage:
name: "Code coverage"
if: ${{ github.ref == 'refs/heads/main' }}
needs: ci
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.6.1'
- name: Install dependencies
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
poetry install --all-extras
- name: Test & publish code coverage
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
coverageCommand: poetry run pytest
coverageLocations: ${{github.workspace}}/dist/coverage.info:lcov
tagged-release: # Publish new library version for tagged commits
name: "Tagged release"
if: ${{ startsWith( github.ref, 'refs/tags/' ) }}
needs: ci
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.6.1'
- name: Install dependencies
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
poetry install --all-extras
- name: Build and publish package
run: poetry publish --build --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
- name: Create Github release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.RELEASE_TOKEN }}"
prerelease: false
files: |
dist/*.whl
dist/*.tar.gz