[pre-commit.ci] pre-commit autoupdate #377
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: Tests | |
on: | |
push: | |
branches: | |
- '*' | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
jobs: | |
test: | |
name: '${{ matrix.os_name }}: Python ${{ matrix.python }}' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python: [3.6, 3.7, 3.8, 3.9] | |
include: | |
- os: ubuntu-latest | |
os_name: Linux | |
poetry_cache: ~/.cache/pypoetry | |
- os: macos-latest | |
os_name: macOS | |
poetry_cache: ~/Library/Caches/pypoetry | |
- os: windows-latest | |
os_name: Windows | |
poetry_cache: ~\AppData\Local\pypoetry\Cache | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install Poetry | |
uses: Gr1N/setup-poetry@v7 | |
- name: Write environment information to a file | |
run: | | |
pwd > environment | |
python --version >> environment | |
- name: Restore cache | |
uses: actions/[email protected] | |
if: runner.os != 'Windows' | |
with: | |
path: ${{ matrix.poetry_cache }} | |
key: poetry|${{ hashFiles('environment') }}|${{ hashFiles('poetry.lock') }} | |
- name: Install dependencies | |
run: poetry install | |
- name: Run tests | |
run: poetry run pytest tests/ --cov=jekyllnb | |
- name: Generate coverage report | |
run: poetry run coverage xml | |
- name: Upload coverage report | |
uses: codecov/[email protected] | |
if: success() | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
- name: Send Slack message on failure | |
uses: lazy-actions/[email protected] | |
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/[email protected] | |
if: always() | |
with: | |
type: ${{ job.status }} | |
job_name: ':snake: Tests' | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
commit: true | |
token: ${{ secrets.GITHUB_TOKEN }} |