From 78661535c0e80e994bf424c4560e7a559b79b7ca Mon Sep 17 00:00:00 2001 From: Ganeshrockz Date: Wed, 24 Jan 2024 13:58:50 +0530 Subject: [PATCH] Add scenario validator --- .github/workflows/scenario-validator.yml | 74 ++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/scenario-validator.yml diff --git a/.github/workflows/scenario-validator.yml b/.github/workflows/scenario-validator.yml new file mode 100644 index 00000000..da35d66c --- /dev/null +++ b/.github/workflows/scenario-validator.yml @@ -0,0 +1,74 @@ +# Runs scenario tests for a given scenario +name: Scenario validator +on: + workflow_dispatch: + inputs: + scenario_name: + description: 'Name of the scenario to test' + required: true + +jobs: + get-go-version: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./test/acceptance + outputs: + go-version: ${{ steps.get-go-version.outputs.go-version }} + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Determine Go version + id: get-go-version + run: | + echo "Building with Go $(cat .go-version)" + echo "go-version=$(cat .go-version)" >> "$GITHUB_OUTPUT" + go-fmt-and-lint-acceptance: + runs-on: ubuntu-latest + needs: + - get-go-version + defaults: + run: + working-directory: ./test/acceptance + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Setup Go + uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 + with: + go-version: ${{ needs.get-go-version.outputs.go-version }} + cache-dependency-path: ./test/acceptance/go.sum + - name: Go CI lint + uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0 + with: + args: "--verbose --enable gofmt" + only-new-issues: false + skip-pkg-cache: true + skip-build-cache: true + working-directory: ./test/acceptance + - name: Lint Consul retry + run: | + go install github.com/hashicorp/lint-consul-retry@v1.3.0 + lint-consul-retry + terraform-fmt: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Setup Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.4.2 + - name: Validate + run: terraform fmt -check -recursive . + validate-scenario: + needs: + - terraform-fmt + - go-fmt-and-lint-acceptance + - get-go-version + uses: ./.github/workflows/reusable-ecs-example-validator.yml + with: + name: 'Scenario validator' + scenario: ${{ inputs.scenario_name }} + go-version: ${{ needs.get-go-version.outputs.go-version }} + secrets: inherit \ No newline at end of file