forked from keiyoushi/extensions-source
-
Notifications
You must be signed in to change notification settings - Fork 1
118 lines (103 loc) · 3.43 KB
/
Copy pathbuild_pull_request.yml
File metadata and controls
118 lines (103 loc) · 3.43 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
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
name: PR check
on:
pull_request:
paths:
- '**'
- '!**.md'
- '!.github/**'
- '.github/workflows/build_pull_request.yml'
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
CI_CHUNK_SIZE: 80
IS_PR_CHECK: true
jobs:
prepare:
name: Prepare job
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
matrix: ${{ steps.generate-matrices.outputs.matrix }}
lint_modules: ${{ steps.generate-matrices.outputs.lint_modules }}
delete: ${{ steps.generate-matrices.outputs.delete }}
steps:
- name: Checkout PR
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- id: generate-matrices
name: Generate build matrices
run: |
python ./.github/scripts/generate-build-matrices.py origin/main
build:
name: Build extensions (${{ matrix.chunk.number }})
needs: prepare
runs-on: ubuntu-latest
timeout-minutes: 30
if: ${{ toJson(fromJson(needs.prepare.outputs.matrix).chunk) != '[]' }}
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
steps:
- name: Checkout PR
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
cache-read-only: true
- name: Build extensions (${{ matrix.chunk.number }})
env:
MODULES: ${{ join(matrix.chunk.modules, ' ') }}
run: |
TASKS=()
for module in $MODULES; do
TASKS+=("${module}:assembleRelease" "${module}:lintRelease")
done
./gradlew "${TASKS[@]}"
- name: Upload APKs (${{ matrix.chunk.number }})
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: "github.repository == 'keiyoushi/extensions-source'"
with:
name: "individual-apks-${{ matrix.chunk.number }}"
path: |
**/build/outputs/apk/release/*.apk
**/build/outputs/jar/release/*.jar
retention-days: 1
lint-shared:
name: Lint shared modules
needs: prepare
runs-on: ubuntu-latest
timeout-minutes: 30
if: ${{ needs.prepare.outputs.lint_modules != '[]' }}
steps:
- name: Checkout PR
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
java-version: 17
distribution: temurin
- name: Set up Gradle
uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0
with:
cache-read-only: true
- name: Lint shared modules
env:
MODULES: ${{ join(fromJSON(needs.prepare.outputs.lint_modules), ' ') }}
run: |
TASKS=()
for module in $MODULES; do
TASKS+=("${module}:lintRelease")
done
./gradlew "${TASKS[@]}"