diff --git a/.github/workflows/build-terraform-cli.yml b/.github/workflows/build-terraform-cli.yml index 005c4cb7e622..110ea8d89fcd 100644 --- a/.github/workflows/build-terraform-cli.yml +++ b/.github/workflows/build-terraform-cli.yml @@ -39,7 +39,7 @@ jobs: name: Terraform ${{ inputs.goos }} ${{ inputs.goarch }} v${{ inputs.product-version }} steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + - uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ inputs.go-version }} - name: Build Terraform diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5e4ccc21290..6e7c47a35b8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,13 +7,17 @@ name: build on: workflow_dispatch: - push: + workflow_run: + workflows: ["Quick Checks"] + types: + - completed branches: - main - 'v[0-9]+.[0-9]+' - releng/** - tsccr-auto-pinning/** - dependabot/** + push: tags: - 'v[0-9]+.[0-9]+.[0-9]+*' @@ -27,6 +31,7 @@ permissions: jobs: get-product-version: name: "Determine intended Terraform version" + if: ${{ github.event.action != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest outputs: product-version: ${{ steps.get-product-version.outputs.product-version }} @@ -190,7 +195,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Install Go toolchain - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ needs.get-go-version.outputs.go-version }} @@ -207,7 +212,7 @@ jobs: bash ./internal/command/e2etest/make-archive.sh - name: Save test harness to cache - uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: ${{ steps.set-cache-values.outputs.e2e-cache-path }} key: ${{ steps.set-cache-values.outputs.e2e-cache-key }}_${{ matrix.goos }}_${{ matrix.goarch }} @@ -247,7 +252,7 @@ jobs: if: ${{ (matrix.goos == 'linux') || (matrix.goos == 'darwin') }} uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: "Restore cache" - uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 id: e2etestpkg with: path: ${{ needs.e2etest-build.outputs.e2e-cache-path }} @@ -300,7 +305,7 @@ jobs: steps: - name: Install Go toolchain - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ needs.get-go-version.outputs.go-version }} - name: Download Terraform CLI package diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 544777c8a4fe..e2d849c9d01e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -48,7 +48,7 @@ jobs: uses: ./.github/actions/go-version - name: Install Go toolchain - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ steps.go.outputs.version }} @@ -56,7 +56,7 @@ jobs: # identical across the unit-tests, e2e-tests, and consistency-checks # jobs, or else weird things could happen. - name: Cache Go modules - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: "~/go/pkg" key: go-mod-${{ hashFiles('go.sum') }} @@ -83,7 +83,7 @@ jobs: uses: ./.github/actions/go-version - name: Install Go toolchain - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ steps.go.outputs.version }} @@ -91,7 +91,7 @@ jobs: # identical across the unit-tests, e2e-tests, and consistency-checks # jobs, or else weird things could happen. - name: Cache Go modules - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: "~/go/pkg" key: go-mod-${{ hashFiles('go.sum') }} @@ -121,7 +121,7 @@ jobs: uses: ./.github/actions/go-version - name: Install Go toolchain - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ steps.go.outputs.version }} @@ -129,7 +129,7 @@ jobs: # identical across the unit-tests, e2e-tests, and consistency-checks # jobs, or else weird things could happen. - name: Cache Go modules - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: "~/go/pkg" key: go-mod-${{ hashFiles('go.sum') }} @@ -155,7 +155,7 @@ jobs: uses: ./.github/actions/go-version - name: Install Go toolchain - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ steps.go.outputs.version }} @@ -163,7 +163,7 @@ jobs: # identical across the unit-tests, e2e-tests, and consistency-checks # jobs, or else weird things could happen. - name: Cache Go modules - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: "~/go/pkg" key: go-mod-${{ hashFiles('go.sum') }} @@ -182,7 +182,7 @@ jobs: fi - name: Cache protobuf tools - uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 + uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 with: path: "tools/protobuf-compile/.workdir" key: protobuf-tools-${{ hashFiles('tools/protobuf-compile/protobuf-compile.go') }} diff --git a/.github/workflows/equivalence-test-diff.yml b/.github/workflows/equivalence-test-diff.yml index c38ea31fd957..e9537d744244 100644 --- a/.github/workflows/equivalence-test-diff.yml +++ b/.github/workflows/equivalence-test-diff.yml @@ -29,7 +29,7 @@ jobs: uses: ./.github/actions/go-version - name: Install Go toolchain - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ steps.go.outputs.version }} cache-dependency-path: go.sum diff --git a/.github/workflows/equivalence-test-manual-update.yml b/.github/workflows/equivalence-test-manual-update.yml index 096a493ce6e8..d6a97db562bf 100644 --- a/.github/workflows/equivalence-test-manual-update.yml +++ b/.github/workflows/equivalence-test-manual-update.yml @@ -38,7 +38,7 @@ jobs: uses: ./.github/actions/go-version - name: Install Go toolchain - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ steps.go.outputs.version }} cache-dependency-path: go.sum diff --git a/.github/workflows/equivalence-test-update.yml b/.github/workflows/equivalence-test-update.yml index d9d094d1c223..1f9cec7f53f4 100644 --- a/.github/workflows/equivalence-test-update.yml +++ b/.github/workflows/equivalence-test-update.yml @@ -53,7 +53,7 @@ jobs: uses: ./.github/actions/go-version - name: Install Go toolchain - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 with: go-version: ${{ steps.go.outputs.version }} cache-dependency-path: go.sum diff --git a/internal/command/modules_test.go b/internal/command/modules_test.go index ec30972d1688..431105fa5deb 100644 --- a/internal/command/modules_test.go +++ b/internal/command/modules_test.go @@ -7,6 +7,7 @@ import ( "encoding/json" "os" "reflect" + "runtime" "sort" "strings" "testing" @@ -41,10 +42,29 @@ func TestModules_noJsonFlag(t *testing.T) { actual := done(t).All() - for _, part := range expectedOutputHuman { - if !strings.Contains(actual, part) { - t.Fatalf("unexpected output: %s\n", part) - } + expectedOutputHuman := ` +Modules declared by configuration: +. +├── "other"[./mods/other] +└── "test"[./mods/test] + └── "test2"[./test2] + └── "test3"[./test3] + +` + if runtime.GOOS == "windows" { + expectedOutputHuman = ` +Modules declared by configuration: +. +├── "other"[.\mods\other] +└── "test"[.\mods\test] + └── "test2"[.\test2] + └── "test3"[.\test3] + +` + } + + if diff := cmp.Diff(expectedOutputHuman, actual); diff != "" { + t.Fatalf("unexpected output:\n%s\n", diff) } } @@ -185,5 +205,3 @@ func compareJSONOutput(t *testing.T, got string, want string) { } var expectedOutputJSON = `{"format_version":"1.0","modules":[{"key":"test","source":"./mods/test","version":""},{"key":"test2","source":"./test2","version":""},{"key":"test3","source":"./test3","version":""},{"key":"other","source":"./mods/other","version":""}]}` - -var expectedOutputHuman = []string{"── \"other\"[./mods/other]", "── \"test\"[./mods/test]\n └── \"test2\"[./test2]\n └── \"test3\"[./test3]"}