automatic publish on release #1497
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- "*" | |
release: | |
types: | |
- published | |
schedule: | |
# Daily at 05:47 | |
- cron: '47 5 * * *' | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }} | |
cancel-in-progress: true | |
env: | |
PIP_NO_PYTHON_VERSION_WARNING: 1 | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
container: docker://python:3.11-buster | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build | |
run: | | |
python -m venv venv | |
venv/bin/pip install --upgrade pip | |
venv/bin/pip install build | |
python -m build --outdir/ dist | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: dist | |
path: dist/* | |
if-no-files-found: error | |
test: | |
name: ${{ matrix.os.name }} ${{ matrix.python.name }} ${{ matrix.reactor.name }} | |
runs-on: ${{ matrix.os.runs-on }} | |
container: ${{ matrix.os.container[matrix.python.docker] }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- name: 🐧 | |
runs-on: ubuntu-latest | |
python_platform: linux | |
container: | |
"2.7": docker://python:2.7-buster | |
"3.5": docker://python:3.5-buster | |
"3.6": docker://python:3.6-buster | |
"3.7": docker://python:3.7-buster | |
"3.8": docker://python:3.8-buster | |
"3.9": docker://python:3.9-buster | |
"3.10": docker://python:3.10-buster | |
"3.11": docker://python:3.11-buster | |
"pypy2.7": docker://pypy:2.7-buster | |
"pypy3.7": docker://pypy:3.7-buster | |
"pypy3.8": docker://pypy:3.8-buster | |
"pypy3.9": docker://pypy:3.9-buster | |
- name: 🪟 | |
runs-on: windows-latest | |
python_platform: win32 | |
- name: 🍎 | |
runs-on: macos-latest | |
python_platform: darwin | |
python: | |
- name: CPython 2.7 | |
tox: py27 | |
action: 2.7 | |
docker: 2.7 | |
implementation: cpython | |
major: 2 | |
- name: CPython 3.5 | |
tox: py35 | |
action: 3.5 | |
docker: 3.5 | |
implementation: cpython | |
major: 3 | |
- name: CPython 3.6 | |
tox: py36 | |
action: 3.6 | |
docker: 3.6 | |
implementation: cpython | |
major: 3 | |
- name: CPython 3.7 | |
tox: py37 | |
action: 3.7 | |
docker: 3.7 | |
implementation: cpython | |
major: 3 | |
- name: CPython 3.8 | |
tox: py38 | |
action: 3.8 | |
docker: 3.8 | |
implementation: cpython | |
major: 3 | |
- name: CPython 3.9 | |
tox: py39 | |
action: 3.9 | |
docker: 3.9 | |
implementation: cpython | |
major: 3 | |
- name: CPython 3.10 | |
tox: py310 | |
action: "3.10" | |
docker: "3.10" | |
implementation: cpython | |
major: 3 | |
- name: CPython 3.11 | |
tox: py311 | |
action: "3.11" | |
docker: "3.11" | |
implementation: cpython | |
major: 3 | |
# disabled due to installation failures | |
# https://github.com/pytest-dev/pytest-twisted/pull/157 | |
# - name: PyPy 2.7 | |
# tox: pypy27 | |
# action: pypy-2.7 | |
# docker: pypy2.7 | |
# implementation: pypy | |
# major: 2 | |
- name: PyPy 3.7 | |
tox: pypy37 | |
action: pypy-3.7 | |
docker: pypy3.7 | |
implementation: pypy | |
major: 3 | |
- name: PyPy 3.8 | |
tox: pypy38 | |
action: pypy-3.8 | |
docker: pypy3.8 | |
implementation: pypy | |
major: 3 | |
- name: PyPy 3.9 | |
tox: pypy39 | |
action: pypy-3.9 | |
docker: pypy3.9 | |
implementation: pypy | |
major: 3 | |
reactor: | |
- name: default | |
tox: default | |
dependencies: default | |
- name: PyQt5 | |
tox: pyqt5 | |
dependencies: qt5 | |
- name: PySide2 | |
tox: pyside2 | |
dependencies: qt5 | |
- name: asyncio | |
tox: asyncio | |
dependencies: asyncio | |
exclude: | |
- python: | |
major: 2 | |
os: | |
python_platform: darwin | |
- python: | |
major: 2 | |
os: | |
python_platform: win32 | |
- python: | |
major: 2 | |
reactor: | |
tox: pyqt5 | |
- python: | |
major: 2 | |
reactor: | |
tox: pyside2 | |
- python: | |
action: "3.11" | |
reactor: | |
tox: pyside2 | |
- python: | |
major: 2 | |
reactor: | |
tox: asyncio | |
- python: | |
implementation: pypy | |
reactor: | |
tox: pyqt5 | |
- python: | |
implementation: pypy | |
reactor: | |
tox: pyside2 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Enable Problem Matchers | |
run: | | |
echo "::add-matcher::.github/local-problem-matchers.json" | |
- name: Set up ${{ matrix.python.name }} | |
if: ${{ job.container == '' }} | |
uses: actions/setup-python@v2 | |
with: | |
# This allows the matrix to specify just the major.minor version while still | |
# expanding it to get the latest patch version including alpha releases. | |
# This avoids the need to update for each new alpha, beta, release candidate, | |
# and then finally an actual release version. actions/setup-python doesn't | |
# support this for PyPy presently so we get no help there. | |
# | |
# CPython -> 3.9.0-alpha - 3.9.X | |
# PyPy -> pypy-3.7 | |
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python.action), matrix.python.action))[startsWith(matrix.python.action, 'pypy')] }} | |
architecture: x64 | |
- name: Report Python information | |
shell: bash | |
run: | | |
python -c 'import sys; print(sys.version)' | |
echo | |
echo " <=======>" | |
echo | |
pip --version | |
echo | |
echo " <=======>" | |
echo | |
pip list | |
echo | |
echo " <=======>" | |
echo | |
pip freeze --all | |
- name: Install Linux Qt5 dependencies | |
if: matrix.os.python_platform == 'linux' && matrix.reactor.dependencies == 'qt5' | |
run: | | |
apt-get update --yes | |
apt-get install --yes libgl1 | |
- name: Install | |
run: | | |
pip install tox | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- name: Test | |
run: | | |
tox --installpkg dist/*.whl -v -e "${{ matrix.python.tox }}-${{ matrix.reactor.tox }}reactor" | |
linting: | |
name: Linting | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: | |
- short: 39 | |
dotted: 3.9 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python.dotted }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python.dotted }} | |
architecture: x64 | |
- name: Install | |
run: | | |
pip install tox | |
- name: Test | |
run: | | |
tox -v -e linting | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- test | |
- linting | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist/ | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
if: github.event_name == 'release' | |
with: | |
packages-dir: dist/ | |
skip-existing: true | |
all: | |
name: All | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- test | |
- linting | |
- publish | |
steps: | |
- name: This | |
shell: python | |
run: | | |
import this |