In YAML the indentation level is part of the syntax (see the āNested Mappingsā section in the tutorial). The problem is that your runs-on is at the same level of indentation as selenium, so itās not part of the job, but a new item within jobs (the indentation level above). And ${{ matrix.os }} is not a valid job definition, nor is the selenium job valid without a runs-on or steps.
To define runs-on for the selenium job, the runs-on must be indented to the same level as other items within the job, like strategy.
Thanks for your input!
it looks like the matrix syntax isnt the problem. the indentations are the problem and i could solve it.
But now i have to change the runs for mac and windows so that it uses two different installation methods for python.
because in the windows runner it will execute a powershell file, in the macos runner it uses a .sh file which does not know the powershell syntax.
can you help me solve this too? its my first yml fileā¦
Thanks!
You can add an if condition on a step. Then the step runs only if the condition is met. If you do something like this:
- name: install dependencies (macos)
run: your install command here
if: matrix.os == 'macos-latest'
The step will only run if running on the selected runner, in the example the macos-latest one. So you can have one step that runs only on MacOS, and create a similar one that only runs on Windows.
Just as a side note, the indentation was a YAML thing (how to structure mappings, lists, etc.), the rest is specific to GitHub Actions workflows. A lot of other tools (including competing ones) use YAML for other data sets with other structures, but the same format.