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 ./...