Skip to content

CI refactoring

CI refactoring #237

Workflow file for this run

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.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11']
os: [ubuntu-latest, windows-latest, macos-latest]
tox_env: ["py,codecov"]
include:
# The version '3.5' with architecture 'x64' was not found for Ubuntu 22.04
- python: '3.5'
os: ubuntu-20.04
tox_env: "py,codecov"
# The version '3.6' with architecture 'x64' was not found for Ubuntu 22.04.
- python: '3.6'
os: ubuntu-20.04
tox_env: "py,codecov"
# Run additional tox-env only for one environment
- python: '3.10'
os: ubuntu-latest
tox_env: 'check,docs,build'
exclude:
# The version '3.5' with architecture 'x64' was not found for Ubuntu 22.04
- python: '3.5'
os: ubuntu-latest
# The version '3.6' with architecture 'x64' was not found for Ubuntu 22.04.
- python: '3.6'
os: ubuntu-latest
# No Python3.5.* found
- python: '3.5'
os: windows-latest
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/*