|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, develop] |
| 6 | + pull_request: |
| 7 | + branches: [main, develop] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + test: |
| 14 | + name: Test |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - uses: actions/setup-go@v5 |
| 20 | + with: |
| 21 | + go-version: "1.25" |
| 22 | + |
| 23 | + - name: Verify dependencies |
| 24 | + run: | |
| 25 | + cd forge-core && go mod verify |
| 26 | + cd ../forge-cli && go mod verify |
| 27 | + cd ../forge-plugins && go mod verify |
| 28 | +
|
| 29 | + - name: Vet |
| 30 | + run: go vet ./forge-core/... ./forge-cli/... ./forge-plugins/... |
| 31 | + |
| 32 | + - name: Check formatting |
| 33 | + run: test -z "$(gofmt -l forge-core forge-cli forge-plugins)" |
| 34 | + |
| 35 | + - name: Test |
| 36 | + run: go test -race -coverprofile=coverage.out ./forge-core/... ./forge-cli/... ./forge-plugins/... |
| 37 | + |
| 38 | + - name: Check coverage threshold |
| 39 | + run: | |
| 40 | + COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | tr -d '%') |
| 41 | + echo "Total coverage: ${COVERAGE}%" |
| 42 | + if (( $(echo "$COVERAGE < 70" | bc -l) )); then |
| 43 | + echo "::warning::Coverage ${COVERAGE}% is below 70% threshold" |
| 44 | + fi |
| 45 | +
|
| 46 | + - name: Upload coverage |
| 47 | + uses: actions/upload-artifact@v4 |
| 48 | + with: |
| 49 | + name: coverage |
| 50 | + path: coverage.out |
| 51 | + |
| 52 | + lint: |
| 53 | + name: Lint |
| 54 | + runs-on: ubuntu-latest |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - uses: actions/setup-go@v5 |
| 59 | + with: |
| 60 | + go-version: "1.25" |
| 61 | + |
| 62 | + - uses: golangci/golangci-lint-action@v7 |
| 63 | + with: |
| 64 | + version: v2.10.1 |
| 65 | + args: ./forge-core/... ./forge-cli/... ./forge-plugins/... |
| 66 | + |
| 67 | + integration: |
| 68 | + name: Integration Tests |
| 69 | + runs-on: ubuntu-latest |
| 70 | + needs: test |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v4 |
| 73 | + |
| 74 | + - uses: actions/setup-go@v5 |
| 75 | + with: |
| 76 | + go-version: "1.25" |
| 77 | + |
| 78 | + - name: Integration tests |
| 79 | + run: go test -race -tags=integration ./forge-core/... ./forge-cli/... ./forge-plugins/... |
| 80 | + |
| 81 | + build: |
| 82 | + name: Build (${{ matrix.goos }}/${{ matrix.goarch }}) |
| 83 | + runs-on: ubuntu-latest |
| 84 | + needs: [test, lint] |
| 85 | + strategy: |
| 86 | + matrix: |
| 87 | + include: |
| 88 | + - goos: linux |
| 89 | + goarch: amd64 |
| 90 | + - goos: linux |
| 91 | + goarch: arm64 |
| 92 | + - goos: darwin |
| 93 | + goarch: amd64 |
| 94 | + - goos: darwin |
| 95 | + goarch: arm64 |
| 96 | + - goos: windows |
| 97 | + goarch: amd64 |
| 98 | + - goos: windows |
| 99 | + goarch: arm64 |
| 100 | + steps: |
| 101 | + - uses: actions/checkout@v4 |
| 102 | + |
| 103 | + - uses: actions/setup-go@v5 |
| 104 | + with: |
| 105 | + go-version: "1.25" |
| 106 | + |
| 107 | + - name: Build |
| 108 | + env: |
| 109 | + GOOS: ${{ matrix.goos }} |
| 110 | + GOARCH: ${{ matrix.goarch }} |
| 111 | + CGO_ENABLED: "0" |
| 112 | + run: cd forge-cli && go build -ldflags "-s -w" -o ../forge-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/forge |
0 commit comments