-
Here’s what I’m trying: jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version:
- 3.7
os:
- ubuntu-18.04
env:
- TOXENV: python,check-docs,build-docs
- TOXENV: build-dists,pre-commit-ci I want to generate a number of jobs from matrix also taking into account the specified env vars. Just like Travis CI does:
Anything I’m missing? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
Hi @webknjaz, thanks for being here! Did you give this workflow a go? Are you having any problems? |
Beta Was this translation helpful? Give feedback.
-
Hi @andreagriffiths11, I tried it and it doesn’t create jobs with different env var values from the matrix. |
Beta Was this translation helpful? Give feedback.
-
Workaround is to explicitly apply the env factor on a job level: jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version:
- 3.7
os:
- ubuntu-18.04
env:
- TOXENV: python,check-docs,build-docs
- TOXENV: build-dists,pre-commit-ci
steps:
- ...
- run: |
some-command --with-access-to=env
env: ${{matrix.env }} |
Beta Was this translation helpful? Give feedback.
-
@webknjaz, what about this mechanism ? https://docs.travis-ci.com/user/environment-variables/#defining-multiple-variables-per-item |
Beta Was this translation helpful? Give feedback.
-
That’s essentially the same except that with GH Actions you have to expose vars to each job explicitly. |
Beta Was this translation helpful? Give feedback.
-
I just checked and it turns out that you can use env: on the job level too now: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idenv |
Beta Was this translation helpful? Give feedback.
-
@webknjaz Could you provide an example as i have tried and failed as actions does not support multiple env variables. I would like each job to receive multiple variables like
|
Beta Was this translation helpful? Give feedback.
-
@webknjaz Sorry figured it out:
The actions editor on github tripped me up with the error “only primitive types are allowed for”. |
Beta Was this translation helpful? Give feedback.
Workaround is to explicitly apply the env factor on a job level: