Skip to main content

Seamless integration of tox into GitHub Actions.

Project description

tox-gh

PyPI version PyPI Supported Python Versions check

tox-gh is a tox plugin which helps running tox on GitHub Actions with multiple different Python versions on multiple workers in parallel.

Features

When running tox on GitHub Actions, tox-gh

  • detects which environment to run based on configurations and
  • provides utilities such as grouping log lines.

Usage

  1. Add configurations under [gh] section along with your tox configuration.
  2. Install tox-gh package in the GitHub Actions workflow before running tox command.

Examples

Basic Example

Add [gh] section to the same file as tox configuration. If you're using tox.ini:

[gh]
python =
    3.12 = py312
    3.11 = py311, type
    3.10 = py310
    3.9 = py39
    3.8 = py38
    3.7 = py37

This will run different set of tox environments on different python versions set up via GitHub setup-python action:

  • on Python 3.7 job, tox runs py37 environment,
  • on Python 3.8 job, tox runs py38 environment,
  • on Python 3.9 job, tox runs py39 environment,
  • on Python 3.10 job, tox runs py310 environment,
  • in Python 3.11 job, tox runs py311 and type environments,
  • on Python 3.12 job, tox runs py312 environment.

Workflow Configuration

.github/workflows/check.yml:

name: check
on:
  push:
  pull_request:
  schedule:
    - cron: "0 8 * * *"

concurrency:
  group: check-${{ github.ref }}
  cancel-in-progress: true

jobs:
  test:
    name: test with ${{ matrix.py }} on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        py:
          - "3.12"
          - "3.11"
          - "3.10"
          - "3.9"
          - "3.8"
          - "3.7"
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - name: Setup python for test ${{ matrix.py }}
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.py }}
      - name: Install tox
        run: python -m pip install tox-gh>=1.2
      - name: Setup test suite
        run: tox -vv --notest
      - name: Run test suite
        run: tox --skip-pkg-install

FAQ

  • When a list of environments to run is specified explicitly via -e option or TOXENV environment variable tox-gh respects the given environments and simply runs the given environments without enforcing its configuration.
  • The plugin only activates if the environment variable GITHUB_ACTIONS is true.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tox_gh-1.3.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tox_gh-1.3.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file tox_gh-1.3.1.tar.gz.

File metadata

  • Download URL: tox_gh-1.3.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for tox_gh-1.3.1.tar.gz
Algorithm Hash digest
SHA256 594af90b740c14735c41b914b41db2d2aa0360929a1746af32bda4b9fef9bf3d
MD5 6065f04ad92339f11ebcc8d59231d45e
BLAKE2b-256 ffb69e5f74b94da149db499929938fe61d0b69f19f637b067f42f0247b66e671

See more details on using hashes here.

File details

Details for the file tox_gh-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: tox_gh-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for tox_gh-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c671c62ce23ae519a557c3da81e9aa7e35b3a66c69bad71908e595921f83e82d
MD5 381bb967cdb2364206fb5a151c3114aa
BLAKE2b-256 1d0ed4def5bb5dc08e7b8b42f595e9dcd233f50223739ecfa21f032b6de16b48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page