diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml new file mode 100644 index 000000000..4f37f26b7 --- /dev/null +++ b/.github/workflows/go-test.yml @@ -0,0 +1,21 @@ +name: Go + +on: + push: + branches: [main] + pull_requests: + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + cache: true + go-version-file: go.mod + - name: Test with race detector + run: make test-race diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index a75673db3..000000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: Go - -on: - push: - branches: [main] - pull_request: - branches: ["*"] - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.21" - id: go - - name: Check out code into the Go module directory - uses: actions/checkout@v3 - - name: Get dependencies - run: | - go get -v -t -d ./... - - name: Build - run: go build -v ./... - - formatting: - name: Formatting - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Go mod tidy checker - uses: Jerome1337/gofmt-action@v1.0.5 - with: - gofmt-path: "./src" - gofmt-flags: "-l -d" - - mod_tidier: - runs-on: ubuntu-latest - name: Clean up mismatched go.sum files - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.head_ref }} - - uses: actions/setup-go@v4 - with: - go-version: "^1.14.0" - - uses: evantorrie/mott-the-tidier@v1-beta - with: - gomods: | - **/go.mod - -tools/go.mod - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Auto-fix go.sum discrepancies - - test: - name: Test - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Go - uses: actions/setup-go@v4 - with: - cache: true - go-version-file: go.mod - - name: Build - run: make build - - name: Test with race detector (Ubuntu and MacOS) - run: make test-race - - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Setup Go 1.21 - uses: actions/setup-go@v4 - with: - go-version: "1.21" - id: go - cache: false - go-version-file: go.mod - - name: GolangCI-Lint - uses: golangci/golangci-lint-action@v3 - with: - skip-cache: false - version: v1.55.2 - args: --config=.golangci.yml --out-${NO_FUTURE}format colored-line-number - - name: go mod tidy check - uses: katexochen/go-tidy-check@v2 - - gosec: - name: Gosec scan - runs-on: ubuntu-latest - env: - GO111MODULE: on - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Go 1.21 - uses: actions/setup-go@v4 - with: - go-version: "1.21" - - name: Run Gosec Security Scanner - run: | # https://github.com/securego/gosec/issues/469 - export PATH=$PATH:$(go env GOPATH)/bin - go install github.com/securego/gosec/v2/cmd/gosec@v2.15.0 - gosec -exclude-generated ./...