-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (106 loc) · 3.61 KB
/
ci.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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
#
name: CI
env:
PRIMARY_PYTHON_VERSION: '3.12'
PRIMARY_PLATFORM: 'ubuntu-latest'
PYTEST_CMD: >-
python -m pytest
--junitxml=pytest.xml
--cov-report=term-missing:skip-covered
--cov=src
--verbose
tests/
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
permissions:
pull-requests: write
contents: write
jobs:
# Test compatibility with the matrix of Python versions and platforms
matrix-build:
strategy:
matrix:
python-version: ["3.10", 3.11, 3.12]
platform: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv environment
uses: andgineer/uv-venv@v1
- name: Install dependencies
run: uv pip install -r requirements.dev.txt
- name: Test with pytest
run: ${{ env.PYTEST_CMD }}
# Build with publishing Allure report, coverage report
primary-build:
runs-on: ubuntu-latest
concurrency:
group: github-pages
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PRIMARY_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PRIMARY_PYTHON_VERSION }}
- name: Install uv environment
uses: andgineer/uv-venv@v1
- name: Install dependencies
run: uv pip install -r requirements.dev.txt
- name: Test with pytest and Allure report
run: "${{ env.PYTEST_CMD }} --alluredir=./allure-results"
- name: Load Allure test report history
uses: actions/checkout@v4
if: always()
continue-on-error: true
with:
ref: gh-pages
path: gh-pages-dir
- name: Generate Allure test report
uses: andgineer/allure-report@v3.3
id: allure-report
if: always()
with:
allure-results: allure-results
website: gh-pages-dir
reports-site-path: builds/tests
- name: Publish Allure test report
uses: peaceiris/actions-gh-pages@v3
if: ${{ always() && (steps.allure-report.outcome == 'success') }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ${{ steps.allure-report.outputs.reports-site }}
destination_dir: ${{ steps.allure-report.outputs.reports-site-path }}
- name: Coverage comment
id: coverage_comment
if: always()
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}
MINIMUM_GREEN: 85
MINIMUM_ORANGE: 70
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v3
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
name: python-coverage-comment-action
path: python-coverage-comment-action.txt
- name: Upload coverage data to coveralls.io
if: always()
uses: coverallsapp/github-action@v2
- name: Upload Coverage to Codecov
if: always()
run: |
curl -Os https://cli.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov --verbose upload-process --fail-on-error -t ${{ secrets.CODECOV_TOKEN }} -n 'service'-${{ github.run_id }} -F service -f coverage-service.xml