62 lines (51 loc) · 1.46 KB
/
tests.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
name: tests
on:
push:
branches:
- master
- 'v*.x'
tags:
- '**'
pull_request:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.9', '3.10' ]
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install "poetry==1.1.14"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: poetry install -E "docs test coverage lint format"
- name: Lint with flake8
run: poetry run flake8
- name: Lint with mypy
run: poetry run mypy .
- name: Print python versions
run: |
python -V
poetry run python -V
- name: Test with pytest
run: poetry run py.test --cov=./ --cov-report=xml
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: poetry build
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true