-
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 branch 'backport-4179' into release-2.0.x
- Loading branch information
Showing
7 changed files
with
274 additions
and
168 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,50 @@ | ||
name: 'Execute tests tagged in a certain way' | ||
name: 'Execute tests' | ||
description: 'Execute tests suite for tests tagged as specified' | ||
inputs: | ||
tag: | ||
description: Cucumber tag of the tests to run | ||
required: true | ||
required: false | ||
needs-docker-images: | ||
description: true if this suite needs docker images, false otherwise | ||
required: false | ||
default: 'true' | ||
needs-api-docker-image: | ||
description: true if this suite needs the rest-api docker image, false otherwise | ||
required: false | ||
default: 'false' | ||
run-junit: | ||
description: true if you want to execute junit tests, false if you want to execute cucumber tests | ||
required: false | ||
default: 'false' | ||
#outputs: | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 11 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 # Installs Node and NPM | ||
with: | ||
node-version: 16 | ||
- name: Install Swagger CLI # Installs Swagger CLI to bundle OpenAPI files | ||
run: 'npm install -g @apidevtools/swagger-cli' | ||
shell: bash | ||
- uses: actions/cache@v4 # Cache local Maven repository to reuse dependencies | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ github.run_id }}-${{ github.run_number }}-maven-cache | ||
- name: Cache Maven repository | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ github.run_id }}-${{ github.run_number }}-maven-cache | ||
- name: Set up runner | ||
uses: ./.github/actions/setUpRunner | ||
|
||
- name: Set up Maven caches | ||
uses: ./.github/actions/setUpMavenCaches | ||
|
||
- name: Docker images creation | ||
if: ${{ inputs.needs-docker-images == 'true' }} | ||
run: mvn clean install -pl ${APP_PROJECTS} && mvn clean install -Pdocker --f assembly/pom.xml | ||
run: mvn clean install -pl ${APP_PROJECTS} && mvn clean install -Pdocker -f assembly/pom.xml -pl '!:kapua-assembly-api' #api container not used in the tests at all se we don't need to build it here | ||
shell: bash | ||
- name: Dns look-up containers needed for tests - message-broker | ||
if: ${{ inputs.needs-docker-images == 'true' }} | ||
run: echo "127.0.0.1 message-broker" | sudo tee -a /etc/hosts | ||
|
||
- name: Docker rest-api image creation | ||
if: ${{ inputs.needs-api-docker-image == 'true' }} | ||
run: mvn clean install -Pdocker -pl :kapua-assembly-api | ||
shell: bash | ||
- name: Dns look-up containers needed for tests - job-engine | ||
if: ${{ inputs.needs-docker-images == 'true' }} | ||
run: echo "127.0.0.1 job-engine" | sudo tee -a /etc/hosts | ||
|
||
- name: Cucumber tests execution step | ||
if: ${{ inputs.run-junit == 'false' }} | ||
run: mvn -B -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.filter.tags="${{ inputs.tag }}" -pl ${TEST_PROJECTS} verify | ||
shell: bash | ||
- name: Test execution step | ||
run: mvn -B ${BUILD_OPTS} ${CONFIG_OVERRIDES} -Dgroups='!org.eclipse.kapua.qa.markers.junit.JUnitTests' -Dcucumber.filter.tags="${{ inputs.tag }}" -pl ${TEST_PROJECTS} verify | ||
|
||
- name: Junit tests execution step | ||
if: ${{ inputs.run-junit == 'true' }} | ||
run: mvn -B -Dgroups='org.eclipse.kapua.qa.markers.junit.JUnitTests' verify | ||
shell: bash | ||
|
||
- name: Code coverage results upload | ||
uses: codecov/codecov-action@v4 |
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-release-2.0.x-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.