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 * * *"

jobs:
  test:
    name: test ${{ matrix.py }} - ${{ matrix.os }}
    runs-on: ${{ matrix.os }}-latest
    strategy:
      fail-fast: false
      matrix:
        os:
          - Ubuntu
          - Windows
          - MacOs
        py:
          - "3.12"
          - "3.11"
          - "3.10"
          - "3.9"
          - "3.8"
          - "3.7"
    steps:
      - name: Setup python for test ${{ matrix.py }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.py }}
      - uses: actions/checkout@v2
      - name: Install tox-gh
        run: python -m pip install tox-gh
      - name: Setup test suite
        run: tox4 r -vv --notest
      - name: Run test suite
        run: tox4 r --skip-pkg-install
        env:
          PYTEST_ADDOPTS: "-vv --durations=10"

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.2.0.tar.gz (6.4 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.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tox_gh-1.2.0.tar.gz
Algorithm Hash digest
SHA256 1ff4e7a3e76e12652cf99bdf8d2732aa613881813a3d0cc1138cc0871d874d8e
MD5 5517254f2126bac347c625be1cf7b959
BLAKE2b-256 8c63ae7ab14d7aafdb1953296d8fd1fca3c1d8eff4a37983e167e75c2894dc8a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tox_gh-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e451b2cb989a84284732e32f3ab5046110c8e59ff098e32d3db24ae7044036a
MD5 dde07fefb56ce0a1f62d5410dd14eaca
BLAKE2b-256 fe2ea86fded13e726987df4a2dcc44c20fb0557482b661349a5027a36ecfe822

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