Update dependencies and tooling #409
Workflow file for this run
This file contains hidden or 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: Tests | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
jobs: | |
linting: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: 3.12 | |
- name: Restore pre-commit cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit|${{ runner.os }}|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Run pre-commit | |
uses: pre-commit/action@v3.0.1 | |
test: | |
name: ${{ matrix.os }} / ${{ matrix.python }} | |
needs: linting | |
runs-on: ${{ matrix.os }}-latest | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [Ubuntu, macOS, Windows] | |
python: [3.9, 3.10, 3.11, 3.12] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: poetry | |
- name: Install dependencies | |
run: | | |
pipx install poetry | |
poetry install | |
env: | |
POETRY_VIRTUALENVS_CREATE: 1 | |
POETRY_VIRTUALENVS_IN_PROJECT: 1 | |
- name: Run tests | |
run: poetry run pytest tests --cov jekyllnb --cov-report xml:coverage.xml | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v4 | |
if: success() | |
with: | |
file: coverage.xml | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Send Slack message on failure | |
uses: lazy-actions/slatify@v3.0.0 | |
if: failure() | |
with: | |
type: ${{ job.status }} | |
job_name: '${{ runner.os }} :snake: ${{ matrix.python }} Tests' | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
commit: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
slack: | |
name: Slack | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Send Slack message | |
uses: lazy-actions/slatify@v3.0.0 | |
if: always() | |
with: | |
type: ${{ job.status }} | |
job_name: ':snake: Tests' | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
commit: true | |
token: ${{ secrets.GITHUB_TOKEN }} |