From dd8067dc1dc376ac90a8587cb4e912770266c860 Mon Sep 17 00:00:00 2001 From: Simon Gerber Date: Thu, 25 Jul 2024 17:58:49 +0200 Subject: [PATCH] Add GitHub actions jobs which runs `golden-diff` for each test case --- .github/workflows/test.yml | 26 ++++++++++++++++++++++++++ gitlab/Makefile | 5 +++++ 2 files changed, 31 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d7d0be..cdf5ea7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,3 +31,29 @@ jobs: pattern: | *.sh step-* + + test_gitlab_generator_script_discover_cases: + name: Discover golden test cases + runs-on: ubuntu-latest + outputs: + instances: ${{ steps.instances.outputs.instances }} + steps: + - uses: actions/checkout@v4 + - name: Find test cases + id: instances + run: | + instances=$(make -sC gitlab list_test_instances) + echo "instances=${instances}" + echo "instances=${instances}" >> "$GITHUB_OUTPUT" + + test_gitlab_generator_script: + needs: test_gitlab_generator_script_discover_cases + strategy: + matrix: + instance: ${{ fromJSON(needs.test_gitlab_generator_script_discover_cases.outputs.instances) }} + runs-on: ubuntu-latest + name: 'Golden test: ${{ matrix.instance }}' + steps: + - uses: actions/checkout@v4 + - run: | + make -C gitlab golden-diff -e instance=${{ matrix.instance }} diff --git a/gitlab/Makefile b/gitlab/Makefile index 670ed47..abe4062 100644 --- a/gitlab/Makefile +++ b/gitlab/Makefile @@ -35,3 +35,8 @@ gen-golden-all: $(test_instances) .PHONY: $(test_instances) $(test_instances): $(MAKE) $(recursive_target) -e instance=$(basename $(@F)) + +.PHONY: list_test_instances +list_test_instances: JSONNET_ENTRYPOINT=jsonnet +list_test_instances: + $(JSONNET_DOCKER) --ext-str instances="$(basename $(notdir $(test_instances)))" -e 'std.split(std.extVar("instances"), " ")' | jq -c