add lint step #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: | |
pull_request: | |
branches: | |
- dev | |
- master | |
push: | |
branches: | |
- dev | |
- master | |
jobs: | |
pre-commit: | |
name: Prepare pre-commit base | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/[email protected] | |
- name: Set up Python 3.x | |
id: python | |
uses: actions/[email protected] | |
with: | |
python-version: 3.x | |
check-latest: true | |
- name: Create Python virtual environment | |
run: | | |
python -m venv venv | |
. venv/bin/activate | |
python --version | |
pip install "$(grep '^uv' < requirements_test.txt)" | |
uv pip install "$(cat requirements_test.txt | grep pre-commit)" | |
- name: Install pre-commit dependencies | |
run: | | |
. venv/bin/activate | |
pre-commit install-hooks | |
lint-ruff-format: | |
name: Check ruff-format | |
runs-on: ubuntu-22.04 | |
needs: | |
- pre-commit | |
steps: | |
- name: Check out code from GitHub | |
uses: actions/[email protected] | |
- name: Set up Python 3.x | |
uses: actions/[email protected] | |
id: python | |
with: | |
python-version: 3.x | |
check-latest: true | |
- name: Run ruff-format | |
run: | | |
. venv/bin/activate | |
pre-commit run --hook-stage manual ruff-format --all-files --show-diff-on-failure | |
env: | |
RUFF_OUTPUT_FORMAT: github | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
needs: | |
- lint-ruff-format | |
strategy: | |
matrix: | |
python-version: | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- run: | | |
python -m venv venv | |
venv/bin/pip install -r requirements_test.txt | |
venv/bin/py.test tests/ | |
coverage: | |
name: Test Coverage | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
architecture: x64 | |
- run: | | |
python -m venv venv | |
venv/bin/pip install -r requirements_test.txt | |
venv/bin/py.test \ | |
-s \ | |
--verbose \ | |
--cov-report term-missing \ | |
--cov-report xml \ | |
--cov=pyseventeentrack tests | |
- uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |