-
-
Notifications
You must be signed in to change notification settings - Fork 35
77 lines (66 loc) · 2.13 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- '**'
tags-ignore:
- '**'
paths:
- '**.py'
- 'tests/**'
- 'poetry.lock'
- '.github/workflows/test.yml'
- '!**/version.py'
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 }}