-
Notifications
You must be signed in to change notification settings - Fork 15
67 lines (66 loc) · 1.87 KB
/
github-actions.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
name: build
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest, macos-latest]
tox_env: ["py,codecov"]
include:
- python: '3.10'
os: ubuntu-latest
tox_env: 'check'
- python: '3.10'
os: ubuntu-latest
tox_env: 'docs'
- python: '3.10'
os: ubuntu-latest
tox_env: 'build'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: x64
cache: 'pip'
- name: Cache pre-commit packages
id: cache-pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-py${{ matrix.python }}-pre-commit
- name: install dependencies
run: |
pip install --upgrade pip
python -mpip install --progress-bar=off -r requirements-dev.txt
virtualenv --version
pip --version
tox --version
pip list --format=freeze
- name: test
run: |
mkdir -p ~/.ssh
tox -e ${{ matrix.tox_env }} -v
# TODO: Publish package only for signed tags
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && contains(matrix.tox_env, 'build')
run: |
ls -lah dist/*
python -m twine upload --verbose -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --repository-url https://upload.pypi.org/legacy/ dist/*