CI #1487
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
name: CI | |
on: | |
workflow_dispatch: | |
push: | |
paths-ignore: | |
- README.md | |
- CHANGELOG.md | |
- CONTRIBUTING.md | |
schedule: | |
# run CI nightly at 00:11UTC | |
- cron: "11 0 * * *" | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
- name: Build | |
run: go build -v . | |
test: | |
name: Test | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
env: | |
TERRAFORM_VERSION: "1.0.11" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
- name: Setup test environment | |
env: | |
HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }} | |
HONEYCOMB_DATASET: testacc | |
run: ./scripts/setup-testsuite-dataset | |
- name: Run client acceptance tests | |
timeout-minutes: 10 | |
env: | |
HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }} | |
HONEYCOMB_DATASET: testacc | |
run: go test -v -coverprofile=client-coverage.txt -covermode=atomic ./client/... | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: ${{ env.TERRAFORM_VERSION }} | |
terraform_wrapper: false | |
- name: Run TF acceptance tests | |
timeout-minutes: 10 | |
env: | |
HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }} | |
HONEYCOMB_DATASET: testacc | |
TF_ACC: 1 | |
TF_ACC_TERRAFORM_VERSION: ${{ env.TERRAFORM_VERSION }} | |
run: go test -v -coverprofile=tf-coverage.txt -covermode=atomic ./internal/... ./honeycombio/... | |
- name: Generate Coverage Report | |
uses: codecov/codecov-action@v3.1.4 | |
fmt: | |
name: Formatting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
- name: Check formatting | |
run: | | |
# install goimports from another directory to not touch go.mod | |
pushd ../ | |
go install golang.org/x/tools/cmd/goimports@v0.8.0 | |
popd | |
goimports -l -w . | |
if ! git diff --quiet; then | |
echo Running goimports has caused changes, please run go fmt | |
exit 1 | |
fi | |
go mod tidy | |
if ! git diff --quiet; then | |
echo 'go mod tidy' has caused changes, please run go mod tidy | |
exit 1 | |
fi |