-
Notifications
You must be signed in to change notification settings - Fork 11
79 lines (68 loc) · 2.32 KB
/
tests.yml
File metadata and controls
79 lines (68 loc) · 2.32 KB
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
78
79
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: |
curl -O -sSL https://install.python-poetry.org/install-poetry.py
python install-poetry.py -y --version 1.1.12
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV
rm install-poetry.py
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: |
# This is required to do as of @actions/checkout@v3 to prevent default python from being used
poetry env use ${{ matrix.python-version }}
poetry install -E "docs test coverage lint format"
- name: Lint with flake8
run: poetry run flake8
- name: Lint with mypy
uses: tsuyoshicho/action-mypy@v3
with:
github_token: ${{ secrets.github_token }}
# Change reviewdog reporter if you need [github-pr-check,github-check,github-pr-review].
reporter: github-pr-review
# Change reporter level if you need.
# GitHub Status Check won't become failure with warning.
# level: warning
# Change the current directory to run mypy command.
# mypy command reads setup.cfg or other settings file in this path.
# workdir: .
- 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