From 3a13b5f77c27e4f644a0ad3c634fb62cbb1c4610 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Mon, 20 Oct 2025 21:57:21 +0200 Subject: [PATCH] ci/test-info.nix: read scenarios from github workflow file Simplifies maintenance, both files no longer need to be kept in sync. --- .github/workflows/test.yml | 5 ++++- test/ci/test-info.nix | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9ed0c6f..964384f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,10 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - scenario: [default, netns, netnsRegtest] + scenario: + - default + - netns + - netnsRegtest needs: build_test_drivers if: needs.build_test_drivers.outputs.run_scenario_tests == 'true' steps: diff --git a/test/ci/test-info.nix b/test/ci/test-info.nix index 3333804..bfadded 100644 --- a/test/ci/test-info.nix +++ b/test/ci/test-info.nix @@ -1,12 +1,19 @@ pkgs: instantiateTests: 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 - ciTests = instantiateTests [ - "default" - "netns" - "netnsRegtest" - ]; + ciTests = instantiateTests scenarioNames; drivers = map (x: x.driver) ciTests; driverDrvs = map (x: ''"${x.drvPath}^*"'') drivers; in ''