-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (57 loc) · 2.29 KB
/
python-package.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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# Some changes have been made: different OS
# Copied from kuleuven/mango-mdschema
name: Python package
run-name: Build triggered via ${{ github.event_name }} by ${{ github.actor }}
on:
# push won't trigger this because you cannot push without PR anyways
pull_request:
branches: ["main"]
jobs:
test:
strategy:
fail-fast: false
matrix:
# test in multiple python versions and OS
# results in 12 (4x3) jobs
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov
pip install -r requirements.txt
- name: Test with pytest
run: |
pytest tests --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}-${{ matrix.os }}.xml --cov --cov-report=xml --cov-report=html
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}-${{ matrix.os }}
path: junit/test-results-${{ matrix.python-version }}-${{ matrix.os }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
lint:
# only run one linting job on ubuntu and the latest Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pylint
pip install -r requirements.txt
- name: Lint with pylint
run: |
# fail only if there are errors
pylint src/mango_mdconverter tests --fail-under=6