Nightly TFE Tests #556
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly TFE Tests | |
on: | |
workflow_dispatch: | |
schedule: | |
# Monday-Friday at 7AM UTC (1 hour after infrastructure rebuild) | |
- cron: '0 7 * * 1-5' | |
jobs: | |
instance: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Build nightly tflocal instance | |
uses: hashicorp-forge/terraform-cloud-action/apply@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0 | |
with: | |
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }} | |
organization: "hashicorp-v2" | |
workspace: tflocal-terraform-provider-tfe-nightly | |
wait: true | |
tests: | |
needs: instance | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
total: [ 5 ] | |
index: [ 0, 1, 2, 3, 4 ] | |
steps: | |
- name: Fetch Outputs | |
id: tflocal | |
uses: hashicorp-forge/terraform-cloud-action/outputs@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0 | |
with: | |
token: "${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}" | |
organization: hashicorp-v2 | |
workspace: tflocal-terraform-provider-tfe-nightly | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: ./.github/actions/test-provider-tfe | |
with: | |
matrix_index: ${{ matrix.index }} | |
matrix_total: ${{ matrix.total }} | |
hostname: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).ngrok_domain }} | |
token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_token }} | |
testing-github-token: ${{ secrets.TESTING_GITHUB_TOKEN }} | |
enterprise: "1" | |
tests-summarize: | |
needs: [tests] | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
steps: | |
- name: Check tests Status | |
run: | | |
if [ "${{ needs.tests.result }}" = "success" ]; then | |
exit 0 | |
fi | |
exit 1 | |
slack-notify: | |
needs: tests-summarize | |
if: always() && (needs.tests-summarize.result == 'failure') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send slack notification on failure | |
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 | |
with: | |
payload: | | |
{ | |
"text": ":x::moon::sob: Nightly TFE tests *FAILED*", | |
"attachments": [ | |
{ | |
"color": "#C41E3A", | |
"blocks": [ | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Workflow:*\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
cleanup: | |
runs-on: ubuntu-latest | |
needs: [tests-summarize] | |
if: "${{ always() }}" | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Go | |
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
cache: true | |
- name: Destroy nightly tflocal instance | |
uses: hashicorp-forge/terraform-cloud-action/destroy@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0 | |
with: | |
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }} | |
organization: "hashicorp-v2" | |
workspace: tflocal-terraform-provider-tfe-nightly | |
wait: true |