From f90805ec5bf8dfef63780c3eac38136957496ad6 Mon Sep 17 00:00:00 2001 From: Tal Einat <532281+taleinat@users.noreply.github.com> Date: Tue, 25 Jun 2024 09:53:07 +0300 Subject: [PATCH] Add CI testing using GitHub Actions --- .github/workflows/ci.yml | 160 +++++++++++++++++++++++++++++++++++++++ tox.ini | 21 ++--- 2 files changed, 172 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..337569c --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/tox.ini b/tox.ini index 38848c4..c48f3db 100644 --- a/tox.ini +++ b/tox.ini @@ -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 =