Skip to content

Commit

Permalink
Apply priority execution in CI (#7395)
Browse files Browse the repository at this point in the history
Nowadays, around 84 jobs are executed. Core, Modules and examples
are executed in parallel which cause a bottleneck when many PRs are
raised. This commit introduces a priority to the execution

1. Core module
2. Modules
3. Examples
4. Docs examples

Although, the number of execution doesn't change at the end. It will
allow to do not take all runners at once.
  • Loading branch information
eddumelendez authored Aug 3, 2023
1 parent d1a3742 commit d753f36
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 89 deletions.
88 changes: 0 additions & 88 deletions .github/workflows/ci-examples.yml

This file was deleted.

119 changes: 118 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,30 @@ env:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}

jobs:
core:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: temurin
- name: Clear existing docker image cache
run: docker image prune -af
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-includes: |
caches
notifications
jdks
gradle-home-cache-cleanup: true
- name: Build and test with Gradle
run: |
./gradlew :testcontainers:check --no-daemon --continue --scan
find_gradle_jobs:
needs: [core]
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
Expand All @@ -59,7 +82,7 @@ jobs:
# we should not push empty results to the cache
READ_ONLY_REMOTE_GRADLE_CACHE: true
run: |
TASKS=$(./gradlew --no-daemon --parallel -q testMatrix | jq 'del(.[] | select(. == ":azure:check"))' --compact-output)
TASKS=$(./gradlew --no-daemon --parallel -q testMatrix | jq 'del(.[] | select(. == ":azure:check" or . == ":testcontainers:check" or startswith(":docs:")))' --compact-output)
echo $TASKS
echo "matrix={\"gradle_args\":$TASKS}" >> $GITHUB_OUTPUT
check:
Expand Down Expand Up @@ -87,3 +110,97 @@ jobs:
- name: Build and test with Gradle (${{matrix.gradle_args}})
run: |
./gradlew --no-daemon --continue --scan ${{matrix.gradle_args}}
find_examples_jobs:
needs: [check]
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: temurin
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
- id: set-matrix
working-directory: ./examples/
env:
# Since we override the tests executor,
# we should not push empty results to the cache
READ_ONLY_REMOTE_GRADLE_CACHE: true
run: |
TASKS=$(./gradlew --no-daemon --parallel -q testMatrix)
echo $TASKS
echo "matrix={\"gradle_args\":$TASKS}" >> $GITHUB_OUTPUT
check_examples:
needs: [find_examples_jobs]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find_examples_jobs.outputs.matrix) }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: temurin
- name: Clear existing docker image cache
run: docker image prune -af
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Build and test Examples with Gradle (${{matrix.gradle_args}})
working-directory: ./examples/
run: |
./gradlew --no-daemon --continue --scan --info ${{matrix.gradle_args}}
find_docs_examples_jobs:
needs: [check_examples]
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: temurin
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
- id: set-matrix
env:
# Since we override the tests executor,
# we should not push empty results to the cache
READ_ONLY_REMOTE_GRADLE_CACHE: true
run: |
TASKS=$(./gradlew --no-daemon --parallel -q testMatrix | jq 'map(select(startswith(":docs:")))' --compact-output)
echo $TASKS
echo "matrix={\"gradle_args\":$TASKS}" >> $GITHUB_OUTPUT
check_docs_examples:
needs: [find_docs_examples_jobs]
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.find_docs_examples_jobs.outputs.matrix) }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: temurin
- name: Clear existing docker image cache
run: docker image prune -af
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-includes: |
caches
notifications
jdks
gradle-home-cache-cleanup: true
- name: Build and test with Gradle (${{matrix.gradle_args}})
run: |
./gradlew --no-daemon --continue --scan ${{matrix.gradle_args}}

0 comments on commit d753f36

Please sign in to comment.