-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (129 loc) · 4.75 KB
/
Copy pathpython-app.yml
File metadata and controls
137 lines (129 loc) · 4.75 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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Build
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
permissions:
contents: write
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python 3.12
run: uv python install 3.12
- name: Install dependencies
run: uv sync --group lint
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
uv run flake8 . --exclude=.venv --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
uv run flake8 . --exclude=.venv --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python 3.12
run: uv python install 3.12
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pandoc
uv sync --group test
- name: Run fast tests
run: |
uv run pytest -m "not slow and not experimental and not extraslow" -n auto --junitxml=reports/junit/junit-fast.xml --cov=gensbi --cov-report=term-missing
- name: Run slow tests
run: |
uv run pytest -m "slow" -n auto --junitxml=reports/junit/junit-slow.xml --cov=gensbi --cov-append --cov-report=term-missing
- name: Run experimental tests
run: |
uv run pytest -m "experimental" -n auto --junitxml=reports/junit/junit-experimental.xml --cov=gensbi --cov-append --cov-report=xml:reports/coverage/coverage.xml --cov-report=term-missing
- name: Merge Test Reports
run: |
uv run python -m junitparser merge reports/junit/junit-fast.xml reports/junit/junit-slow.xml reports/junit/junit-experimental.xml reports/junit/junit.xml
- name: Generate Badges
run: |
uv run genbadge coverage --input-file reports/coverage/coverage.xml --output-file reports/badges/coverage.svg
uv run genbadge tests --input-file reports/junit/junit.xml --output-file reports/badges/tests.svg
- name: Upload Test Reports
uses: actions/upload-artifact@v4
with:
name: test-reports
path: reports/
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python 3.12
run: uv python install 3.12
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pandoc
uv sync --group docs
- name: Build documentation
run: |
cd docs
uv run make html
- name: Upload Documentation
uses: actions/upload-artifact@v4
with:
name: docs-html
path: docs/_build/html
publish-badges:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Download Test Reports
uses: actions/download-artifact@v4
with:
name: test-reports
path: reports
- name: Prepare Badges
run: |
mkdir -p img/badges
cp -r reports/badges/*.svg img/badges/
- name: Generate token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ vars.ICON_DEPLOY_APP_ID }}
private-key: ${{ secrets.ICON_DEPLOY_PRIVATE_KEY }}
- name: Commit and push badges
uses: stefanzweifel/git-auto-commit-action@v6
with:
commit_message: "Update badges [skip ci]"
branch: main
file_pattern: img/badges/*.svg
token: ${{ steps.app-token.outputs.token }}
deploy-docs:
needs: docs
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Download Documentation
uses: actions/download-artifact@v4
with:
name: docs-html
path: docs/_build/html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
publish_branch: gh-pages
cname: gensbi.com