Parallelize PR build workflow
This commit is contained in:
parent
13c1b882c8
commit
58ebc67389
|
@ -14,11 +14,14 @@ jobs:
|
||||||
- name: Validate Gradle Wrapper
|
- name: Validate Gradle Wrapper
|
||||||
uses: gradle/wrapper-validation-action@v1
|
uses: gradle/wrapper-validation-action@v1
|
||||||
|
|
||||||
build:
|
build_multisrc:
|
||||||
name: Build extension repo
|
name: Build multisrc modules
|
||||||
needs: check_wrapper
|
needs: check_wrapper
|
||||||
if: "!startsWith(github.event.head_commit.message, '[SKIP CI]')"
|
if: "!startsWith(github.event.head_commit.message, '[SKIP CI]')"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
lang: [all, ar, ca, de, en, es, fr, id, it, ja, ko, pt, ru, th, tr, vi, zh]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout PR
|
- name: Checkout PR
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -35,16 +38,54 @@ jobs:
|
||||||
|
|
||||||
- name: Generate sources from the multi-source library
|
- name: Generate sources from the multi-source library
|
||||||
uses: eskatos/gradle-command-action@v1
|
uses: eskatos/gradle-command-action@v1
|
||||||
|
env:
|
||||||
|
CI_MULTISRC: "true"
|
||||||
with:
|
with:
|
||||||
arguments: :multisrc:multisrcGenerators
|
arguments: :multisrc:multisrcGenerators
|
||||||
wrapper-cache-enabled: true
|
wrapper-cache-enabled: true
|
||||||
dependencies-cache-enabled: true
|
dependencies-cache-enabled: true
|
||||||
configuration-cache-enabled: true
|
configuration-cache-enabled: true
|
||||||
|
|
||||||
- name: Build extensions
|
- name: Build "${{ matrix.lang }}" extensions
|
||||||
uses: eskatos/gradle-command-action@v1
|
uses: eskatos/gradle-command-action@v1
|
||||||
|
env:
|
||||||
|
CI_MULTISRC: "true"
|
||||||
|
CI_MATRIX_LANG: ${{ matrix.lang }}
|
||||||
with:
|
with:
|
||||||
arguments: assembleRelease
|
arguments: assembleRelease
|
||||||
wrapper-cache-enabled: true
|
wrapper-cache-enabled: true
|
||||||
dependencies-cache-enabled: true
|
dependencies-cache-enabled: true
|
||||||
configuration-cache-enabled: true
|
configuration-cache-enabled: true
|
||||||
|
|
||||||
|
build_individual:
|
||||||
|
name: Build individual modules
|
||||||
|
needs: check_wrapper
|
||||||
|
if: "!startsWith(github.event.head_commit.message, '[SKIP CI]')"
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
lang: [all, ar, ca, de, en, es, fr, id, it, ja, ko, pt, ru, th, tr, vi, zh]
|
||||||
|
steps:
|
||||||
|
- name: Checkout PR
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up JDK 1.8
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
|
||||||
|
- name: Copy CI gradle.properties
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.gradle
|
||||||
|
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
|
||||||
|
|
||||||
|
- name: Build "${{ matrix.lang }}" extensions
|
||||||
|
uses: eskatos/gradle-command-action@v1
|
||||||
|
env:
|
||||||
|
CI_MULTISRC: "false"
|
||||||
|
CI_MATRIX_LANG: ${{ matrix.lang }}
|
||||||
|
with:
|
||||||
|
arguments: assembleRelease
|
||||||
|
wrapper-cache-enabled: true
|
||||||
|
dependencies-cache-enabled: true
|
||||||
|
configuration-cache-enabled: true
|
|
@ -10,34 +10,70 @@ project(":duktape-stub").projectDir = File("lib/duktape-stub")
|
||||||
include(":lib-dataimage")
|
include(":lib-dataimage")
|
||||||
project(":lib-dataimage").projectDir = File("lib/dataimage")
|
project(":lib-dataimage").projectDir = File("lib/dataimage")
|
||||||
|
|
||||||
include(":multisrc")
|
if (System.getenv("CI") == null) {
|
||||||
project(":multisrc").projectDir = File("multisrc")
|
// Local development
|
||||||
|
|
||||||
// Loads all extensions
|
include(":multisrc")
|
||||||
File(rootDir, "src").eachDir { dir ->
|
project(":multisrc").projectDir = File("multisrc")
|
||||||
dir.eachDir { subdir ->
|
|
||||||
val name = ":individual:${dir.name}:${subdir.name}"
|
// Loads all extensions
|
||||||
include(name)
|
File(rootDir, "src").eachDir { dir ->
|
||||||
project(name).projectDir = File("src/${dir.name}/${subdir.name}")
|
dir.eachDir { subdir ->
|
||||||
|
val name = ":individual:${dir.name}:${subdir.name}"
|
||||||
|
include(name)
|
||||||
|
project(name).projectDir = File("src/${dir.name}/${subdir.name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Loads generated extensions from multisrc
|
||||||
|
File(rootDir, "generated-src").eachDir { dir ->
|
||||||
|
dir.eachDir { subdir ->
|
||||||
|
val name = ":theme:${dir.name}:${subdir.name}"
|
||||||
|
include(name)
|
||||||
|
project(name).projectDir = File("generated-src/${dir.name}/${subdir.name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If you're developing locally and only want to work with a single module,
|
||||||
|
* comment out the parts above and uncomment below.
|
||||||
|
*/
|
||||||
|
// val lang = "all"
|
||||||
|
// val name = "mmrcms"
|
||||||
|
// include(":${lang}-${name}")
|
||||||
|
// project(":${lang}-${name}").projectDir = File("src/${lang}/${name}")
|
||||||
|
} else {
|
||||||
|
// Running in CI (GitHub Actions)
|
||||||
|
|
||||||
|
val isMultisrc = System.getenv("CI_MULTISRC") == "true"
|
||||||
|
val lang = System.getenv("CI_MATRIX_LANG")
|
||||||
|
|
||||||
|
if (isMultisrc) {
|
||||||
|
include(":multisrc")
|
||||||
|
project(":multisrc").projectDir = File("multisrc")
|
||||||
|
|
||||||
|
// Loads generated extensions from multisrc
|
||||||
|
File(rootDir, "generated-src").eachDir { dir ->
|
||||||
|
if (dir.name == lang) {
|
||||||
|
dir.eachDir { subdir ->
|
||||||
|
val name = ":theme:${dir.name}:${subdir.name}"
|
||||||
|
include(name)
|
||||||
|
project(name).projectDir = File("generated-src/${dir.name}/${subdir.name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Loads all extensions
|
||||||
|
File(rootDir, "src").eachDir { dir ->
|
||||||
|
if (dir.name == lang) {
|
||||||
|
dir.eachDir { subdir ->
|
||||||
|
val name = ":individual:${dir.name}:${subdir.name}"
|
||||||
|
include(name)
|
||||||
|
project(name).projectDir = File("src/${dir.name}/${subdir.name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Loads generated extensions from multisrc
|
|
||||||
File(rootDir, "generated-src").eachDir { dir ->
|
|
||||||
dir.eachDir { subdir ->
|
|
||||||
val name = ":theme:${dir.name}:${subdir.name}"
|
|
||||||
include(name)
|
|
||||||
project(name).projectDir = File("generated-src/${dir.name}/${subdir.name}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If you're developing locally and only want to work with a single module,
|
|
||||||
* comment out the parts above and uncomment below.
|
|
||||||
*/
|
|
||||||
// val lang = "all"
|
|
||||||
// val name = "mmrcms"
|
|
||||||
// include(":${lang}-${name}")
|
|
||||||
// project(":${lang}-${name}").projectDir = File("src/${lang}/${name}")
|
|
||||||
|
|
||||||
inline fun File.eachDir(block: (File) -> Unit) {
|
inline fun File.eachDir(block: (File) -> Unit) {
|
||||||
listFiles()?.filter { it.isDirectory }?.forEach { block(it) }
|
listFiles()?.filter { it.isDirectory }?.forEach { block(it) }
|
||||||
|
|
Loading…
Reference in New Issue