-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (96 loc) · 3.26 KB
/
Copy pathci.yml
File metadata and controls
102 lines (96 loc) · 3.26 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
# 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: ci
on:
push:
branches: [ "main", "dev" ]
paths-ignore:
- "*.md"
pull_request:
branches: [ "main" ]
paths-ignore:
- "*.md"
permissions:
contents: read
concurrency:
group: ${{ github.event.number || github.run_id }}
cancel-in-progress: true
jobs:
test:
if: ${{ !(github.event_name == 'pull_request' && github.head_ref == 'dev') }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", 3.11, 3.12, 3.13, 3.14]
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pdm.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/checkout@v6
- name: Setup Python
id: setup-python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: astral-sh/setup-uv@v7
- uses: astral-sh/ruff-action@v3
- name: Setup PDM by uv
run: |
uv tool install pdm --with pdm-plugin-i
pdm config check_update false
- name: Setup poetry by uv
run: |
uv tool install poetry --with poetry-plugin-version --with poetry-dynamic-versioning
poetry config virtualenvs.create false
- name: Setup ty by uv
run: |
uv tool install ty
- name: Setup just by uv
run: |
uv tool install rust-just
- name: Setup bumpvesion by uv
run: |
uv tool install bumpversion2
- name: Prepare tools
run: |
git config --global user.email "waketzheng@gmail.com"
git config --global user.name "Waket Zheng"
python -m pip install --upgrade pip pipx
python -m pipx install -e .
python -m pipx ensurepath
python -c 'from pathlib import Path;p=Path.home()/".local/bin";p.exists() or p.mkdir(parents=True)'
which pipx
which fast
ln -s `which fast` $HOME/.local/bin/fast
- name: Install requirements/Check code style and Type Hint
run: |
just check
- name: Test with pytest
run: |
pdm run coverage run -m pytest
pdm run python -c "import os;from pathlib import Path;pp=list(Path().glob('.coverage.*'));pp and os.system('pdm run coverage combine .coverage*')"
- name: Upload Coverage
run: uvx coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true
coveralls:
if: ${{ !(github.event_name == 'pull_request' && github.head_ref == 'dev') }}
name: Finish Coveralls
needs: test
runs-on: ubuntu-latest
steps:
- uses: astral-sh/setup-uv@v7
- name: Finished
run: uvx coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}