|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + # ------------------------------------------------------------ |
| 9 | + # Main build job |
| 10 | + # ------------------------------------------------------------ |
| 11 | + build: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + container: wpilib/roborio-cross-ubuntu:2024-22.04 |
| 14 | + if: ${{ github.event_name != 'pull_request' || github.event.pull_request == null }} |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@v6 |
| 19 | + |
| 20 | + - name: Mark repo as safe for git |
| 21 | + run: git config --global --add safe.directory $GITHUB_WORKSPACE |
| 22 | + |
| 23 | + - name: Grant execute permission for gradlew |
| 24 | + run: chmod +x gradlew |
| 25 | + |
| 26 | + - name: Set up Gradle cache |
| 27 | + uses: gradle/actions/setup-gradle@v4 |
| 28 | + |
| 29 | + - name: Build robot code |
| 30 | + run: ./gradlew build --no-daemon --parallel --build-cache |
| 31 | + |
| 32 | + # ------------------------------------------------------------ |
| 33 | + # Spotless job (separate for branch protection) |
| 34 | + # ------------------------------------------------------------ |
| 35 | + spotless: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + container: wpilib/roborio-cross-ubuntu:2024-22.04 |
| 38 | + # Only run for PRs or pushes targeting main/develop |
| 39 | + if: github.base_ref == 'main' || github.base_ref == 'develop' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' |
| 40 | + steps: |
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@v6 |
| 43 | + |
| 44 | + - name: Grant execute permission for gradlew |
| 45 | + run: chmod +x gradlew |
| 46 | + |
| 47 | + - name: Set up Gradle cache |
| 48 | + uses: gradle/actions/setup-gradle@v4 |
| 49 | + |
| 50 | + - name: Run Spotless check |
| 51 | + run: ./gradlew spotlessCheck --no-daemon --parallel --build-cache |
0 commit comments