From 0d21c463b1dbfadbe6d27d8d677af4d0bd91610c Mon Sep 17 00:00:00 2001 From: Vibhu Prashar Date: Wed, 26 Jun 2024 18:35:51 +0530 Subject: [PATCH] feat(validator): Add workflow to run validator tests This PR adds a workflow to run validator tests on CI It also adds a make target which can be used to run tests locally as well as on CI Signed-off-by: Vibhu Prashar --- .github/workflows/pull_request.yml | 3 +++ .github/workflows/validator.yml | 36 ++++++++++++++++++++++++++++++ e2e/tools/validator/Makefile | 9 ++++++++ 3 files changed, 48 insertions(+) create mode 100644 .github/workflows/validator.yml create mode 100644 e2e/tools/validator/Makefile diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 6355227ee7..25a444bc27 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -26,6 +26,9 @@ jobs: # for each PR run integration test integration_test: uses: ./.github/workflows/integration_test.yml + # for each PR run validator test + validator: + uses: ./.github/workflows/validator.yml changes_image: runs-on: ubuntu-latest diff --git a/.github/workflows/validator.yml b/.github/workflows/validator.yml new file mode 100644 index 0000000000..08430c0099 --- /dev/null +++ b/.github/workflows/validator.yml @@ -0,0 +1,36 @@ +name: Validator tests + +on: # yamllint disable-line rule:truthy + workflow_call: + +jobs: + test: + runs-on: ubuntu-latest + steps: + # checkout source code + - name: checkout source + uses: actions/checkout@v4.1.1 + + # setup Python environment + - name: set up Python + uses: actions/setup-python@v5.1.0 + with: + python-version: "3.11" + + # install hatch + - name: install hatch + run: | + python -m pip install --upgrade pip + pip install hatch + + # run the formatter using hatch + - name: run formatter with hatch + run: | + cd ./e2e/tools/validator + make fmt + + # run the tests using hatch + - name: run tests with hatch + run: | + cd ./e2e/tools/validator + make test diff --git a/e2e/tools/validator/Makefile b/e2e/tools/validator/Makefile new file mode 100644 index 0000000000..8db94f46e3 --- /dev/null +++ b/e2e/tools/validator/Makefile @@ -0,0 +1,9 @@ +.PHONY: test +test: + @echo "running hatch test" + hatch test + +.PHONY: fmt +fmt: + @echo "running hatch fmt" + hatch fmt -f