diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index f5c03ed..9355656 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,30 +2,40 @@ name: Go on: push: - branches: [ master ] + branches: [ "**" ] pull_request: - branches: [ master ] + branches: [ "**" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + pull-requests: read + checks: write + jobs: build: strategy: matrix: go-versions: [1.16.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x] + runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 - - name: Set up Go - uses: actions/setup-go@v2 + - uses: actions/checkout@v4 + + - name: Setup go + uses: actions/setup-go@v5 with: go-version: ${{ matrix.go-versions }} - - name: Install - run: GO111MODULE=off go get golang.org/x/lint/golint - - name: Run gofmt - run: diff -u <(echo -n) <(gofmt -d *.go) - - name: Run golint - run: diff -u <(echo -n) <(golint $(go list -e ./... | grep -v /goyaml) | grep -v YAMLToJSON) - - name: Run go vet - run: GO111MODULE=on go vet . + cache: false + + - name: lint + uses: golangci/golangci-lint-action@v5 + with: + version: latest + - name: Run go test run: GO111MODULE=on go test -v -race ./... - - name: Check diff - run: git diff --exit-code