From 38e52924a76a8346268f50f45febebada962264d Mon Sep 17 00:00:00 2001 From: pputman-clabs Date: Mon, 9 Jan 2023 07:37:33 -0600 Subject: [PATCH] adding workflow --- .github/workflows/go-tests.yaml | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/go-tests.yaml diff --git a/.github/workflows/go-tests.yaml b/.github/workflows/go-tests.yaml new file mode 100644 index 0000000..78465ea --- /dev/null +++ b/.github/workflows/go-tests.yaml @@ -0,0 +1,59 @@ +--- +name: 'Run Go Tests' +on: + push: + pull_request: + workflow_dispatch: + +env: + GO_VERSION: 1.19.4 + GO_WORKING_DIRECTORY: '.' + TEST_FILE: mockokta_test.go + +jobs: + go-tests: + runs-on: ubuntu-latest + permissions: # Must change the job token permissions to use JWT auth + contents: read + id-token: write + + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Verify dependencies + working-directory: ${{ env.GO_WORKING_DIRECTORY }} + run: go mod verify + + - name: Build + working-directory: ${{ env.GO_WORKING_DIRECTORY }} + run: go build -v ./... + + - name: Run go vet + working-directory: ${{ env.GO_WORKING_DIRECTORY }} + run: go vet ./... + + - name: Install staticcheck + working-directory: ${{ env.GO_WORKING_DIRECTORY }} + run: go install honnef.co/go/tools/cmd/staticcheck@latest + + - name: Run staticcheck + working-directory: ${{ env.GO_WORKING_DIRECTORY }} + run: staticcheck ./... + + - name: Install golint + working-directory: ${{ env.GO_WORKING_DIRECTORY }} + run: go install golang.org/x/lint/golint@latest + + - name: Run golint + working-directory: ${{ env.GO_WORKING_DIRECTORY }} + run: golint ./... + + - name: Run tests + working-directory: ${{ env.GO_WORKING_DIRECTORY }} + run: go test -race -vet=off -v ./... +