-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4179 from Coduz/feat-improvedGitHubActionCaching
♻️ [CI] Improved Kapua CI workflow artifacts and dependency caching
- Loading branch information
Showing
7 changed files
with
246 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: 'Save built Kapua Artifacts' | ||
description: | | ||
Saves the built Kapua artifacts for later usage | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Extract built Kapua artifacts # This splits the built Kapua artifact of this run from the cached repository of external dependencies for caching | ||
run: | | ||
mkdir --parents ~/.m2/kapua-repository/org/eclipse/ | ||
mv ~/.m2/repository/org/eclipse/kapua ~/.m2/kapua-repository/org/eclipse/kapua | ||
shell: bash | ||
|
||
- name: Save built Kapua artifacts | ||
uses: actions/cache/save@v4 | ||
with: | ||
path: ~/.m2/kapua-repository/org/eclipse/kapua | ||
key: ${{ runner.os }}-maven-${{ github.run_number }}-kapua-artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: 'Set Up Maven caches' | ||
description: | | ||
Set up maven caches to speedup build time and reuse built artifacts | ||
inputs: | ||
kapua-artifact-cache-enabled: | ||
description: Whether to enable Kapua artifacts cache or not. If not enable you'll be required to build Kapua Artifacts on the runner | ||
default: 'true' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Cache Maven repository - External dependencies # Cache of external Maven dependencies to speed up build time | ||
id: cache-maven-external-deps | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2/repository/ | ||
key: ${{ runner.os }}-maven-develop-dependencies | ||
|
||
- name: Cache Maven repository - Kapua artifacts # Cache of built Kapua artifacts be reused in other jobs | ||
if: ${{ inputs.kapua-artifact-cache-enabled == 'true' }} | ||
id: cache-maven-kapua-artifacts | ||
uses: actions/cache/restore@v4 | ||
with: | ||
path: ~/.m2/kapua-repository/org/eclipse/kapua | ||
key: ${{ runner.os }}-maven-${{ github.run_number }}-kapua-artifacts | ||
fail-on-cache-miss: 'true' | ||
|
||
- name: Build full cached Maven repository # This adds the built Kapua artifact of this run to the cached repository of external dependencies. Used when re-running a job | ||
if: ${{ inputs.kapua-artifact-cache-enabled == 'true' }} | ||
run: mv ~/.m2/kapua-repository/org/eclipse/kapua ~/.m2/repository/org/eclipse/kapua | ||
shell: bash | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: 'Set Up Runner' | ||
description: | | ||
Set up runner with tools required for the build | ||
- Setup Java 11 | ||
- Setup Node 16 | ||
- Install Swagger CLI | ||
- Add entries to /etc/hosts for tests | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Java 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 11 | ||
|
||
- name: Setup Node 16 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install Swagger CLI # Required to bundle OpenAPI files | ||
run: 'npm install -g @apidevtools/swagger-cli' | ||
shell: bash | ||
|
||
- name: Dns look-up Docker containers needed for tests | ||
run: | | ||
echo "127.0.0.1 message-broker" | sudo tee -a /etc/hosts | ||
echo "127.0.0.1 job-engine" | sudo tee -a /etc/hosts | ||
shell: bash |
Oops, something went wrong.