├── .gitignore ├── test └── test.py ├── pyproject.toml ├── .github └── workflows │ ├── main.yml │ └── this-repo.yml ├── action.yaml └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | /.tox/ 3 | -------------------------------------------------------------------------------- /test/test.py: -------------------------------------------------------------------------------- 1 | def test_basic_math(): 2 | assert 1 + 1 == 2 3 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ "setuptools >= 44", "wheel >= 0.34.0"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | [tool.tox] 6 | legacy_tox_ini = """ 7 | [tox] 8 | envlist = py36,py39,py310,py311,py312,py313,py314,py314t,pypy2,pypy3 9 | skipsdist = True 10 | 11 | [testenv] 12 | deps = pytest >= 3.0.0 13 | commands = pytest test/test.py 14 | """ 15 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: 4 | - main 5 | pull_request: 6 | branches: 7 | - main 8 | 9 | name: Run Tox tests 10 | 11 | jobs: 12 | tox_test: 13 | name: Tox test 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Run Tox tests 17 | id: test 18 | uses: fedora-python/tox-github-action@main 19 | with: 20 | tox_env: ${{ matrix.tox_env }} 21 | strategy: 22 | matrix: 23 | tox_env: [py36, py39, py310, py311, py312, py313, py314, pypy2, pypy3] 24 | 25 | # Use GitHub's Linux Docker host 26 | runs-on: ubuntu-latest 27 | -------------------------------------------------------------------------------- /.github/workflows/this-repo.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | pull_request: 4 | 5 | name: Run tests with code in this repository 6 | # (This can't be used as an example for other projects) 7 | 8 | jobs: 9 | tox_test: 10 | name: Tox test 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Run Tox tests 14 | id: test 15 | uses: ./ 16 | with: 17 | tox_env: ${{ matrix.tox_env }} 18 | dnf_install: ${{ matrix.dnf_install }} 19 | strategy: 20 | matrix: 21 | tox_env: [py39] 22 | dnf_install: ["", "libffi-devel", "--enablerepo=updates-testing libffi-devel libyaml-devel"] 23 | workdir: ["", "./test/", "test"] 24 | 25 | # Use GitHub's Linux Docker host 26 | runs-on: ubuntu-latest 27 | -------------------------------------------------------------------------------- /action.yaml: -------------------------------------------------------------------------------- 1 | name: Python Tox on Fedora 2 | description: Runs tests with Tox 3 | inputs: 4 | tox_env: 5 | required: true 6 | default: 'py314' 7 | description: Tox environment to run the tests on 8 | dnf_install: 9 | required: false 10 | default: '' 11 | description: Space separated packages to install via dnf install (can contain options) 12 | workdir: 13 | required: false 14 | default: '' 15 | description: Path to switch to before running tox. 16 | 17 | runs: 18 | using: docker 19 | image: docker://fedorapython/fedora-python-tox:f42 20 | env: 21 | TOXENV: ${{ inputs.tox_env }} 22 | DNF_INSTALL: ${{ inputs.dnf_install }} 23 | WORKDIR: ${{ inputs.workdir }} 24 | branding: 25 | color: green 26 | icon: check 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Run Tox tests](https://github.com/fedora-python/tox-github-action/workflows/Run%20Tox%20tests/badge.svg) 2 | ![Run tests with code in this repository](https://github.com/fedora-python/tox-github-action/workflows/Run%20tests%20with%20code%20in%20this%20repository/badge.svg) 3 | 4 | # Tox Github Action 5 | 6 | This GitHub action tests a checked-out Python project using 7 | [Tox](https://tox.readthedocs.io/en/latest/index.html). 8 | 9 | 10 | ## Usage 11 | 12 | ```yaml 13 | - uses: fedora-python/tox-github-action 14 | with: 15 | # The tox environment to run 16 | # Default: py312 (subject to change as new Python releases come out) 17 | tox_env: py312 18 | ``` 19 | 20 | Add the action to your workflow file, e.g. `.github/workflows/main.yml`, 21 | after checking out your code. 22 | 23 | You can use the `matrix` strategy to run with multiple Tox environments. 24 | For an example, see [this project's workflow](.github/workflows/main.yml). 25 | Unfortunately, you need to repeat all the environment names 26 | from your Tox configuration. 27 | (As far as we know, this is required in order to have individual environments 28 | show up as separate runs on GitHub. Discuss this limitation in [issue 8].) 29 | 30 | You can also install RPM packages from Fedora by setting `dnf_install` to 31 | a space-separated list of *provides*, such as: 32 | 33 | * Fedora package names, e.g. `libgit2-devel`, 34 | * pkgconfig names, e.g. `pkgconfig(libffi)`, 35 | * commands, e.g. `/usr/bin/cowsay`, ... 36 | 37 | ```yaml 38 | - uses: fedora-python/tox-github-action 39 | with: 40 | tox_env: py39 41 | dnf_install: pkgconfig(libffi) libgit2-devel 42 | ``` 43 | 44 | The string will be literally used in `dnf install ...`, so you can also use 45 | groups or DNF options. 46 | 47 | [issue 8]: https://github.com/fedora-python/tox-github-action/issues/8 48 | 49 | If your application isn't in the root of your project, set `workdir`. The action 50 | will switch to the specified path before tox execution. 51 | 52 | ```yaml 53 | - uses: fedora-python/tox-github-action 54 | with: 55 | tox_env: py39 56 | workdir: "python/" 57 | ``` 58 | 59 | ## Changelog 60 | 61 | Until version 0.4, this action always used the latest [fedora-python-tox](https://hub.docker.com/repository/docker/fedorapython/fedora-python-tox) 62 | image. Since version 34.0, the first number in the version (also sometimes 63 | referred to as the "major version") represents the release of Fedora used in the image. 64 | 65 | ### v42.0 66 | 67 | * Uses Fedora 42 as the base container image. 68 | * Python 3.8 is no longer available. 69 | * PyPy 3.9 is no longer available 70 | * Freethreading Python is available (3.14t and 3.15t) 71 | * Python 3.14 is now the default tox environment if none is configured. 72 | 73 | ### v41.0 74 | 75 | * Uses Fedora 41 as the base container image. 76 | * Python 2.7 is no longer available. 77 | * PyPy 3.11 is now available 78 | * Python 3.13 is now the default tox environment if none is configured. 79 | 80 | ### v40.0 81 | 82 | * Uses Fedora 40 as the base container image. 83 | * Python 3.7 is no longer available. 84 | * Python 3.12 is now the default tox environment if none is configured. 85 | 86 | ### v39.0 87 | 88 | * Uses Fedora 39 as the base container image. 89 | 90 | ### v38.0 91 | 92 | * Uses Fedora 38 as the base container image. 93 | * PyPy 3.8 is no longer available. 94 | 95 | ### v37.0 96 | 97 | * Uses Fedora 37 as the base container image. 98 | * PyPy 3.7 is no longer available. 99 | 100 | ### v36.0 101 | 102 | * Uses Fedora 36 as the base container image. 103 | 104 | ### v35.1 105 | 106 | * Allows to run tests from a subdirectory via `workdir`. 107 | 108 | ### v35.0 109 | 110 | * Uses Fedora 35 as the base container image. 111 | * No longer supports Python 3.5 and PyPy 3.6. 112 | * Newly supports PyPy 3.7, 3.8 and 3.9. 113 | 114 | ### v34.0 115 | 116 | * First version pinned explicitly to Fedora 34. 117 | 118 | ## License 119 | 120 | The code, content and configuration in this repository is given away unter the 121 | CC0 1.0 Universal Public Domain Dedication: 122 | https://creativecommons.org/publicdomain/zero/1.0/ 123 | 124 | May it serve you well! 125 | --------------------------------------------------------------------------------