name: Acceptance Testing description: "Acceptance Testing pipeline" inputs: go-version: description: "go version to install" default: '1.25' required: true project_id: description: "STACKIT project ID for tests" required: true project_user_email: required: true description: "project user email for acc testing" tf_acc_kek_key_id: description: "KEK key ID" required: true tf_acc_kek_key_ring_id: description: "KEK key ring ID" required: true tf_acc_kek_key_version: description: "KEK key version" required: true tf_acc_kek_service_account: description: "KEK service account email" required: true region: description: "STACKIT region for tests" default: 'eu01' required: true service_account_json: description: "STACKIT service account JSON file contents" required: true default: "" service_account_json_file_path: description: "STACKIT service account JSON file contents" required: true default: '~/.stackit/credentials.json' test_file: description: "testfile to run" default: '' outputs: random-number: description: "Random number" value: ${{ steps.random-number-generator.outputs.random-number }} runs: using: "composite" steps: - name: Random Number Generator id: random-number-generator run: echo "random-number=$(echo $RANDOM)" >> $GITHUB_OUTPUT shell: bash - name: Install needed tools shell: bash run: | set -e apt-get -y -qq update apt-get -y -qq install jq python3 python3-pip python-is-python3 s3cmd git make wget - name: Setup JAVA uses: actions/setup-java@v5 with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '21' - name: Install Go ${{ inputs.go-version }} uses: actions/setup-go@v6 with: # go-version: ${{ inputs.go-version }} check-latest: true go-version-file: 'go.mod' - name: Install go tools shell: bash run: | set -e go mod download go install golang.org/x/tools/cmd/goimports@latest go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.7.2 go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@v0.24.0 # - name: Prepare pkg_gen directory # shell: bash # run: | # go run generator/main.go build -p - name: Run go mod tidy shell: bash run: go mod tidy - name: Ensure service account file exists shell: bash run: | set -e if [[ ! -f "${{ inputs.service_account_json_file_path }}" ]]; then echo "unable to find service account file" exit 1 fi cat "${{ inputs.service_account_json_file_path }}" - name: Run acceptance test file if: ${{ inputs.test_file != '' }} shell: bash run: | echo "Running acceptance tests for the terraform provider" cd stackit TF_ACC=1 \ TF_ACC_PROJECT_ID=${TF_ACC_PROJECT_ID} \ TF_ACC_REGION=${TF_ACC_REGION} \ TF_ACC_TEST_PROJECT_USER_EMAIL=${TF_ACC_TEST_PROJECT_USER_EMAIL} \ TF_ACC_KEK_KEY_ID=${TF_ACC_KEK_KEY_ID} \ TF_ACC_KEK_KEY_RING_ID=${TF_ACC_KEK_KEY_RING_ID} \ TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \ TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \ go test ${{ inputs.test_file }} -count=1 -timeout=30m env: STACKIT_SERVICE_ACCOUNT_JSON: ${{ inputs.service_account_json }} TF_PROJECT_ID: ${{ inputs.project_id }} TF_ACC_REGION: ${{ inputs.region }} TF_ACC_TEST_PROJECT_USER_EMAIL: ${{ inputs.project_user_email }} TF_ACC_KEK_KEY_ID: ${{ inputs.tf_acc_kek_key_id }} TF_ACC_KEK_KEY_RING_ID: ${{ inputs.tf_acc_kek_key_ring_id }} TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }} TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }} - name: Run acceptance tests if: ${{ inputs.test_file == '' }} shell: bash run: | echo "Running acceptance tests for the terraform provider" cd stackit TF_ACC=1 \ TF_ACC_PROJECT_ID=${TF_ACC_PROJECT_ID} \ TF_ACC_REGION=${TF_ACC_REGION} \ TF_ACC_TEST_PROJECT_USER_EMAIL=${TF_ACC_TEST_PROJECT_USER_EMAIL} \ TF_ACC_KEK_KEY_ID=${TF_ACC_KEK_KEY_ID} \ TF_ACC_KEK_KEY_RING_ID=${TF_ACC_KEK_KEY_RING_ID} \ TF_ACC_KEK_KEY_VERSION=${TF_ACC_KEK_KEY_VERSION} \ TF_ACC_KEK_SERVICE_ACCOUNT=${TF_ACC_KEK_SERVICE_ACCOUNT} \ go test ./... -count=1 -timeout=30m env: STACKIT_SERVICE_ACCOUNT_JSON: ${{ inputs.service_account_json }} TF_PROJECT_ID: ${{ inputs.project_id }} TF_ACC_REGION: ${{ inputs.region }} TF_ACC_TEST_PROJECT_USER_EMAIL: ${{ inputs.project_user_email }} TF_ACC_KEK_KEY_ID: ${{ inputs.tf_acc_kek_key_id }} TF_ACC_KEK_KEY_RING_ID: ${{ inputs.tf_acc_kek_key_ring_id }} TF_ACC_KEK_KEY_VERSION: ${{ inputs.tf_acc_kek_key_version }} TF_ACC_KEK_SERVICE_ACCOUNT: ${{ inputs.tf_acc_kek_service_account }}