2021-02-01 22:51:54 +00:00
|
|
|
name: PR build check
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
2022-01-20 16:02:38 +00:00
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
2021-02-01 22:51:54 +00:00
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
env:
|
2022-06-05 15:35:24 +00:00
|
|
|
CI_CHUNK_SIZE: 65
|
2022-06-05 00:55:39 +00:00
|
|
|
|
2021-02-01 22:51:54 +00:00
|
|
|
jobs:
|
2022-06-05 00:55:39 +00:00
|
|
|
prepare:
|
|
|
|
name: Prepare job
|
2021-02-01 22:51:54 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-06-05 00:55:39 +00:00
|
|
|
outputs:
|
|
|
|
individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }}
|
|
|
|
multisrcMatrix: ${{ steps.generate-matrices.outputs.multisrcMatrix }}
|
2022-07-17 15:27:26 +00:00
|
|
|
isIndividualChanged: ${{ steps.parse-changed-files.outputs.isIndividualChanged }}
|
|
|
|
isMultisrcChanged: ${{ steps.parse-changed-files.outputs.isMultisrcChanged }}
|
2022-06-05 00:55:39 +00:00
|
|
|
env:
|
|
|
|
CI_MODULE_GEN: true
|
2021-02-01 22:51:54 +00:00
|
|
|
steps:
|
|
|
|
- name: Clone repo
|
2022-05-15 17:56:52 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-02-01 22:51:54 +00:00
|
|
|
|
|
|
|
- name: Validate Gradle Wrapper
|
|
|
|
uses: gradle/wrapper-validation-action@v1
|
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
- name: Set up JDK
|
|
|
|
uses: actions/setup-java@v3
|
|
|
|
with:
|
2022-06-05 13:49:54 +00:00
|
|
|
java-version: 11
|
2022-06-05 00:55:39 +00:00
|
|
|
distribution: adopt
|
|
|
|
|
2022-07-25 21:42:09 +00:00
|
|
|
- id: get-changed-files
|
|
|
|
name: Get changed files
|
2022-08-02 02:52:30 +00:00
|
|
|
uses: Ana06/get-changed-files@2.1.0
|
2022-07-25 21:42:09 +00:00
|
|
|
|
|
|
|
- id: parse-changed-files
|
|
|
|
name: Parse changed files
|
|
|
|
run: |
|
|
|
|
isIndividualChanged=0
|
|
|
|
isMultisrcChanged=0
|
|
|
|
for changedFile in ${{ steps.get-changed-files.outputs.all }}; do
|
|
|
|
if [[ ${changedFile} == src/* ]]; then
|
|
|
|
isIndividualChanged=1
|
|
|
|
elif [[ ${changedFile} == multisrc/* ]]; then
|
|
|
|
isMultisrcChanged=1
|
|
|
|
else
|
|
|
|
isIndividualChanged=1
|
|
|
|
isMultisrcChanged=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "::set-output name=isIndividualChanged::$isIndividualChanged"
|
|
|
|
echo "::set-output name=isMultisrcChanged::$isMultisrcChanged"
|
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
- name: Generate multisrc sources
|
2022-07-25 21:42:09 +00:00
|
|
|
if: ${{ steps.parse-changed-files.outputs.isMultisrcChanged == '1' }}
|
2022-06-05 00:55:39 +00:00
|
|
|
uses: gradle/gradle-command-action@v2
|
|
|
|
with:
|
|
|
|
arguments: :multisrc:generateExtensions
|
|
|
|
|
|
|
|
- name: Get number of modules
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
./gradlew -q projects | grep '.*extensions\:\(individual\|multisrc\)\:.*\:.*' > projects.txt
|
|
|
|
|
|
|
|
echo "NUM_INDIVIDUAL_MODULES=$(cat projects.txt | grep '.*\:individual\:.*' | wc -l)" >> $GITHUB_ENV
|
|
|
|
echo "NUM_MULTISRC_MODULES=$(cat projects.txt | grep '.*\:multisrc\:.*' | wc -l)" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- id: generate-matrices
|
|
|
|
name: Create output matrices
|
|
|
|
uses: actions/github-script@v6
|
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
const numIndividualModules = process.env.NUM_INDIVIDUAL_MODULES;
|
|
|
|
const numMultisrcModules = process.env.NUM_MULTISRC_MODULES;
|
|
|
|
const chunkSize = process.env.CI_CHUNK_SIZE;
|
|
|
|
|
|
|
|
const numIndividualChunks = Math.ceil(numIndividualModules / chunkSize);
|
|
|
|
const numMultisrcChunks = Math.ceil(numMultisrcModules / chunkSize);
|
|
|
|
|
|
|
|
console.log(`Individual modules: ${numIndividualModules} (${numIndividualChunks} chunks of ${chunkSize})`);
|
|
|
|
console.log(`Multi-source modules: ${numMultisrcModules} (${numMultisrcChunks} chunks of ${chunkSize})`);
|
|
|
|
|
|
|
|
core.setOutput('individualMatrix', { 'chunk': [...Array(numIndividualChunks).keys()] });
|
|
|
|
core.setOutput('multisrcMatrix', { 'chunk': [...Array(numMultisrcChunks).keys()] });
|
|
|
|
|
2021-02-13 00:05:45 +00:00
|
|
|
build_multisrc:
|
|
|
|
name: Build multisrc modules
|
2022-06-05 00:55:39 +00:00
|
|
|
needs: prepare
|
2022-07-17 15:27:26 +00:00
|
|
|
if: ${{ needs.prepare.outputs.isMultisrcChanged == '1' }}
|
2021-02-01 22:51:54 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-02-13 00:05:45 +00:00
|
|
|
strategy:
|
2022-06-05 00:55:39 +00:00
|
|
|
matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }}
|
2021-02-01 23:15:27 +00:00
|
|
|
steps:
|
2021-02-01 22:51:54 +00:00
|
|
|
- name: Checkout PR
|
2022-05-15 17:56:52 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-02-01 22:51:54 +00:00
|
|
|
|
2021-06-20 21:44:42 +00:00
|
|
|
- name: Set up JDK
|
2022-05-15 17:56:52 +00:00
|
|
|
uses: actions/setup-java@v3
|
2021-02-01 22:51:54 +00:00
|
|
|
with:
|
2022-06-05 13:49:54 +00:00
|
|
|
java-version: 11
|
2022-05-15 17:56:52 +00:00
|
|
|
distribution: adopt
|
2021-02-01 22:51:54 +00:00
|
|
|
|
2021-02-08 14:08:45 +00:00
|
|
|
- name: Generate sources from the multi-source library
|
2021-11-29 00:06:27 +00:00
|
|
|
uses: gradle/gradle-command-action@v2
|
2021-02-13 00:05:45 +00:00
|
|
|
env:
|
2022-06-05 00:55:39 +00:00
|
|
|
CI_MODULE_GEN: "true"
|
2021-02-06 22:47:09 +00:00
|
|
|
with:
|
2021-03-09 23:02:17 +00:00
|
|
|
arguments: :multisrc:generateExtensions
|
2022-05-15 18:36:57 +00:00
|
|
|
cache-read-only: true
|
2021-02-06 22:47:09 +00:00
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
- name: Build extensions (chunk ${{ matrix.chunk }})
|
2021-11-29 00:06:27 +00:00
|
|
|
uses: gradle/gradle-command-action@v2
|
2021-02-13 00:05:45 +00:00
|
|
|
env:
|
|
|
|
CI_MULTISRC: "true"
|
2022-06-05 00:55:39 +00:00
|
|
|
CI_CHUNK_NUM: ${{ matrix.chunk }}
|
2021-02-01 22:51:54 +00:00
|
|
|
with:
|
2022-01-09 19:33:34 +00:00
|
|
|
arguments: assembleDebug
|
2022-05-15 18:36:57 +00:00
|
|
|
cache-read-only: true
|
2021-02-13 00:05:45 +00:00
|
|
|
|
|
|
|
build_individual:
|
|
|
|
name: Build individual modules
|
2022-06-05 00:55:39 +00:00
|
|
|
needs: prepare
|
2022-07-17 15:27:26 +00:00
|
|
|
if: ${{ needs.prepare.outputs.isIndividualChanged == '1' }}
|
2021-02-13 00:05:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
2022-06-05 00:55:39 +00:00
|
|
|
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
|
2021-02-13 00:05:45 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout PR
|
2022-05-15 17:56:52 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-02-13 00:05:45 +00:00
|
|
|
|
2021-06-20 21:44:42 +00:00
|
|
|
- name: Set up JDK
|
2022-05-15 17:56:52 +00:00
|
|
|
uses: actions/setup-java@v3
|
2021-02-13 00:05:45 +00:00
|
|
|
with:
|
2022-06-05 13:49:54 +00:00
|
|
|
java-version: 11
|
2022-05-15 17:56:52 +00:00
|
|
|
distribution: adopt
|
2021-02-13 00:05:45 +00:00
|
|
|
|
2022-06-05 00:55:39 +00:00
|
|
|
- name: Build extensions (chunk ${{ matrix.chunk }})
|
2021-11-29 00:06:27 +00:00
|
|
|
uses: gradle/gradle-command-action@v2
|
2021-02-13 00:05:45 +00:00
|
|
|
env:
|
|
|
|
CI_MULTISRC: "false"
|
2022-06-05 00:55:39 +00:00
|
|
|
CI_CHUNK_NUM: ${{ matrix.chunk }}
|
2021-02-13 00:05:45 +00:00
|
|
|
with:
|
2022-01-09 19:33:34 +00:00
|
|
|
arguments: assembleDebug
|
2022-05-15 18:36:57 +00:00
|
|
|
cache-read-only: true
|