|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - '*' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + |
| 13 | +env: |
| 14 | + GO_VERSION: 1.25.x |
| 15 | + CGO_ENABLED: 1 |
| 16 | + CR_BUILD_ARTIFACTS_DIR: dist |
| 17 | + |
| 18 | +jobs: |
| 19 | + lint: |
| 20 | + name: Lint |
| 21 | + runs-on: ubuntu-latest |
| 22 | + |
| 23 | + steps: |
| 24 | + - name: Checkout repository |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Set up Go |
| 28 | + uses: actions/setup-go@v5 |
| 29 | + with: |
| 30 | + go-version: ${{ env.GO_VERSION }} |
| 31 | + |
| 32 | + - name: Run golangci-lint |
| 33 | + uses: golangci/golangci-lint-action@v8.0.0 |
| 34 | + |
| 35 | + - name: Run prettier |
| 36 | + uses: creyD/prettier_action@v4.6 |
| 37 | + with: |
| 38 | + prettier_options: --check frontend/ |
| 39 | + |
| 40 | + test: |
| 41 | + name: Test |
| 42 | + runs-on: ubuntu-latest |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout repository |
| 46 | + uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - name: Set up Go |
| 49 | + uses: actions/setup-go@v5 |
| 50 | + with: |
| 51 | + go-version: ${{ env.GO_VERSION }} |
| 52 | + |
| 53 | + - name: Run tests |
| 54 | + run: make test-ci |
| 55 | + |
| 56 | + release: |
| 57 | + name: Build ${{ matrix.goos }}-${{ matrix.goarch }} |
| 58 | + runs-on: ${{ matrix.os }} |
| 59 | + if: startsWith(github.ref, 'refs/tags/') |
| 60 | + |
| 61 | + needs: |
| 62 | + - lint |
| 63 | + - test |
| 64 | + |
| 65 | + permissions: |
| 66 | + contents: write |
| 67 | + |
| 68 | + strategy: |
| 69 | + matrix: |
| 70 | + include: |
| 71 | + - goos: linux |
| 72 | + goarch: amd64 |
| 73 | + os: ubuntu-latest |
| 74 | + |
| 75 | + - goos: linux |
| 76 | + goarch: arm64 |
| 77 | + os: ubuntu-latest |
| 78 | + |
| 79 | + - goos: darwin |
| 80 | + goarch: amd64 |
| 81 | + os: macos-latest |
| 82 | + |
| 83 | + - goos: darwin |
| 84 | + goarch: arm64 |
| 85 | + os: macos-latest |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: Checkout code |
| 89 | + uses: actions/checkout@v4 |
| 90 | + |
| 91 | + - name: Set up Go |
| 92 | + uses: actions/setup-go@v5 |
| 93 | + with: |
| 94 | + go-version: ${{ env.GO_VERSION }} |
| 95 | + |
| 96 | + - name: Install dependencies (Linux) |
| 97 | + if: matrix.goos == 'linux' |
| 98 | + run: | |
| 99 | + sudo apt-get update |
| 100 | + sudo apt-get install -y gcc-aarch64-linux-gnu |
| 101 | +
|
| 102 | + - name: Build |
| 103 | + env: |
| 104 | + GOOS: ${{ matrix.goos }} |
| 105 | + GOARCH: ${{ matrix.goarch }} |
| 106 | + CC: ${{ matrix.goos == 'linux' && matrix.goarch == 'arm64' && 'aarch64-linux-gnu-gcc' || 'gcc' }} |
| 107 | + CR_EXECUTABLE_FILENAME: claude-review-${{ matrix.goos }}-${{ matrix.goarch }} |
| 108 | + run: make build |
| 109 | + |
| 110 | + - name: Build assets |
| 111 | + if: matrix.goos == 'linux' && matrix.goarch == 'amd64' |
| 112 | + run: make assets |
| 113 | + |
| 114 | + - name: Create GitHub Release |
| 115 | + uses: softprops/action-gh-release@v1 |
| 116 | + with: |
| 117 | + files: | |
| 118 | + ./dist/claude-review-${{ matrix.goos }}-${{ matrix.goarch }} |
| 119 | + ${{ matrix.goos == 'linux' && matrix.goarch == 'amd64' && './dist/frontend-assets.tar.gz' || '' }} |
| 120 | + generate_release_notes: true |
0 commit comments