Acceptance Tests #238
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: Acceptance Tests | |
on: | |
schedule: | |
- cron: "0 13 * * *" | |
push: {} | |
pull_request: | |
types: [opened, synchronized, reopened] | |
# Testing only needs permissions to read the repository contents. | |
permissions: | |
contents: read | |
env: | |
METAL_STACK_CLOUD_API_TOKEN: ${{ secrets.METAL_STACK_CLOUD_API_TOKEN }} | |
jobs: | |
metal: | |
name: Acceptance Test | |
runs-on: ubuntu-latest | |
timeout-minutes: 35 | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- uses: hashicorp/setup-terraform@v3 | |
- name: Init project | |
run: terraform init | |
- name: Create cluster and get kubeconfig | |
run: terraform apply -target local_sensitive_file.kubeconfig --auto-approve | |
- name: Deploy service into cluster | |
run: terraform apply --auto-approve | |
# # TODO: eventually run some tests here in the future | |
# # this would require to extract the domain and make a call to it | |
- name: Destroy service | |
run: terraform destroy -target module.metal-app --auto-approve | |
- name: Destroy Cluster | |
if: always() | |
run: terraform destroy --auto-approve | |
- name: Post failure to Slack | |
id: slack | |
uses: slackapi/slack-github-action@v1.25.0 | |
if: failure() | |
with: | |
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | |
slack-message: "\nAction: ${{ env.GITHUB_SERVER_URL }}/${{ env.GITHUB_REPOSITORY }}/actions/runs/${{ env.GITHUB_RUN_ID }}" | |
payload: | | |
{ | |
"text": "@here Integration Test: test cluster creation failed!\nAction: ${{ job.status }} ${{env.GITHUB_SERVER_URL}}/${{env.GITHUB_REPOSITORY}}/actions/runs/${{env.GITHUB_RUN_ID}}.", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "@here Integration Test: test cluster creation failed!" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Action:* ${{ job.status }} ${{env.GITHUB_SERVER_URL}}/${{env.GITHUB_REPOSITORY}}/actions/runs/${{env.GITHUB_RUN_ID}}." | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |