-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (122 loc) · 4.13 KB
/
OnRelease.yml
File metadata and controls
148 lines (122 loc) · 4.13 KB
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
146
147
148
name: On Release Workflow
on:
release:
types: [published]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest coverage
pip install tomlkit>=0.13.2 jsonschema>=4.25.1 requests>=2.32.5 PyYAML>=6.0.3
- name: Install make
run: sudo apt-get install make
- name: Run tests
run: make tests -k
- name: Upload test reports
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.python-version }}
path: tests_reports/
- name: publish test report
if: success() || failure()
uses: mikepenz/action-junit-report@v5
with:
report_paths: tests_reports/**/report.xml
include_passed: true
check_name: Pytest Test Report (${{ matrix.python-version }})
- name: Setup .NET Core # Required to execute ReportGenerator
if: success() || failure()
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
dotnet-quality: 'ga'
- name: Merge coverage reports
if: (success() || failure()) && ${{ matrix.python-version }} == '3.10'
uses: danielpalme/ReportGenerator-GitHub-Action@v5
with:
reports: tests_reports/**/coverage.xml
targetdir: coverage-report
reporttypes: "cobertura"
- name: coverage report
if: s(success() || failure()) && ${{ matrix.python-version }} == '3.10'
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage-report/Cobertura.xml
fail_below_min: true
thresholds: "90 100"
format: markdown
output: both
hide_complexity: true
- name: Rename coverage report
if: (success() || failure()) && ${{ matrix.python-version }} == '3.10'
run: mv code-coverage-results.md coverage-report/coverage.${{ matrix.python-version }}.md
- name: upload code coverage report
if: (success() || failure()) && ${{ matrix.python-version }} == '3.10'
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ matrix.python-version }}
path: coverage-report/coverage.${{ matrix.python-version }}.md
update_release:
runs-on: ubuntu-latest
needs: test
steps:
- name: download code coverage reports
uses: actions/download-artifact@v4
with:
name: code-coverage-report-3.10
path: coverage-reports
- name: add coverage to release description
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const coverage = fs.readFileSync('coverage-reports/coverage.3.10.md', 'utf8');
const releaseBody = `## Test coverage\n${coverage}\n\n${context.payload.release.body}`;
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: context.payload.release.id,
body: releaseBody
});
build:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: make VERSION=${{ github.event.release.tag_name }}
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: package-artifacts-${{ github.event.release.tag_name }}
path: |
dist/*.tar.gz
dist/*.whl
- name: Publish release assets
uses: AButler/upload-release-assets@v3.0
with:
files: "dist/*"
repo-token: ${{ secrets.GITHUB_TOKEN }}