refactor: modernisation of proselint #798
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: Lint & Test" | |
on: [push, pull_request] | |
jobs: | |
lint: | |
name: Lint | |
if: "!(contains(github.event.head_commit.message, '[skip_ci]'))" | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
python: ["3.10"] | |
steps: | |
- name: "[INIT] Checkout repository" | |
uses: actions/checkout@v4 | |
- name: "[INIT] Install Python ${{ matrix.python }}" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: "[INIT] Install PDM" | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
update-python: false | |
- name: "[INIT] Restore dependency cache" | |
id: cache-restore | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/pdm | |
.venv | |
key: dev-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('**/pdm.lock') }} | |
- name: "[INIT] Install dependencies" | |
if: ${{ !steps.cache-restore.outputs.cache-hit }} | |
run: pdm install -d --with dev | |
- name: "[EXEC] Lint" | |
uses: chartboost/ruff-action@v1 | |
with: | |
src: "proselint tests" | |
changed-files: "true" | |
- name: Run Pre-Commit Tests 🧪 | |
uses: pre-commit/[email protected] | |
test-cover: | |
name: Test & Cover | |
if: "!(contains(github.event.head_commit.message, '[skip_ci]'))" | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
# 5 versions / years of coverage | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.9", "pypy3.10"] | |
os: [ubuntu-latest, macos-13, windows-latest] | |
steps: | |
- name: "[INIT] Checkout repository" | |
uses: actions/checkout@v4 | |
- name: "[INIT] Install Python ${{ matrix.python }}" | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: "[INIT] Install PDM" | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
update-python: false | |
- name: "[INIT] Restore dependency cache" | |
id: cache-restore | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.cache/pdm | |
.venv | |
key: ${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('**/pdm.lock') }} | |
- name: "[INIT] Install dependencies" | |
if: ${{ !steps.cache-restore.outputs.cache-hit }} | |
run: pdm install -d --with test | |
- name: "[EXEC] Test build package" | |
run: pdm build | |
- name: "[EXEC] Unit test" | |
run: pdm run pytest --cov=proselint --cov-report=lcov | |
- name: "[EXEC] Upload coverage to Codecov" | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
env_vars: OS,PYTHON |