# Test — gasm-devkit. Runs on push and pull request to development. name: Test on: push: branches: [development] pull_request: branches: [development] jobs: vet: runs-on: fedora steps: - uses: actions/checkout@v7 - uses: actions/setup-go@v6 with: go-version: "1.27" - name: Download dependencies run: go mod download - name: gofmt run: | set -euo pipefail unformatted=$(gofmt -l .) if [ -n "$unformatted" ]; then echo "These files need gofmt:" echo "$unformatted" exit 1 fi - name: go vet run: go vet ./... test: runs-on: fedora needs: vet steps: - uses: actions/checkout@v7 - uses: actions/setup-go@v6 with: go-version: "1.27" - name: Download dependencies run: go mod download - name: Install gcc run: dnf install -y gcc - name: go test -race run: go test -race -count=1 ./... - name: Coverage gate — 80 % minimum run: | set -euo pipefail # Exclude packages inherently untestable without hardware: # debug — interactive ptrace, requires a live process # cmd/gasm — CLI glue, covered by integration tests go test -coverprofile=coverage.out \ sourcedock.dev/petrbalvin/gasm-devkit/arch \ sourcedock.dev/petrbalvin/gasm-devkit/asm \ sourcedock.dev/petrbalvin/gasm-devkit/ast \ sourcedock.dev/petrbalvin/gasm-devkit/format \ sourcedock.dev/petrbalvin/gasm-devkit/lexer \ sourcedock.dev/petrbalvin/gasm-devkit/lint \ sourcedock.dev/petrbalvin/gasm-devkit/lsp \ sourcedock.dev/petrbalvin/gasm-devkit/parser \ sourcedock.dev/petrbalvin/gasm-devkit/token \ sourcedock.dev/petrbalvin/gasm-devkit/verify coverage=$(go tool cover -func=coverage.out | awk '/^total:/ { gsub("%", "", $3); print $3 }') echo "Total coverage: ${coverage}%" if awk -v c="$coverage" 'BEGIN { exit !(c+0 < 80) }'; then echo "ERROR: coverage ${coverage}% is below the 80% threshold" exit 1 fi build: runs-on: fedora needs: test steps: - uses: actions/checkout@v7 - uses: actions/setup-go@v6 with: go-version: "1.27" - name: Download dependencies run: go mod download - name: Build run: go build -ldflags="-s -w" -o bin/gasm ./cmd/gasm - name: Smoke test run: ./bin/gasm --version