-
Notifications
You must be signed in to change notification settings - Fork 2
145 lines (139 loc) · 4 KB
/
test-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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Test and Release
on:
push:
branches: [ "main" ]
jobs:
Unit_Test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v3
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.3.2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: "poetry"
- name: Install Dependencies
run: poetry install
- name: Test with PyTest
run: poetry run coverage run -m pytest -m "not integration"
env:
COVERAGE_FILE: unit_test.coverage
- uses: actions/upload-artifact@master
with:
name: unit-cov
path: unit_test.coverage
Integration_Test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v3
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.3.2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: "poetry"
- name: Install Dependencies
run: poetry install
- name: Test with PyTest
run: poetry run coverage run -m pytest -m "integration"
env:
COVERAGE_FILE: integration.coverage
- uses: actions/upload-artifact@master
with:
name: int-cov
path: integration.coverage
Validate:
runs-on: ubuntu-latest
needs:
- Unit_Test
- Integration_Test
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install coverage
run: pip install coverage
- uses: actions/download-artifact@master
name: Download Unit Test results
id: download_unit
with:
name: unit-cov
path: unit_test.coverage
- uses: actions/download-artifact@master
name: Download Integration Test results
id: download_int
with:
name: int-cov
path: integration.coverage
- name: Combine test results
run: |
coverage combine ${{steps.download_unit.outputs.download-path}}/*.coverage ${{steps.download_int.outputs.download-path}}/*.coverage
coverage report --show-missing --include "src/boinc_client/*" --omit src/boinc_client/clients/rpc_client.py --fail-under 100
Release:
runs-on: ubuntu-latest
needs:
- Validate
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.3.2
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: "poetry"
- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
branch: main
patchList: fix,bugfix,security
noVersionBumpBehavior: silent
token: ${{ secrets.GH_TOKEN }}
- name: Bump Poetry Version
run: poetry version ${{ steps.semver.outputs.nextStrict }}
- name: Commit Release to repo
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: |
Create ${{ steps.semver.outputs.next }} Release
[skip ci]
tagging_message: ${{ steps.semver.outputs.next }}
- name: Create Release
uses: ncipollo/release-action@v1
if: ${{ steps.semver.outputs.next != null }}
with:
name: ${{ steps.semver.outputs.next }}
body: Changelog Contents
tag: ${{ steps.semver.outputs.next }}
token: ${{ github.token }}
makeLatest: true
generateReleaseNotes: true
skipIfReleaseExists: true
- name: Build Library
if: ${{ steps.semver.outputs.next != null }}
run: poetry build
- name: Publish Library
if: ${{ steps.semver.outputs.next != null }}
run: poetry publish --username __token__ --password ${{ secrets.PYPI_TOKEN }}