name: CI on: push: branches: [main] pull_request: branches: [main] permissions: contents: read jobs: test: name: Test runs-on: docker container: image: docker.io/library/golang:1.25 steps: - uses: actions/checkout@v4 - name: Run tests run: go test -v -race -count=1 ./... build: name: Build runs-on: docker container: image: docker.io/library/golang:1.25 strategy: matrix: goos: [linux, darwin, windows] goarch: [amd64, arm64] steps: - uses: actions/checkout@v4 - name: Build env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} run: go build -o unarr ./cmd/unarr/ lint: name: Lint runs-on: docker container: image: docker.io/library/golang:1.25 steps: - uses: actions/checkout@v4 - name: Install golangci-lint run: | curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/v2.11.4/install.sh \ | sh -s -- -b /usr/local/bin v2.11.4 - name: Run golangci-lint run: golangci-lint run ./... coverage: name: Coverage runs-on: docker container: image: docker.io/library/golang:1.25 steps: - uses: actions/checkout@v4 - name: Install python3 run: apt-get update && apt-get install -y --no-install-recommends python3 - name: Run tests with coverage (all packages) run: | go test -race -coverprofile=coverage.out -covermode=atomic \ ./internal/engine/... \ ./internal/agent/... \ ./internal/cmd/... - name: Check coverage threshold (engine + agent) run: | # Threshold applies only to engine and agent — cmd contains interactive UI # commands (config menus, daemon, auth browser) that are not unit-testable. go test -race -coverprofile=coverage-core.out -covermode=atomic \ ./internal/engine/... \ ./internal/agent/... COVERAGE=$(go tool cover -func=coverage-core.out | grep ^total | awk '{print $3}' | tr -d '%') echo "Coverage on engine+agent: ${COVERAGE}%" python3 -c " coverage = float('${COVERAGE}') threshold = 50.0 print(f'Coverage: {coverage:.1f}% (threshold: {threshold}%)') if coverage < threshold: print(f'ERROR: Coverage {coverage:.1f}% is below minimum {threshold}%') exit(1) else: print('OK: Coverage meets minimum threshold') " vet: name: Vet runs-on: docker container: image: docker.io/library/golang:1.25 steps: - uses: actions/checkout@v4 - name: Run go vet run: go vet ./...