fix: triggers snosi on tagged releases #186
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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.24" | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: latest | |
| # security: | |
| # name: Security Scan | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: Checkout code | |
| # uses: actions/checkout@v6 | |
| # - name: Set up Go | |
| # uses: actions/setup-go@v6 | |
| # with: | |
| # go-version: "1.24" | |
| # - name: Install govulncheck | |
| # run: go install golang.org/x/vuln/cmd/govulncheck@latest | |
| # - name: Run govulncheck | |
| # run: govulncheck ./... | |
| unit-test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.24" | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run unit tests with coverage | |
| run: go test -v ./pkg/... -coverprofile=coverage.out -covermode=atomic -run "^Test[^I]" -skip "Integration" | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.out | |
| fail_ci_if_error: false | |
| verbose: true | |
| continue-on-error: true | |
| race-test: | |
| name: Race Detection | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.24" | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Run tests with race detector | |
| run: go test -race -short ./pkg/... -run "^Test[^I]" -skip "Integration" | |
| verify: | |
| name: Verify | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.24" | |
| - name: Verify go.mod is tidy | |
| run: | | |
| go mod tidy | |
| git diff --exit-code go.mod go.sum | |
| - name: Run go vet | |
| run: go vet ./... | |
| - name: Check formatting | |
| run: | | |
| gofmt -l . | |
| test -z "$(gofmt -l .)" | |
| docker: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: false | |
| tags: nbc:test | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| goos: [linux] | |
| goarch: [amd64, arm64] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: "1.24" | |
| - name: Build binary | |
| run: | | |
| GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} make build | |
| ls -lh nbc | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: nbc-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: nbc | |
| retention-days: 7 | |
| integration-test: | |
| name: Integration Tests (Info Only) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Note about integration tests | |
| run: | | |
| echo "⚠️ Integration tests require root privileges and loop device support." | |
| echo "These tests cannot run in standard GitHub Actions runners." | |
| echo "" | |
| echo "To run integration tests locally:" | |
| echo " sudo make test-integration" | |
| echo " sudo make test-install" | |
| echo " sudo make test-update" | |
| echo "" | |
| echo "These tests create loop devices, partition them, and perform full" | |
| echo "system installations and updates." |