Add CI testing using GitHub Actions

This commit is contained in:
Tal Einat 2024-06-25 09:53:07 +03:00
parent f17772e77d
commit f90805ec5b
No known key found for this signature in database
GPG Key ID: 613A98AF4C800CDA
2 changed files with 172 additions and 9 deletions

160
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,160 @@
name: build
on: [push, pull_request, workflow_dispatch]
jobs:
test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- name: 'py38 (Ubuntu)'
python: '3.8'
toxpython: 'python3.8'
python_arch: 'x64'
tox_env: 'py38-with_coverage'
os: 'ubuntu-latest'
- name: 'py38 (Windows)'
python: '3.8'
toxpython: 'python3.8'
python_arch: 'x64'
tox_env: 'py38-with_coverage'
os: 'windows-latest'
- name: 'py38 (macOS)'
python: '3.8'
toxpython: 'python3.8'
python_arch: 'arm64'
tox_env: 'py38-with_coverage'
os: 'macos-latest'
- name: 'py39 (Ubuntu)'
python: '3.9'
toxpython: 'python3.9'
python_arch: 'x64'
tox_env: 'py39-with_coverage'
os: 'ubuntu-latest'
- name: 'py39 (Windows)'
python: '3.9'
toxpython: 'python3.9'
python_arch: 'x64'
tox_env: 'py39-with_coverage'
os: 'windows-latest'
- name: 'py39 (macOS)'
python: '3.9'
toxpython: 'python3.9'
python_arch: 'arm64'
tox_env: 'py39-with_coverage'
os: 'macos-latest'
- name: 'py310 (Ubuntu)'
python: '3.10'
toxpython: 'python3.10'
python_arch: 'x64'
tox_env: 'py310-with_coverage'
os: 'ubuntu-latest'
- name: 'py310 (Windows)'
python: '3.10'
toxpython: 'python3.10'
python_arch: 'x64'
tox_env: 'py310-with_coverage'
os: 'windows-latest'
- name: 'py310 (macOS)'
python: '3.10'
toxpython: 'python3.10'
python_arch: 'arm64'
tox_env: 'py310-with_coverage'
os: 'macos-latest'
- name: 'py311 (Ubuntu)'
python: '3.11'
toxpython: 'python3.11'
python_arch: 'x64'
tox_env: 'py311-with_coverage'
os: 'ubuntu-latest'
- name: 'py311 (Windows)'
python: '3.11'
toxpython: 'python3.11'
python_arch: 'x64'
tox_env: 'py311-with_coverage'
os: 'windows-latest'
- name: 'py311 (macOS)'
python: '3.11'
toxpython: 'python3.11'
python_arch: 'arm64'
tox_env: 'py311-with_coverage'
os: 'macos-latest'
- name: 'py312 (Ubuntu)'
python: '3.12'
toxpython: 'python3.12'
python_arch: 'x64'
tox_env: 'py312-with_coverage'
os: 'ubuntu-latest'
- name: 'py312 (Windows)'
python: '3.12'
toxpython: 'python3.12'
python_arch: 'x64'
tox_env: 'py312-with_coverage'
os: 'windows-latest'
- name: 'py312 (macOS)'
python: '3.12'
toxpython: 'python3.12'
python_arch: 'arm64'
tox_env: 'py312-with_coverage'
os: 'macos-latest'
- name: 'pypy39 (Ubuntu)'
python: 'pypy-3.9'
toxpython: 'pypy3.9'
python_arch: 'x64'
tox_env: 'pypy39-with_coverage'
os: 'ubuntu-latest'
- name: 'pypy39 (Windows)'
python: 'pypy-3.9'
toxpython: 'pypy3.9'
python_arch: 'x64'
tox_env: 'pypy39-with_coverage'
os: 'windows-latest'
- name: 'pypy39 (macOS)'
python: 'pypy-3.9'
toxpython: 'pypy3.9'
python_arch: 'arm64'
tox_env: 'pypy39-with_coverage'
os: 'macos-latest'
- name: 'pypy310 (Ubuntu)'
python: 'pypy-3.10'
toxpython: 'pypy3.10'
python_arch: 'x64'
tox_env: 'pypy310-with_coverage'
os: 'ubuntu-latest'
- name: 'pypy310 (Windows)'
python: 'pypy-3.10'
toxpython: 'pypy3.10'
python_arch: 'x64'
tox_env: 'pypy310-with_coverage'
os: 'windows-latest'
- name: 'pypy310 (macOS)'
python: 'pypy-3.10'
toxpython: 'pypy3.10'
python_arch: 'arm64'
tox_env: 'pypy310-with_coverage'
os: 'macos-latest'
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.python_arch }}
- name: Install tox dependencies
run: |
python -m pip install --upgrade pip
pip install --progress-bar=off 'tox ~= 4.9'
virtualenv --version
pip --version
tox --version
pip list --format=freeze
- name: Test
env:
TOXPYTHON: '${{ matrix.toxpython }}'
run: >
tox -e ${{ matrix.tox_env }} -v

21
tox.ini
View File

@ -1,19 +1,22 @@
[tox]
envlist = {py38,py39,py310,py311,py312,pypy39,pypy310}-{with,without}_coverage
envlist =
{py38,py39,py310,py311,py312,pypy39,pypy310}-{with,without}_coverage
[testenv]
install_command =
{envpython} -m pip install -vvv {opts} {packages}
; setenv =
; ; The following two flags are a workaround for an issue with building
; ; Python extensions on OSX with xcode 5.1.
; ; See: http://stackoverflow.com/questions/22313407/
; CFLAGS=-Qunused-arguments
; CPPFLAGS=-Qunused-arguments
basepython =
py38: {env:TOXPYTHON:python3.8}
py39: {env:TOXPYTHON:python3.9}
py310: {env:TOXPYTHON:python3.10}
py311: {env:TOXPYTHON:python3.11}
py312: {env:TOXPYTHON:python3.12}
pypy39: {env:TOXPYTHON:pypy3.9}
pypy310: {env:TOXPYTHON:pypy3.10}
deps =
; use specific versions of testing tools with which this is known to work
with_coverage: coverage>=5,<6
{py38,py39,py310,py311,py312,pypy39,pypy310}: biopython
setenv =
PYTHONUNBUFFERED=yes
allowlist_externals =
mv
commands =