Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would prefer to use toxenv names in strategy matrix #8

Open
merwok opened this issue Jan 15, 2022 · 2 comments
Open

Would prefer to use toxenv names in strategy matrix #8

merwok opened this issue Jan 15, 2022 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@merwok
Copy link

merwok commented Jan 15, 2022

Hello! With other CI providers, I like to define one CI check/job per tox environment, for example one for each of py38, py39, py310-coverage, lint. For github actions, I understand that it’s easy to use python version as an axis, so that the values generate combinations and can be used as parameter for the python install action. But having to run multiple jobs (e.g. py310 and lint / type check / doc check/etc) in one check feels backward to me: it’s driven by what the tool can do rather than what I want to see.
It doesn’t make sense to have one check that runs tests with latest python and lint, these should be separate jobs with separate success status.

Inspired by a comment somewhere, I ditched tox-gh-actions, used tox-env as matrix axis and used an external config file to map tox-env value to python install parameter: https://github.com/caravancoop/configstore/blob/main/.github/workflows/configstore.yml#L11
(I tried to configure all in the yaml file at first with complicated expressions but that was not worth it)

It would be great to have native support for this!

I don’t really have implementation suggestion. If we can add arbitrary config in the actions config file, maybe a mapping could be defined there? If not, it might have to be a job with outputs and that could be heavy (if it needs to call tox or use a shell).

jobs:
  test:
    name: test ${{ matrix.tox-env }}
    strategy:
      fail-fast: false
      matrix:
        tox-env:
          - "3.10"
          - "3.9"
          - "3.8"
          - "lint"
          - "pkg"

    steps:
      - uses: actions/setup-python@v2
        with:
          python-version: ${{ some-expression-to-get-version }}
@ssbarnea
Copy link
Member

@merwok You might want to take a look at https://github.com/marketplace/actions/dynamic-matrix as is basically doing what you are asking, with few extra features.

@merwok
Copy link
Author

merwok commented Dec 26, 2022

It does indeed. For now I am using https://github.com/marketplace/actions/create-matrix-action by @fabiocaccamo which works in the same way.

@gaborbernat gaborbernat added the help wanted Extra attention is needed label Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants