terraform-provider-stackitp.../.github/workflows/tf-acc-test.yaml
Marcel S. Henselin b06e7ffd40 chore: add tests
[skip ci]
2026-03-25 16:53:23 +01:00

100 lines
3.9 KiB
YAML

name: TF Acceptance Tests Workflow
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- alpha
- main
push:
branches:
- master
workflow_dispatch:
inputs:
enable_debug:
description: "enable terraform debug logs"
type: boolean
default: false
required: true
test_timeout_string:
description: "string that determines the timeout (default: 45m)"
type: string
default: '90m'
required: true
jobs:
acc_test:
name: Acceptance Tests
runs-on: stackit-docker
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Notify Google Chat
if: ${{ always() }} # Use always to ensure that the notification is also send on failure of former steps
uses: SimonScholz/google-chat-action@main
with:
webhookUrl: '${{ secrets.GOOGLE_WEBHOOK_URL }}'
title: Acceptance Tests started
subtitle: "${{ github.event_name }}"
- name: Notify
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: Terraform Acceptance Tests started
event_title: ${{ github.event.type }}
event_author: ${{ github.event.actor.login }}
event_body: 'No event body.'
event_number: ${{ github.event.id }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ github.run_id }}"
- name: Run Test (workflow dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: ./.github/actions/acc_test
with:
go-version: ${{ env.GO_VERSION }}
project_id: ${{ vars.TF_ACC_PROJECT_ID }}
region: 'eu01'
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
project_user_email: ${{ vars.TEST_PROJECT_USER_EMAIL }}
tf_acc_kek_key_id: ${{ vars.TF_ACC_KEK_KEY_ID }}
tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }}
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
tf_debug: ${{ inputs.enable_debug }}
test_timeout_string: ${{ inputs.test_timeout_string }}
- name: Run Test (automatic)
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: ./.github/actions/acc_test
with:
go-version: ${{ env.GO_VERSION }}
project_id: ${{ vars.TF_ACC_PROJECT_ID }}
region: 'eu01'
service_account_json_content_b64: "${{ secrets.TF_ACC_SERVICE_ACCOUNT_JSON_B64 }}"
project_user_email: ${{ vars.TEST_PROJECT_USER_EMAIL }}
tf_acc_kek_key_id: ${{ vars.TF_ACC_KEK_KEY_ID }}
tf_acc_kek_key_ring_id: ${{ vars.TF_ACC_KEK_KEY_RING_ID }}
tf_acc_kek_key_version: ${{ vars.TF_ACC_KEK_KEY_VERSION }}
tf_acc_kek_service_account: ${{ vars.TF_ACC_KEK_SERVICE_ACCOUNT }}
- name: Notify Google Chat
if: ${{ always() }} # Use always to ensure that the notification is also send on failure of former steps
uses: SimonScholz/google-chat-action@main
with:
webhookUrl: '${{ secrets.GOOGLE_WEBHOOK_URL }}'
jobStatus: '${{ job.status }}'
title: Acceptance Tests started
subtitle: "${{ github.event_name }} finished"
- name: Notify
uses: ./.github/actions/notify
with:
webhook_url: ${{ secrets.GOOGLE_WEBHOOK_URL }}
title: Terraform Acceptance Tests finished
event_title: ${{ github.event.type }}
event_author: ${{ github.event.actor.login }}
event_body: 'No event body.'
event_number: ${{ github.event.id }}
event_url: "https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/actions/runs/${{ github.run_id }}"