diff --git a/.github/workflows/arm-bicep-e2e-v2.yaml b/.github/workflows/arm-bicep-e2e-v2.yaml index 71832f1..1396073 100644 --- a/.github/workflows/arm-bicep-e2e-v2.yaml +++ b/.github/workflows/arm-bicep-e2e-v2.yaml @@ -12,7 +12,6 @@ permissions: id-token: write contents: read - jobs: testarmbicepe2e: @@ -28,6 +27,7 @@ jobs: contents: read pull-requests: write checks: write + id-token: write steps: - name: โคต๏ธ Checkout uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -65,75 +65,4 @@ jobs: subscription-id: ${{ secrets.MPF_SUBSCRIPTIONID }} - name: ๐Ÿงช Run ARM Bicep E2E Tests - run: task teste2e:armbicep - - - - - name: ๐Ÿ“ค Upload ARM Bicep e2e test results - if: always() - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 - with: - name: ${{ format('{0}-{1}-test-results', matrix.cli, env.CLI_VERSION) }} - path: testresults.xml - if-no-files-found: warn - overwrite: true - - - name: ๐Ÿ“ค Upload ARM Bicep e2e test coverage results - if: always() - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 - with: - name: ${{ format('{0}-{1}-test-coverage-results', matrix.cli, env.CLI_VERSION) }} - path: | - coverage.html - coverage.json - coverage.out - coverage.txt - coverage.xml - if-no-files-found: warn - overwrite: true - - - name: ๐Ÿ“ข Publish ARM Bicep e2e test results - if: always() - uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1 - with: - name: ๐Ÿ“œ Test results (${{ matrix.cli }} ${{ matrix.version }}) - reporter: jest-junit - path: testresults.xml - token: ${{ secrets.GITHUB_TOKEN }} - - - name: โš™๏ธ Get ARM Bicep e2e test Coverage summary - if: always() - uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0 - with: - filename: coverage.xml - badge: true - fail_below_min: true - format: markdown - hide_branch_rate: false - hide_complexity: false - indicators: true - output: both - thresholds: "30 60" - - - name: ๐Ÿ“ค Upload ARM Bicep e2e Coverage summary - if: always() - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 - with: - name: ${{ format('{0}-{1}-test-coverage-summary', matrix.cli, env.CLI_VERSION) }} - path: | - code-coverage-results.md - if-no-files-found: warn - overwrite: true - - check-test-matrix: - if: always() - name: ๐Ÿงช Check ARM Bicep e2e Tests - needs: test - runs-on: ubuntu-24.04 - steps: - - name: โœ… OK - if: ${{ !(contains(needs.*.result, 'failure')) }} - run: exit 0 - - name: ๐Ÿ›‘ Failure - if: ${{ contains(needs.*.result, 'failure') }} - run: exit 1 + run: task teste2e:armbicep \ No newline at end of file diff --git a/.github/workflows/terraform-e2e-v2.yaml b/.github/workflows/terraform-e2e-v2.yaml new file mode 100644 index 0000000..3d65d64 --- /dev/null +++ b/.github/workflows/terraform-e2e-v2.yaml @@ -0,0 +1,68 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +--- +# Terraform Provider testing workflow. +name: ๐Ÿงช v2-terraform-e2e + +# This GitHub action runs your tests for each pull request. +# Optionally, you can turn it on using a schedule for regular testing. +on: + workflow_dispatch: + +permissions: + id-token: write + contents: read + +jobs: + + testterraforme2e: + name: ๐Ÿงช Run Terraform e2e Tests (${{ matrix.cli }} ${{ matrix.version }}) + runs-on: ubuntu-24.04 + env: + MPF_SUBSCRIPTIONID: ${{ secrets.MPF_SUBSCRIPTIONID }} + MPF_TENANTID: ${{ secrets.MPF_TENANTID }} + MPF_SPCLIENTID: ${{ secrets.MPF_SPCLIENTID }} + MPF_SPCLIENTSECRET: ${{ secrets.MPF_SPCLIENTSECRET }} + MPF_SPOBJECTID: ${{ secrets.MPF_SPOBJECTID }} + permissions: + contents: read + pull-requests: write + checks: write + id-token: write + steps: + - name: โคต๏ธ Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: ๐Ÿšง Setup Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + with: + go-version-file: go.mod + cache: true + + - name: ๐Ÿšง Setup Task + uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0 + with: + repo-token: ${{ github.token }} + + - name: ๐Ÿ”€ Download Go dependencies + run: task deps:download + + - name: ๐Ÿ”จ Setup Test tools + run: task test:tools + + - name: ๐Ÿšง Setup Terraform + uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 + with: + terraform_wrapper: false + terraform_version: "1.10.4" + + - name: 'Az CLI login - federated' + uses: azure/login@v1 + with: + client-id: ${{ secrets.AZURE_OID_CLIENT_ID }} + tenant-id: ${{ secrets.MPF_TENANTID }} + subscription-id: ${{ secrets.MPF_SUBSCRIPTIONID }} + + - name: ๐Ÿงช Run Terraform E2E Tests + run: task teste2e:terraform \ No newline at end of file diff --git a/Taskfile.yml b/Taskfile.yml index 2b1f2bd..9c6184e 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -190,8 +190,8 @@ tasks: desc: Run e2e tests for ARM and Bicep cmds: - go clean -testcache - - 'gotestsum --format-hivis --format {{.FORMAT}} --junitfile "testresults.xml" -- ./e2eTests -run TestARM TestBicep -p 1 -timeout 30m -ldflags="{{.LDFLAGS}}" -coverprofile="coverage.out" -covermode atomic' - - task: test:getcover + - 'gotestsum --format-hivis --format {{.FORMAT}} --junitfile "testresults.xml" -- ./e2eTests -run TestARM TestBicep -p 1 -v -timeout 30m -ldflags="{{.LDFLAGS}}" -coverprofile="coverage.out" -covermode atomic' + # - task: test:getcover vars: FORMAT: '{{if eq .GITHUB_ACTIONS "true"}}github-actions{{else}}pkgname-and-test-fails{{end}}' LDFLAGS: "-s -w -X main.version=testAcc"