From 7088015c551d47d65134764cf92eca13abf7f86e Mon Sep 17 00:00:00 2001 From: connerdouglass Date: Fri, 28 Jun 2024 10:11:54 -0400 Subject: [PATCH] chore(gha): add automated tests for pull request --- .github/workflows/test.yml | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..b1d9ebf --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: Test +on: + pull_request: + workflow_dispatch: + push: + branches: + - master +jobs: + checks: + name: Workspace Checks + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - name: Lint + run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi + + - name: Tidy + run: | + go mod tidy + if [[ -n $(git status -s) ]]; then exit 1; fi + + test: + name: Build and Test + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + + - name: Vet + run: go vet ./... + + - name: Test + run: go test ./...