diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index b9078b0..004692e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -1,28 +1,41 @@ name: Go -on: [push] -jobs: +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: build: - name: Build + name: Build and Test runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + cache: true + + - name: Download dependencies + run: go mod download + + - name: Verify dependencies + run: go mod verify + + - name: Run tests + run: go test -v -race -coverprofile=coverage.out ./... - - name: Set up Go 1.14 - uses: actions/setup-go@v1 + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 with: - go-version: 1.14 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v1 - - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi - - - name: Build - run: go build -v . + file: ./coverage.out + flags: unittests + name: codecov-umbrella + if: github.event_name == 'push' && github.ref == 'refs/heads/master'