-
Notifications
You must be signed in to change notification settings - Fork 3
66 lines (57 loc) · 1.59 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
name: Test
on:
pull_request:
branches:
- main
jobs:
test:
name: Test
strategy:
matrix:
python: ["3.8", "3.9", "3.12"]
os: [ubuntu-latest, macOS-latest]
runs-on: ${{ matrix.os }}
steps:
# Check-out repo
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
# Install poetry
- name: Install poetry
run: pipx install poetry==1.8.2
# Set-up python with cache
- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: "poetry"
# Install requirements
- name: Install requirements
run: poetry install
# Run linters
- name: Run linters
run: |
set -o pipefail
poetry run pre-commit run --all-files
# Run unit tests
- name: Run tests
run: |
set -o pipefail
poetry run pytest -- --cov-report xml
# Add pytest coverage report to PR
- name: Pytest coverage comment
if: ${{ success() && github.event_name == 'pull_request' }}
id: coverageComment
uses: MishaKav/pytest-coverage-comment@main
with:
title: Coverage Report
pytest-xml-coverage-path: coverage.xml
# Build package
- name: Build package
run: poetry build
# Build docker image
- name: Build docker image
# Docker is not present on the macOS runner
if: matrix.os == 'ubuntu-latest'
run: docker build .