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