1+ name : lint and test
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+
9+ jobs :
10+ test-code :
11+ name : Lint and test
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v3
15+ - name : set up python
16+ uses : actions/setup-python@v4
17+ with :
18+ python-version : " 3.10"
19+ token : ${{github.token}}
20+ - name : install uv
21+ run : |
22+ curl -LsSf https://astral.sh/uv/install.sh | sh
23+ - name : install venv
24+ run : |
25+ source $HOME/.cargo/env
26+ uv venv .venv -p 3.10
27+ - name : install requirements
28+ run : |
29+ source $HOME/.cargo/env
30+ source .venv/bin/activate
31+ uv pip install -e '.[all]'
32+ - name : run black
33+ run : |
34+ source .venv/bin/activate
35+ python -m black --config pyproject.toml --check --diff .
36+ - name : get all Python files
37+ id : list_files
38+ run : |
39+ echo "files=$(git ls-files '*.py' '*.pyi' | xargs)" >> $GITHUB_OUTPUT
40+ - name : run Pylint on files
41+ run : |
42+ source .venv/bin/activate
43+ files="${{ steps.list_files.outputs.files }}"
44+ if [ -n "$files" ]; then
45+ pylint --rcfile=.pylintrc $files
46+ else
47+ echo "No Python files found."
48+ fi
49+ - name : Analyse code with pyright
50+ run : |
51+ source .venv/bin/activate
52+ python -m pyright $(git ls-files '*.py' '*.pyi')
53+ - name : install node
54+ uses : actions/setup-node@v3
55+ with :
56+ node-version : 16.x
57+ - name : install packages
58+ uses : borales/actions-yarn@v4
59+ with :
60+ cmd : install # will run `yarn install` command
61+ env :
62+ # A warning is thrown here unnecessarily. tracking issue here:
63+ # https://github.com/github/vscode-github-actions/issues/222
64+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }} # if needed
65+ - name : install foundry
66+ uses : foundry-rs/foundry-toolchain@v1
67+ with :
68+ version : nightly
69+ - name : run pytest with coverage
70+ run : |
71+ source .venv/bin/activate
72+ IN_CI=true coverage run -m pytest
73+ - name : generate coverage report
74+ run : |
75+ source .venv/bin/activate
76+ coverage xml -i
77+ coverage html -i
78+ - name : upload coverage report to Codecov
79+ uses : codecov/codecov-action@v3
80+ with :
81+ flags : unittests
82+ fail_ci_if_error : true
83+ # A warning is thrown here unnecessarily. tracking issue here:
84+ # https://github.com/github/vscode-github-actions/issues/222
85+ token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments