multiple updates (#2) #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - dev | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| BINARY_NAME: ipvsctl | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: 1.24 | |
| - name: Cache Go modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.cache/go-build | |
| ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Install dependencies | |
| run: | | |
| go install honnef.co/go/tools/cmd/[email protected] | |
| go install golang.org/x/lint/[email protected] | |
| go mod download | |
| echo "$HOME/go/bin" >> $GITHUB_PATH | |
| - name: Run staticcheck | |
| run: | | |
| echo "::group::Running staticcheck" | |
| staticcheck ./... || true | |
| echo "::endgroup::" | |
| - name: Run golint | |
| run: | | |
| echo "::group::Running lint" | |
| golint ./... | |
| echo "::endgroup::" | |
| - name: Run go vet | |
| run: | | |
| echo "::group::Running go vet" | |
| go vet ./... | |
| echo "::endgroup::" | |
| - name: Build | |
| run: GOOS=linux go build -o dist/${BINARY_NAME} ipvsctl.go | |
| - name: Run tests | |
| run: | | |
| SKIP_IPVSKERNELREQ=1 go test -v -coverprofile=coverage.out ./... | |
| go tool cover -html=coverage.out -o coverage.html | |
| - name: Upload HTML coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage.html |