test.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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@v2
  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. steps:
  46. - uses: actions/setup-go@v2
  47. with:
  48. go-version: ${{ env.GO_VERSION }}
  49. - uses: hashicorp/setup-terraform@v1
  50. with:
  51. go-version: ${{ matrix.terraform }}
  52. - uses: actions/checkout@v2
  53. - run: go mod download
  54. - env:
  55. TF_ACC: "1"
  56. run: go test -v -cover ./internal/provider/
  57. timeout-minutes: 10