-
Notifications
You must be signed in to change notification settings - Fork 57
109 lines (92 loc) · 3.06 KB
/
build_all.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
name: Build ALL extensions
on:
workflow_dispatch:
inputs:
git-repo:
description: Git repo (Optional, defaults to <your name>/aniyomi-extensions
default: ''
required: false
git-ref:
description: Git Ref (Optional, defaults to master)
default: 'master'
required: false
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
CI_CHUNK_SIZE: 65
REPO: ${{ github.event.inputs.git-repo }}
jobs:
prepare:
name: Prepare job
runs-on: ubuntu-latest
outputs:
individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }}
multisrcMatrix: ${{ steps.generate-matrices.outputs.multisrcMatrix }}
env:
CI_MODULE_GEN: true
steps:
- name: Check inputs
if: env.REPO == ''
run: |
set -e
echo "REPO=${{ github.repository_owner }}/aniyomi-extensions" >> $GITHUB_ENV
- name: Clone Repository (Latest)
uses: actions/checkout@v4
with:
repository: ${{ env.REPO }}
fetch-depth: 0
ref: ${{ github.event.inputs.git-ref }}
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: zulu
- name: Get number of modules
run: |
set -x
projects=(src/*/*)
echo "NUM_INDIVIDUAL_MODULES=${#projects[@]}" >> $GITHUB_ENV
- id: generate-matrices
name: Create output matrices
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const numIndividualModules = process.env.NUM_INDIVIDUAL_MODULES;
const chunkSize = process.env.CI_CHUNK_SIZE;
const numIndividualChunks = Math.ceil(numIndividualModules / chunkSize);
console.log(`Individual modules: ${numIndividualModules} (${numIndividualChunks} chunks of ${chunkSize})`);
core.setOutput('individualMatrix', { 'chunk': [...Array(numIndividualChunks).keys()] });
build_all:
name: Build all sources
needs: prepare
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
steps:
- name: Check inputs
if: env.REPO == ''
run: |
set -e
echo "REPO=${{ github.repository_owner }}/aniyomi-extensions" >> $GITHUB_ENV
- name: Clone Repository (Latest)
uses: actions/checkout@v4
with:
repository: ${{ env.REPO }}
fetch-depth: 0
ref: ${{ github.event.inputs.git-ref }}
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: zulu
- name: Build extensions (chunk ${{ matrix.chunk }})
env:
CI_CHUNK_NUM: ${{ matrix.chunk }}
run: ./gradlew -p src assembleDebug
- name: Upload APKs (chunk ${{ matrix.chunk }})
uses: actions/upload-artifact@v4
with:
name: "individual-apks-${{ matrix.chunk }}"
path: "**/*.apk"
retention-days: 1