Skip to content

ignore: release 2.21.4 #55

ignore: release 2.21.4

ignore: release 2.21.4 #55

Workflow file for this run

# Terraform Provider testing workflow.
name: Test
on:
pull_request:
push:
branches: [main]
schedule: # runs tests once a day on the main branch
- cron: "0 0 * * *"
# Testing only needs permissions to read the repository contents.
permissions:
contents: read
jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: "go.mod"
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
generate:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
LAUNCHDARKLY_ACCESS_TOKEN: ${{ secrets.LAUNCHDARKLY_ACCESS_TOKEN }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: "go.mod"
cache: true
# We need the latest version of Terraform for our documentation generation to use
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
with:
terraform_wrapper: false
- run: make generate
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'make generate' command and commit."; exit 1)
# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Acceptance Tests
runs-on: ubuntu-latest
timeout-minutes: 10
env:
TF_ACC: "1"
LAUNCHDARKLY_ACCESS_TOKEN: ${{ secrets.LAUNCHDARKLY_ACCESS_TOKEN }}
strategy:
matrix:
test_case:
- TestAccDataSource
- TestAccAccessToken
- TestAccAuditLogSubscription
- TestAccCustomRole
- TestAccDestination
- TestAccEnvironment
- TestAccFeatureFlag_
- TestAccFeatureFlagEnvironment
- TestAccFlagTrigger
- TestAccMetric
- TestAccProject
- TestAccRelayProxy
- TestAccSegment
- TestAccTeamMember_CreateGeneric
- TestAccTeamMember_UpdateGeneric
- TestAccTeamMember_CreateWithCustomRole
- TestAccTeamMember_UpdateWithCustomRole
- TestAccTeam_
- TestAccTeamRoleMapping_
- TestAccWebhook
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version: "1.21.3"
- run: go mod download
- name: Run Test
run: |
echo "Running test case: ${{ matrix.test_case }}"
TESTARGS="-run ${{ matrix.test_case }}" make testacc-with-retry
check-success:
name: Check Success
needs:
- build
- generate
- test
if: always()
runs-on: ubuntu-latest
steps:
- name: Evaluate results
run: |
if printf '${{ toJSON(needs) }}' | grep --quiet --extended-regexp --ignore-case '"result": "(failure|cancelled)"'; then
printf "Tests failed or workflow cancelled:\n\n${{ toJSON(needs) }}"
exit 1
fi
notify-slack-on-failure:
name: Notify Slack on Failures
if: failure() && github.ref == 'refs/heads/main'
needs:
- build
- generate
- test
runs-on: ubuntu-latest
steps:
- name: Send GitHub trigger payload to Slack Workflow Builder
id: slack
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
payload-delimiter: "_"
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger