File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ pull_request :
5+ branches : [main]
6+ push :
7+ branches : [main]
8+
9+ permissions :
10+ contents : read
11+
12+ jobs :
13+ test :
14+ name : Test
15+ runs-on : ubuntu-latest
16+ timeout-minutes : 20
17+ steps :
18+ - uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
21+
22+ - uses : actions/setup-python@v5
23+ with :
24+ python-version : " 3.12"
25+ cache : pip
26+
27+ - name : Install dependencies
28+ run : |
29+ pip install -r requirements.txt
30+ pip install pytest pytest-asyncio pytest-cov ruff
31+ pip install -e . --no-deps
32+
33+ - name : Run tests
34+ run : pytest -p no:cacheprovider -o addopts="" tests/ -q
35+
36+ lint :
37+ name : Lint
38+ runs-on : ubuntu-latest
39+ timeout-minutes : 10
40+ steps :
41+ - uses : actions/checkout@v4
42+ with :
43+ fetch-depth : 0
44+
45+ - uses : actions/setup-python@v5
46+ with :
47+ python-version : " 3.12"
48+
49+ - name : Install ruff
50+ run : pip install ruff
51+
52+ - name : Collect changed Python files
53+ env :
54+ PR_BASE_SHA : ${{ github.event.pull_request.base.sha }}
55+ PR_HEAD_SHA : ${{ github.event.pull_request.head.sha }}
56+ PUSH_BASE_SHA : ${{ github.event.before }}
57+ run : |
58+ if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
59+ diff_range="${PR_BASE_SHA}...${PR_HEAD_SHA}"
60+ else
61+ diff_range="${PUSH_BASE_SHA}..${GITHUB_SHA}"
62+ fi
63+
64+ git diff --name-only --diff-filter=ACMR -z "$diff_range" -- '*.py' \
65+ > "$RUNNER_TEMP/changed-python-files"
66+
67+ - name : Ruff check changed files
68+ run : |
69+ xargs -0 -r ruff check --output-format=github \
70+ < "$RUNNER_TEMP/changed-python-files"
71+
72+ - name : Ruff format check changed files
73+ run : |
74+ xargs -0 -r ruff format --check \
75+ < "$RUNNER_TEMP/changed-python-files"
You can’t perform that action at this time.
0 commit comments