test.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # Terraform Provider testing workflow.
  2. name: Tests
  3. # This GitHub action runs your tests for each pull request and push.
  4. # Optionally, you can turn it on using a schedule for regular testing.
  5. on:
  6. pull_request:
  7. paths-ignore:
  8. - 'README.md'
  9. push:
  10. paths-ignore:
  11. - 'README.md'
  12. # Testing only needs permissions to read the repository contents.
  13. permissions:
  14. contents: read
  15. # Default values to simplify job configurations below.
  16. env:
  17. # Go language version to use for building. This value should also be updated
  18. # in the release workflow if changed.
  19. GO_VERSION: '1.17'
  20. jobs:
  21. # Ensure project builds before running testing matrix
  22. build:
  23. name: Build
  24. runs-on: ubuntu-latest
  25. timeout-minutes: 5
  26. steps:
  27. - uses: actions/setup-go@v2
  28. with:
  29. go-version: ${{ env.GO_VERSION }}
  30. - uses: actions/checkout@v3
  31. - run: go mod download
  32. - run: go build -v .
  33. # Run acceptance tests in a matrix with Terraform CLI versions
  34. test:
  35. name: Terraform Provider Acceptance Tests
  36. needs: build
  37. runs-on: ubuntu-latest
  38. timeout-minutes: 15
  39. strategy:
  40. fail-fast: false
  41. matrix:
  42. # list whatever Terraform versions here you would like to support
  43. terraform:
  44. - '1.0.*'
  45. - '1.1.*'
  46. steps:
  47. - uses: actions/setup-go@v2
  48. with:
  49. go-version: ${{ env.GO_VERSION }}
  50. - uses: hashicorp/setup-terraform@v1
  51. with:
  52. terraform_version: ${{ matrix.terraform }}
  53. terraform_wrapper: false
  54. - uses: actions/checkout@v3
  55. - run: go mod download
  56. - env:
  57. TF_ACC: "1"
  58. run: go test -v -cover ./internal/provider/
  59. timeout-minutes: 10