Skip to content

Commit 64e368b

Browse files
committed
chore: Add and update GitHub workflows for code quality, documentation, and testing
Added new workflows for code quality check, documentation build and deployment, and removed redundant workflows for import test, publish docs, python package, test docs, and tests. Signed-off-by: longhao <[email protected]>
1 parent 8aa9c3c commit 64e368b

File tree

8 files changed

+114
-173
lines changed

8 files changed

+114
-173
lines changed

.github/workflows/code-check.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Code Quality Check
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
with:
11+
fetch-depth: 0
12+
13+
- name: Set up Python
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: '3.9'
17+
cache: 'pip'
18+
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements-dev.txt
23+
24+
- name: Run linting checks
25+
run: |
26+
nox -s pre-commit ruff mypy
27+
28+
test:
29+
runs-on: windows-latest
30+
strategy:
31+
matrix:
32+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
33+
steps:
34+
- uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Set up Python ${{ matrix.python-version }}
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
cache: 'pip'
43+
44+
- name: Install dependencies
45+
run: |
46+
python -m pip install --upgrade pip
47+
pip install -r requirements-dev.txt
48+
49+
- name: Run tests
50+
run: |
51+
nox -s tests

.github/workflows/docs.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'docs/**'
8+
- 'mkdocs.yml'
9+
- '.github/workflows/docs.yml'
10+
- 'pyproject.toml'
11+
- 'requirements*.txt'
12+
- 'noxfile.py'
13+
pull_request:
14+
branches: [ main ]
15+
paths:
16+
- 'docs/**'
17+
- 'mkdocs.yml'
18+
- '.github/workflows/docs.yml'
19+
- 'pyproject.toml'
20+
- 'requirements*.txt'
21+
- 'noxfile.py'
22+
23+
jobs:
24+
docs:
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: write
28+
steps:
29+
- uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: '3.9'
37+
cache: 'pip'
38+
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install -r requirements-dev.txt
43+
44+
- name: Configure Git
45+
if: github.event_name == 'push'
46+
run: |
47+
git config --global user.name "github-actions[bot]"
48+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
49+
50+
- name: Build documentation
51+
if: github.event_name == 'pull_request'
52+
run: |
53+
nox -s docs -- build
54+
55+
- name: Deploy documentation
56+
if: github.event_name == 'push'
57+
run: |
58+
nox -s docs -- deploy

.github/workflows/import-test.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/publish_docs.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/python-publish.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
contents: write
1515

1616
steps:
17-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
17+
- uses: actions/checkout@v4
1818
with:
1919
token: "${{ secrets.GITHUB_TOKEN }}"
2020
fetch-depth: 0
@@ -28,17 +28,17 @@ jobs:
2828
- name: Set up Python
2929
uses: actions/setup-python@v5
3030
with:
31-
python-version: '3.x'
31+
python-version: '3.9'
3232
cache: 'pip'
3333

3434
- name: Install dependencies
3535
run: |
3636
python -m pip install --upgrade pip
37-
pip install nox build
37+
pip install -r requirements-dev.txt
3838
3939
- name: Build package
4040
run: |
41-
python -m build
41+
nox -s build
4242
4343
- name: Upload to PyPI
4444
uses: pypa/gh-action-pypi-publish@release/v1
@@ -73,6 +73,7 @@ jobs:
7373
{{ci}}
7474
## Other
7575
{{other}}
76+
7677
- uses: ncipollo/release-action@v1
7778
with:
7879
artifacts: "dist/*.whl"

.github/workflows/pythonpackage.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/test_docs.yaml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)