Nightly TFE Tests #616
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 7:30AM UTC (90 minutes after infrastructure rebuild) | |
- cron: '30 7 * * 1-5' | |
jobs: | |
instance: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: terraform-cloud/apply | |
uses: hashicorp-forge/terraform-cloud-action/apply@5583d5f554d268ac91b3c37fd0a5e9da2c78c017 # v1.1.0 | |
with: | |
organization: hashicorp-v2 | |
workspace: tflocal-go-tfe-nightly | |
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }} | |
wait: true | |
tests: | |
needs: instance | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
total: [ 1 ] | |
index: [ 0 ] | |
steps: | |
- name: terraform-cloud/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-go-tfe-nightly | |
- name: Checkout code | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- uses: ./.github/actions/test-go-tfe | |
with: | |
matrix_index: ${{ matrix.index }} | |
matrix_total: ${{ matrix.total }} | |
address: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_address }} | |
token: ${{ fromJSON(steps.tflocal.outputs.workspace-outputs-json).tfe_token }} | |
oauth-client-github-token: ${{ secrets.OAUTH_CLIENT_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 ] | |
if: ${{ needs.tests.result == 'failure' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send slack notification on failure | |
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # v1.23.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: | |
- name: terraform-cloud/destroy | |
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-go-tfe-nightly |