From 58f3e1bec4ab27d56cb72adce48c2bdf4d2040f2 Mon Sep 17 00:00:00 2001 From: Volodymyr Manilo Date: Tue, 14 May 2024 20:39:23 +0200 Subject: [PATCH] test opentofu --- .github/workflows/ci.yml | 123 +++++++++++++++++++++---------- .github/workflows/smoketests.yml | 4 +- 2 files changed, 88 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 116d747e..24f6e4c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ on: - 'README.md' branches: - main + - feature/add-opentofu-support # Ensures only 1 action runs per PR and previous is canceled on new trigger concurrency: @@ -115,63 +116,111 @@ jobs: flag-name: tests parallel: true - tests-acceptance: +# tests-acceptance: +# name: Matrix Acceptance Tests +# needs: build +# runs-on: ubuntu-latest +# if: "!github.event.pull_request.head.repo.fork" +# timeout-minutes: 15 +# strategy: +# fail-fast: false +# matrix: +# terraform: +# - '1.6.*' +# - '1.7.*' +# - 'latest' +# steps: +# +# - name: Check out code into the Go module directory +# uses: actions/checkout@v4 +# +# - name: Set up Go +# uses: actions/setup-go@v5 +# with: +# go-version-file: 'go.mod' +# cache: true +# id: go +# +# - uses: hashicorp/setup-terraform@v3 +# with: +# terraform_version: ${{ matrix.terraform }} +# terraform_wrapper: false +# +# - name: go env +# run: echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV +# +# - name: Get dependencies +# run: | +# go mod download +# +# - name: Acceptance tests +# timeout-minutes: 10 +# env: +# TWINGATE_URL: ${{ secrets.TWINGATE_URL }} +# TWINGATE_NETWORK: ${{ secrets.TWINGATE_NETWORK }} +# TWINGATE_API_TOKEN: ${{ secrets.TWINGATE_API_TOKEN }} +# TEST_UNIQUE_VALUE: ${{ github.run_id }}-${{ github.run_number }}-${{ matrix.terraform }} +# run: | +# make testacc +# +# - name: Send coverage +# uses: shogo82148/actions-goveralls@v1 +# with: +# path-to-profile: "./test_results/coverage.out" +# flag-name: tests-acc-${{ matrix.terraform }} +# parallel: true + + tests-acceptance-opentofu: name: Matrix Acceptance Tests needs: build runs-on: ubuntu-latest - if: "!github.event.pull_request.head.repo.fork" +# if: "!github.event.pull_request.head.repo.fork" timeout-minutes: 15 strategy: fail-fast: false matrix: - terraform: + tofu: - '1.6.*' - '1.7.*' - 'latest' - steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v4 + steps: - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: 'go.mod' - cache: true - id: go + - name: Check out code into the Go module directory + uses: actions/checkout@v4 - - uses: hashicorp/setup-terraform@v3 - with: - terraform_version: ${{ matrix.terraform }} - terraform_wrapper: false + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + cache: true + id: go - - name: go env - run: echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV + - uses: opentofu/setup-opentofu@v1 + with: + tofu_version: ${{ matrix.tofu }} + tofu_wrapper: false - - name: Get dependencies - run: | - go mod download + - name: go env + run: echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_ENV - - name: Acceptance tests - timeout-minutes: 10 - env: - TWINGATE_URL: ${{ secrets.TWINGATE_URL }} - TWINGATE_NETWORK: ${{ secrets.TWINGATE_NETWORK }} - TWINGATE_API_TOKEN: ${{ secrets.TWINGATE_API_TOKEN }} - TEST_UNIQUE_VALUE: ${{ github.run_id }}-${{ github.run_number }}-${{ matrix.terraform }} - run: | - make testacc + - name: Get dependencies + run: | + go mod download - - name: Send coverage - uses: shogo82148/actions-goveralls@v1 - with: - path-to-profile: "./test_results/coverage.out" - flag-name: tests-acc-${{ matrix.terraform }} - parallel: true + - name: Acceptance tests + timeout-minutes: 10 + env: + TWINGATE_URL: ${{ secrets.TWINGATE_URL }} + TWINGATE_NETWORK: ${{ secrets.TWINGATE_NETWORK }} + TWINGATE_API_TOKEN: ${{ secrets.TWINGATE_API_TOKEN }} + TEST_UNIQUE_VALUE: ${{ github.run_id }}-${{ github.run_number }}-opentofu-${{ matrix.tofu }} + run: | + make testacc cleanup: name: Cleanup - if: "!github.event.pull_request.head.repo.fork" +# if: "!github.event.pull_request.head.repo.fork" needs: tests-acceptance runs-on: ubuntu-latest timeout-minutes: 15 diff --git a/.github/workflows/smoketests.yml b/.github/workflows/smoketests.yml index e13ebcc6..6a5a43f0 100644 --- a/.github/workflows/smoketests.yml +++ b/.github/workflows/smoketests.yml @@ -46,8 +46,8 @@ jobs: fail-fast: false matrix: terraform: - - '1.4.*' - - '1.5.*' + - '1.6.*' + - '1.7.*' - 'latest' steps: - name: Check out code into the Go module directory