Skip to content

ci(github): update test workflow #81

ci(github): update test workflow

ci(github): update test workflow #81

Workflow file for this run

name: tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- '**'
tags-ignore:
- '*.*'
paths-ignore:
- "*.md"
- ".pre-commit-config.yaml"
- "pyproject.toml"
- "**/version.py"
- "Dockerfile"
- ".github/workflows/*.yml"
- "!.github/workflows/test.yml"
env:
BUILD_POETRY_VERSION: 1.6.1
PACKAGE_NAME: enex2notion
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Load cached Poetry installation
if: matrix.os != 'windows-latest'
uses: actions/cache@v3
with:
path: ~/.local
key: dotlocal-${{ matrix.os }}-${{ matrix.python-version }}-${{ env.BUILD_POETRY_VERSION }}
- name: Set up Poetry ${{ env.BUILD_POETRY_VERSION }}
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.BUILD_POETRY_VERSION }}
- name: Config Poetry
shell: bash
run: |
poetry config installer.parallel false
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
shell: bash
run: poetry install --with test --no-interaction --no-root
- name: Run tests
shell: bash
run: poetry run pytest --cov-report=xml --cov=${{ env.PACKAGE_NAME }} tests/
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
with:
token: ${{ secrets.CODECOV_TOKEN }}