forked from gradle/gradle
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (117 loc) · 4.09 KB
/
contributor-pr.yml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Contributor CI Build
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
# On master/release, we don't want any jobs cancelled so the sha is used to name the group
# On PR branches, we cancel the job if new commits are pushed
group: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release' ) && format('contributor-pr-base-{0}', github.sha) || format('contributor-pr-{0}', github.ref) }}
cancel-in-progress: true
env:
# Set the GRADLE_ENTERPRISE_ACCESS_KEY so that Gradle Build Scans are generated
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
# Enable debug for the `gradle-build-action` cache operations
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
permissions:
contents: read
jobs:
build:
name: "Compile All"
runs-on: ubuntu-latest
steps:
- name: git clone
uses: actions/checkout@v4
- id: setup-matrix
run: echo "matrix=$(jq -c -f .github/workflows/extract-unit-test-split.jq .teamcity/subprojects.json)" >> $GITHUB_OUTPUT
- name: setup java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- id: determine-sys-prop-args
uses: actions/github-script@v7
with:
script: |
if (context.payload.pull_request && context.payload.pull_request.head.repo.fork) {
core.setOutput('sys-prop-args', '-DagreePublicBuildScanTermOfService=yes -DcacheNode=us')
} else {
core.setOutput('sys-prop-args', '-DcacheNode=us')
}
- name: assemble
id: gradle
uses: gradle/gradle-build-action@v3
with:
cache-read-only: ${{ github.ref != 'refs/heads/master' }}
arguments: |
compileAll
--no-configuration-cache
-DdisableLocalCache=true
${{ steps.determine-sys-prop-args.outputs.sys-prop-args }}
- uses: actions/upload-artifact@v4
with:
name: build-receipt.properties
path: platforms/core-runtime/base-services/build/generated-resources/build-receipt/org/gradle/build-receipt.properties
outputs:
matrix: ${{ steps.setup-matrix.outputs.matrix }}
sys-prop-args: ${{ steps.determine-sys-prop-args.outputs.sys-prop-args }}
sanity-check:
name: "Sanity Check on Linux"
runs-on: ubuntu-latest
needs: build
steps:
- name: git clone
uses: actions/checkout@v4
- name: setup java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- uses: actions/download-artifact@v4
with:
name: build-receipt.properties
path: incoming-distributions/build-receipt.properties
- name: ./gradlew sanityCheck
id: gradle
uses: gradle/gradle-build-action@v3
with:
cache-read-only: ${{ github.ref != 'refs/heads/master' }}
arguments: |
sanityCheck
--no-configuration-cache
-DdisableLocalCache=true
${{ needs.build.outputs.sys-prop-args }}
unit-test:
name: "${{ matrix.bucket.name }} (Unit Test)"
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
bucket: ${{ fromJson(needs.build.outputs.matrix) }}
fail-fast: false
steps:
- name: git clone
uses: actions/checkout@v4
- name: setup java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
- uses: actions/download-artifact@v4
with:
name: build-receipt.properties
path: incoming-distributions/build-receipt.properties
- name: ./gradlew test
id: gradle
uses: gradle/gradle-build-action@v3
with:
cache-read-only: ${{ github.ref != 'refs/heads/master' }}
arguments: |
${{ matrix.bucket.tasks }}
--no-configuration-cache
-DdisableLocalCache=true
-PflakyTests=exclude
${{ needs.build.outputs.sys-prop-args }}