feat: add acceptance tests #200
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
on: [pull_request] | |
jobs: | |
goreleaser: | |
name: "Release" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v3 | |
with: | |
version: latest | |
args: build --snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run go generate | |
run: go generate | |
- name: Check differences after go generate | |
run: | | |
git diff --compact-summary --exit-code || \ | |
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate' command and commit."; exit 1) | |
acceptance: | |
name: Acceptance Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: '1.5.*' | |
terraform_wrapper: false | |
- run: | | |
if [ -z "${{ secrets.TE_TOKEN }}" ]; then | |
echo "TE_TOKEN is not set. Please configure the TE_TOKEN secret in your repository." | |
fi | |
if [ -z "${{ secrets.TE_AID }}" ]; then | |
echo "TE_AID is not set. Please configure the TE_AID secret in your repository." | |
fi | |
echo "TE_TOKEN: ${TE_TOKEN}" | |
echo "TE_AID: ${TE_AID}" | |
go test -v -cover ./... | |
env: | |
TE_TOKEN: ${{ secrets.TE_TOKEN }} | |
TE_AID: ${{ secrets.TE_AID }} | |
TE_API_ENDPOINT: 'https://api.stg.thousandeyes.com/v6' | |
TF_ACC: '1' | |
unit: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- run: go test -v -cover ./... |