This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/main by this push:
new 3ec30076356 Generate coverage for Simulator based integration tests &
ui tests in github actions (#7784)
3ec30076356 is described below
commit 3ec30076356124439b5e50cb1a057e3b164afc0d
Author: Vishesh <[email protected]>
AuthorDate: Mon Sep 11 14:14:12 2023 +0530
Generate coverage for Simulator based integration tests & ui tests in
github actions (#7784)
* Generate coverage for Simulator based integration tests
* Add flag for unit tests
* Add coverage for uitests
---
.github/workflows/ci.yml | 26 +++++++++++++++++++++++++-
.github/workflows/codecov.yml | 1 +
.github/workflows/ui.yml | 9 +++++++++
ui/jest.config.js | 2 +-
4 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d0061cb19af..5b17ab33185 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -193,6 +193,8 @@ jobs:
steps:
- uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v3
@@ -217,6 +219,11 @@ jobs:
run: |
python3 -m pip install --user --upgrade urllib3 lxml paramiko nose
texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six
astroid
+ - name: Install jacoco dependencies
+ run: |
+ wget
https://github.com/jacoco/jacoco/releases/download/v0.8.10/jacoco-0.8.10.zip
+ unzip jacoco-0.8.10.zip -d jacoco
+
- name: Env details
run: |
uname -a
@@ -249,9 +256,16 @@ jobs:
mvn -q -Pdeveloper -pl developer -Ddeploydb
mvn -q -Pdeveloper -pl developer -Ddeploydb-simulator
+ - name: Generate jacoco-coverage.sh
+ run: |
+ echo "java -jar jacoco/lib/jacococli.jar report jacoco-it.exec \\" >
jacoco-report.sh
+ find . | grep "target/classes" | sed 's/\/classes\//\/classes /g' |
awk '{print "--classfiles", $1, "\\"}' | sort |uniq >> jacoco-report.sh
+ find . | grep "src/main/java" | sed 's/\/java\//\/java /g' | awk
'{print "--sourcefiles", $1, "\\"}' | sort | uniq >> jacoco-report.sh
+ echo "--xml jacoco-coverage.xml" >> jacoco-report.sh
+
- name: Start CloudStack Management Server with Simulator
run: |
- export MAVEN_OPTS="-Xmx4096m -XX:MaxPermSize=800m
-Djava.security.egd=file:/dev/urandom"
+ export MAVEN_OPTS="-Xmx4096m -XX:MaxPermSize=800m
-Djava.security.egd=file:/dev/urandom
-javaagent:jacoco/lib/jacocoagent.jar=address=*,port=36320,output=tcpserver"
echo -e "\nStarting simulator"
set +e
mvn -Dsimulator -Dorg.eclipse.jetty.annotations.maxWait=120 -pl
:cloud-client-ui jetty:run 2>&1 > /tmp/jetty-log || true &
@@ -275,6 +289,8 @@ jobs:
done
echo -e "Stopping Simulator, integration tests run completed\n"
+ java -jar jacoco/lib/jacococli.jar dump --address localhost --port
36320 --destfile jacoco-it.exec
+ bash jacoco-report.sh
mvn -Dsimulator -pl client jetty:stop 2>&1
find /tmp//MarvinLogs -type f -exec echo -e "Printing marvin logs {}
:\n" \; -exec cat {} \;
@@ -282,3 +298,11 @@ jobs:
run: |
echo -e "Simulator CI Test Results: (only failures listed)\n"
python3 ./tools/marvin/xunit-reader.py integration-test-results/
+
+ - uses: codecov/codecov-action@v3
+ with:
+ files: jacoco-coverage.xml
+ fail_ci_if_error: true
+ flags: simulator-marvin-tests
+ verbose: true
+ name: codecov
diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml
index 1ef7b6545df..87a4feaf73a 100644
--- a/.github/workflows/codecov.yml
+++ b/.github/workflows/codecov.yml
@@ -53,5 +53,6 @@ jobs:
with:
files: ./client/target/site/jacoco-aggregate/jacoco.xml
fail_ci_if_error: true
+ flags: unit-tests
verbose: true
name: codecov
diff --git a/.github/workflows/ui.yml b/.github/workflows/ui.yml
index 80e08072d6c..badcebc9019 100644
--- a/.github/workflows/ui.yml
+++ b/.github/workflows/ui.yml
@@ -51,3 +51,12 @@ jobs:
npm run build
npm run lint
npm run test:unit
+
+ - uses: codecov/codecov-action@v3
+ with:
+ working-directory: ui
+ files: ./coverage/lcov.info
+ fail_ci_if_error: true
+ flags: uitests
+ verbose: true
+ name: codecov
diff --git a/ui/jest.config.js b/ui/jest.config.js
index 7659c94f6d2..eb5f3f4db1b 100644
--- a/ui/jest.config.js
+++ b/ui/jest.config.js
@@ -50,5 +50,5 @@ module.exports = {
'!**/node_modules/**',
'!<rootDir>/src/locales/*.{js, json}'
],
- coverageReporters: ['html', 'text-summary']
+ coverageReporters: ['html', 'text-summary', 'lcov']
}