[pre-commit.ci] pre-commit autoupdate #364
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/checkout@v2.3.3 | |
- name: Set up Python | |
uses: actions/setup-python@v2.2.2 | |
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/cache@v2.1.6 | |
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/codecov-action@v2.1.0 | |
if: success() | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
- 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 }} |