Skip to content

ci: strip security scanners to speed up local builds #6

ci: strip security scanners to speed up local builds

ci: strip security scanners to speed up local builds #6

Workflow file for this run

name: Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
unit-tests:
name: Unit Tests
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
go-version: [ '1.24.x', '1.25.0' ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Run unit tests
run: |
go test -v -race -timeout 10m ./...
shell: bash
- name: Generate coverage report
run: |
go test -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -func=coverage.out > coverage.txt
shell: bash
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-go${{ matrix.go-version }}
path: coverage.*
race-detector:
name: Race Detector
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.0'
cache: true
- name: Run race detector
run: go test -race -timeout 10m ./...
coverage:
name: Coverage Analysis
runs-on: self-hosted
needs: unit-tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.0'
cache: true
- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: coverage-go1.25.0
- name: Report coverage
run: |
if [ -f coverage.out ]; then
COVERAGE=$(go tool cover -func=coverage.out | tail -1 | awk '{print $3}')
echo "Code Coverage: $COVERAGE"
if (( $(echo "$COVERAGE < 50" | bc -l) )); then
echo "⚠ Coverage below 50%"
fi
fi
shell: bash
integration-tests:
name: Integration Tests
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.0'
cache: true
- name: Build test binary
run: go build -o fz ./cmd/fz
- name: Run integration tests
run: |
./fz --version || true
./fz --help > /dev/null || true
shell: bash
benchmarks:
name: Benchmarks
runs-on: self-hosted
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.0'
cache: true
- name: Run benchmarks
run: |
go test -bench=. -benchmem -run=^$ ./... 2>&1 | tee bench.txt || true
shell: bash
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmarks
path: bench.txt
build-verification:
name: Build Verification
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.0'
cache: true
- name: Build all targets
run: |
TARGETS=(
"linux/amd64"
"linux/arm64"
"darwin/amd64"
"darwin/arm64"
"windows/amd64"
)
for target in "${TARGETS[@]}"; do
IFS='/' read -r os arch <<< "$target"
echo "Building $os/$arch..."
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build -o /tmp/fz-build ./cmd/fz
echo "✓ $os/$arch OK"
done
shell: bash