github.com/siglens/siglens@v0.0.0-20240328180423-f7ce9ae441ed/.github/workflows/uts.yml (about)

     1  name: siglens-lint-ut
     2  on: [pull_request]
     3  permissions:
     4    contents: read
     5  jobs:
     6    golang-cicd:
     7      if: '! github.event.pull_request.draft'
     8      name: golang-cicd
     9      runs-on: ubuntu-latest
    10      steps:
    11        - uses: actions/cache@v3
    12          with:
    13            path: |
    14              ~/.cache/go-build
    15              ~/go/pkg/mod
    16            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    17            restore-keys: |
    18              ${{ runner.os }}-go-
    19        - uses: actions/setup-go@v3
    20          with:
    21            go-version: 1.18
    22        - uses: actions/checkout@v3
    23        - name: Check goimports
    24          run: |
    25            go install golang.org/x/tools/cmd/goimports@latest
    26            export PATH=$PATH:$(go env GOPATH)/bin
    27            if [[ -n $(goimports -d .) ]]; then
    28              echo "Go code is not formatted with goimports"
    29              exit 1
    30            fi
    31        - name: Build
    32          run: go build ./...
    33        - name: Run Unit Tests
    34          run: go test ./...
    35        - name: Run Coverage
    36          run: go test ./... -coverprofile=coverage.txt -covermode=atomic
    37        - name: Upload coverage reports to Codecov
    38          uses: codecov/codecov-action@v3
    39          env:
    40             CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}            
    41        - name: golangci-lint
    42          uses: golangci/golangci-lint-action@v3
    43          with:
    44            working-directory: ./
    45            version: latest
    46            skip-pkg-cache: true
    47            skip-build-cache: true