-
Notifications
You must be signed in to change notification settings - Fork 1
93 lines (76 loc) · 2.49 KB
/
ci.yml
File metadata and controls
93 lines (76 loc) · 2.49 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: ci
on:
push:
branches:
- main
- "release/**"
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.sha }}
cancel-in-progress: true
jobs:
build-and-test:
runs-on: ubuntu-latest
env:
GRADLE_USER_HOME: /home/runner/.gradle
BEAR_BLOCKS_PATH: .ci/bear.blocks.yaml
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure Gradle cache dirs
run: mkdir -p "$GRADLE_USER_HOME/caches" "$GRADLE_USER_HOME/wrapper"
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: gradle
- name: Ensure Gradle wrapper executable
run: chmod +x ./gradlew
- name: Build and unit tests
run: ./gradlew --no-daemon :app:test :kernel:test
bear-gates:
runs-on: ubuntu-latest
needs:
- build-and-test
env:
GRADLE_USER_HOME: /home/runner/.gradle
BEAR_BLOCKS_PATH: .ci/bear.blocks.yaml
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure Gradle cache dirs
run: mkdir -p "$GRADLE_USER_HOME/caches" "$GRADLE_USER_HOME/wrapper"
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: gradle
- name: Ensure Gradle wrapper executable
run: chmod +x ./gradlew
- name: Resolve base ref
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE_REF="origin/${{ github.base_ref }}"
git fetch --no-tags --prune --depth=1 origin "${{ github.base_ref }}"
else
BASE_REF="${{ github.event.before }}"
if [[ -z "$BASE_REF" || "$BASE_REF" == "0000000000000000000000000000000000000000" ]]; then
BASE_REF="HEAD~1"
fi
fi
echo "BASE_REF=$BASE_REF" >> "$GITHUB_ENV"
- name: BEAR compile --all
run: ./gradlew --no-daemon :app:run --args="compile --all --project . --blocks $BEAR_BLOCKS_PATH"
- name: BEAR check --all
run: ./gradlew --no-daemon :app:run --args="check --all --project . --blocks $BEAR_BLOCKS_PATH"
- name: BEAR pr-check --all
run: ./gradlew --no-daemon :app:run --args="pr-check --all --project . --base $BASE_REF --blocks $BEAR_BLOCKS_PATH"