2024-01-08 23:12:39 +01:00
|
|
|
name: PR build check
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- '**.md'
|
|
|
|
- '.github/workflows/issue_moderator.yml'
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
env:
|
|
|
|
CI_CHUNK_SIZE: 65
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
prepare:
|
|
|
|
name: Prepare job
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }}
|
|
|
|
multisrcMatrix: ${{ steps.generate-matrices.outputs.multisrcMatrix }}
|
|
|
|
isIndividualChanged: ${{ steps.parse-changed-files.outputs.isIndividualChanged }}
|
|
|
|
isMultisrcChanged: ${{ steps.parse-changed-files.outputs.isMultisrcChanged }}
|
|
|
|
env:
|
|
|
|
CI_MODULE_GEN: true
|
|
|
|
steps:
|
|
|
|
- name: Clone repo
|
2024-01-20 06:59:41 +01:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
2024-01-08 23:12:39 +01:00
|
|
|
|
|
|
|
- name: Validate Gradle Wrapper
|
2024-01-30 05:06:27 +01:00
|
|
|
uses: gradle/wrapper-validation-action@27152f6fa06a6b8062ef7195c795692e51fc2c81 # v2
|
2024-01-08 23:12:39 +01:00
|
|
|
|
|
|
|
- name: Set up JDK
|
2024-01-20 06:59:41 +01:00
|
|
|
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
|
2024-01-08 23:12:39 +01:00
|
|
|
with:
|
2024-01-14 21:04:00 +01:00
|
|
|
java-version: 17
|
2024-01-15 09:24:21 +01:00
|
|
|
distribution: temurin
|
2024-01-08 23:12:39 +01:00
|
|
|
|
|
|
|
- id: get-changed-files
|
|
|
|
name: Get changed files
|
2024-01-20 06:59:41 +01:00
|
|
|
uses: Ana06/get-changed-files@e0c398b7065a8d84700c471b6afc4116d1ba4e96 # v2.2.0
|
2024-01-08 23:12:39 +01: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
|
|
|
|
elif [[ ${changedFile} == .github/workflows/issue_moderator.yml ]]; then
|
|
|
|
true
|
|
|
|
elif [[ ${changedFile} == *.md ]]; then
|
|
|
|
true
|
|
|
|
else
|
|
|
|
isIndividualChanged=1
|
|
|
|
isMultisrcChanged=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "isIndividualChanged=$isIndividualChanged" >> $GITHUB_OUTPUT
|
|
|
|
echo "isMultisrcChanged=$isMultisrcChanged" >> $GITHUB_OUTPUT
|
|
|
|
|
2024-01-31 13:57:01 +01:00
|
|
|
- name: Set up Gradle
|
|
|
|
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3
|
|
|
|
|
2024-01-08 23:12:39 +01:00
|
|
|
- name: Generate multisrc sources
|
|
|
|
if: ${{ steps.parse-changed-files.outputs.isMultisrcChanged == '1' }}
|
2024-01-31 13:57:01 +01:00
|
|
|
run: ./gradlew :multisrc:generateExtensions
|
2024-01-08 23:12:39 +01:00
|
|
|
|
|
|
|
- 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
|
2024-01-20 06:59:41 +01:00
|
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
|
2024-01-08 23:12:39 +01:00
|
|
|
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()] });
|
|
|
|
|
|
|
|
build_multisrc:
|
|
|
|
name: Build multisrc modules
|
|
|
|
needs: prepare
|
|
|
|
if: ${{ needs.prepare.outputs.isMultisrcChanged == '1' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJSON(needs.prepare.outputs.multisrcMatrix) }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout PR
|
2024-01-20 06:59:41 +01:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
2024-01-08 23:12:39 +01:00
|
|
|
|
|
|
|
- name: Set up JDK
|
2024-01-20 06:59:41 +01:00
|
|
|
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
|
2024-01-08 23:12:39 +01:00
|
|
|
with:
|
2024-01-14 21:04:00 +01:00
|
|
|
java-version: 17
|
2024-01-15 09:24:21 +01:00
|
|
|
distribution: temurin
|
2024-01-08 23:12:39 +01:00
|
|
|
|
2024-01-31 13:57:01 +01:00
|
|
|
- name: Set up Gradle
|
|
|
|
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3
|
|
|
|
with:
|
|
|
|
cache-read-only: true
|
|
|
|
|
2024-01-08 23:12:39 +01:00
|
|
|
- name: Generate sources from the multi-source library
|
|
|
|
env:
|
|
|
|
CI_MODULE_GEN: "true"
|
2024-01-31 13:57:01 +01:00
|
|
|
run: ./gradlew :multisrc:generateExtensions
|
2024-01-08 23:12:39 +01:00
|
|
|
|
|
|
|
- name: Build extensions (chunk ${{ matrix.chunk }})
|
|
|
|
env:
|
|
|
|
CI_MULTISRC: "true"
|
|
|
|
CI_CHUNK_NUM: ${{ matrix.chunk }}
|
2024-01-31 13:57:01 +01:00
|
|
|
run: ./gradlew assembleDebug
|
2024-01-08 23:12:39 +01:00
|
|
|
|
|
|
|
build_individual:
|
|
|
|
name: Build individual modules
|
|
|
|
needs: prepare
|
|
|
|
if: ${{ needs.prepare.outputs.isIndividualChanged == '1' }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout PR
|
2024-01-20 06:59:41 +01:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
2024-01-08 23:12:39 +01:00
|
|
|
|
|
|
|
- name: Set up JDK
|
2024-01-20 06:59:41 +01:00
|
|
|
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4
|
2024-01-08 23:12:39 +01:00
|
|
|
with:
|
2024-01-14 21:04:00 +01:00
|
|
|
java-version: 17
|
2024-01-15 09:24:21 +01:00
|
|
|
distribution: temurin
|
2024-01-08 23:12:39 +01:00
|
|
|
|
2024-01-31 13:57:01 +01:00
|
|
|
- name: Set up Gradle
|
|
|
|
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3
|
|
|
|
with:
|
|
|
|
cache-read-only: true
|
|
|
|
|
2024-01-08 23:12:39 +01:00
|
|
|
- name: Build extensions (chunk ${{ matrix.chunk }})
|
|
|
|
env:
|
|
|
|
CI_MULTISRC: "false"
|
|
|
|
CI_CHUNK_NUM: ${{ matrix.chunk }}
|
2024-01-31 13:57:01 +01:00
|
|
|
run: ./gradlew assembleDebug
|