Skip to content

Nightly TFE Tests

Nightly TFE Tests #457

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@4adbe7eea886138ac10a4c09e63c5c568aaa6672 # main
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: [ 1 ]
index: [ 0 ]
steps:
- name: Fetch Outputs
id: tflocal
uses: hashicorp-forge/terraform-cloud-action/outputs@4adbe7eea886138ac10a4c09e63c5c568aaa6672 # main
with:
token: "${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}"
organization: hashicorp-v2
workspace: tflocal-terraform-provider-tfe-nightly
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- 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@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: go.mod
check-latest: true
cache: true
- name: Destroy nightly tflocal instance
uses: hashicorp-forge/terraform-cloud-action/destroy@4adbe7eea886138ac10a4c09e63c5c568aaa6672 # main
with:
token: ${{ secrets.TF_WORKFLOW_TFLOCAL_CLOUD_TFC_TOKEN }}
organization: "hashicorp-v2"
workspace: tflocal-terraform-provider-tfe-nightly
wait: true
is-destroy: true