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.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tox_gh-1.3.0.tar.gz
  • Upload date:
  • Size: 6.7 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.0.tar.gz
Algorithm Hash digest
SHA256 fc4cb86902029f1827ae5b332811fa8108ecc8d870238f8a87092ae15fd6a94c
MD5 f9718a6a11fdac526ddb81b55f28ed3e
BLAKE2b-256 1592c8d005ea673616fc4064b85e89c9818fb3c8d2e6c1d0816f88c5523d4ee9

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: tox_gh-1.3.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21a0511e6b80484f73ce7a5efce9526851bdd36aa38a1812cacaeec5768db133
MD5 2a72739781c520f7a4feaf4f341152f4
BLAKE2b-256 bd73ae37608a3e1f3f4a32e0dbd17bfc5bcea918ee0cea6f9c6dae32d29f70c0

See more details on using hashes here.

Provenance

Supported by

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