ci/test-info.nix: read scenarios from github workflow file
Simplifies maintenance, both files no longer need to be kept in sync.
This commit is contained in:
parent
dedbacf35e
commit
3a13b5f77c
2 changed files with 16 additions and 6 deletions
5
.github/workflows/test.yml
vendored
5
.github/workflows/test.yml
vendored
|
|
@ -31,7 +31,10 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
scenario: [default, netns, netnsRegtest]
|
scenario:
|
||||||
|
- default
|
||||||
|
- netns
|
||||||
|
- netnsRegtest
|
||||||
needs: build_test_drivers
|
needs: build_test_drivers
|
||||||
if: needs.build_test_drivers.outputs.run_scenario_tests == 'true'
|
if: needs.build_test_drivers.outputs.run_scenario_tests == 'true'
|
||||||
steps:
|
steps:
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,19 @@
|
||||||
pkgs: instantiateTests:
|
pkgs: instantiateTests:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
scenarioNames = let
|
||||||
|
inherit (pkgs) lib;
|
||||||
|
workflowSrc = builtins.readFile ../../.github/workflows/test.yml;
|
||||||
|
matches = builtins.match ".*scenario:(([ \n]+-[ ]+[^ \n]+)+).*" workflowSrc;
|
||||||
|
scenariosStr = builtins.head matches;
|
||||||
|
particles = builtins.split "[ \n]+-[ ]+" scenariosStr;
|
||||||
|
# The first split particle is always an empty str
|
||||||
|
particles' = builtins.tail particles;
|
||||||
|
in
|
||||||
|
builtins.filter lib.isString particles';
|
||||||
|
|
||||||
# `instantiateTests` prints the test name before evaluating, which is useful for debugging
|
# `instantiateTests` prints the test name before evaluating, which is useful for debugging
|
||||||
ciTests = instantiateTests [
|
ciTests = instantiateTests scenarioNames;
|
||||||
"default"
|
|
||||||
"netns"
|
|
||||||
"netnsRegtest"
|
|
||||||
];
|
|
||||||
drivers = map (x: x.driver) ciTests;
|
drivers = map (x: x.driver) ciTests;
|
||||||
driverDrvs = map (x: ''"${x.drvPath}^*"'') drivers;
|
driverDrvs = map (x: ''"${x.drvPath}^*"'') drivers;
|
||||||
in ''
|
in ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue