-
Notifications
You must be signed in to change notification settings - Fork 49
65 lines (65 loc) · 2.28 KB
/
Copy pathpython.yaml
File metadata and controls
65 lines (65 loc) · 2.28 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
---
name: Python Checks for Pull Requests
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
merge_group:
types: [checks_requested]
jobs:
python:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Install OS packages
# libkrb5-dev is required for gssapi dependency installation (krb5-config command)
run: |
sudo apt-get -y update
sudo apt-get install -y libkrb5-dev
curl -L https://github.com/mikefarah/yq/releases/download/v4.34.1/yq_linux_amd64 \
-o /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq
- name: Check out repo
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 0
- name: Black Lint
uses: psf/black@ce1897a8f20d0f64844dd666d07f4003500d0e09 # stable
- name: Setup python environment for flake8 check
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.12" # Same as in Dockerfile
- name: flake8 Lint
uses: py-actions/flake8@84ec6726560b6d5bd68f2a5bed83d62b52bb50ba # v2
- name: Run pytest with coverage
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
uv sync --dev
uv run pytest --cov=. --cov-report=xml:coverage.xml
- name: Get changed Python files
id: changed-files
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
with:
files: |
**/*.py
- name: docstring test
if: steps.changed-files.outputs.any_changed == 'true'
run: |
pip install ruff
echo "Running ruff on changed Python files:"
echo "${{ steps.changed-files.outputs.all_changed_files }}"
ruff check --select D ${{ steps.changed-files.outputs.all_changed_files }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit-tests
files: coverage.xml
fail_ci_if_error: false