Improve ci/cd pipeline

This commit is contained in:
Vivek Kumar Dutta 2023-12-27 21:45:44 +05:30
parent 7b0f7382a9
commit 9deb2c51d5
3 changed files with 21 additions and 83 deletions

View file

@ -7,7 +7,7 @@ variables:
include:
- project: 'iopsys/gitlab-ci-pipeline'
file: '/static-code-analysis.yml'
ref: '0.30'
ref: '0.32'
- project: 'docs/portal2/pipeline-template'
file: 'MkDocs.gitlab-ci.yml'
rules:
@ -16,7 +16,7 @@ include:
stages:
- static_code_analysis
- unit_test
- functional_test
- functional_api_test
- deploy
run_unit_test:
@ -33,29 +33,8 @@ run_unit_test:
- memory-report.xml
- unit-test-coverage.xml
run_api_test:
stage: functional_test
image: "dev.iopsys.eu:5050/iopsys/gitlab-ci-pipeline/code-analysis:0.31"
services:
- name: dev.iopsys.eu:5050/lcm/swmodd/acs:latest
alias: acs
allow_failure: false
script:
- "./gitlab-ci/install-dependencies.sh"
- "./gitlab-ci/setup.sh"
- "./gitlab-ci/api-test.sh"
artifacts:
when: always
reports:
junit: ./report/tap.xml
paths:
- api-test-coverage.xml
- memory-report.xml
- api-test-result.log
run_functional_test:
stage: functional_test
stage: functional_api_test
image: "dev.iopsys.eu:5050/iopsys/gitlab-ci-pipeline/code-analysis:0.31"
services:
- name: dev.iopsys.eu:5050/lcm/swmodd/acs:latest
@ -65,16 +44,16 @@ run_functional_test:
script:
- "./gitlab-ci/install-dependencies.sh"
- "./gitlab-ci/setup.sh"
- "./gitlab-ci/functional-test.sh"
- "./gitlab-ci/functional-api-test.sh"
artifacts:
when: always
reports:
junit: ./report/tap.xml
paths:
- functional-api-result.txt
- funl-test-coverage.xml
- funl-test-result.log
- funl-test-debug.log
- funl-test-debug.txt
- memory-report.xml
- memory-report-download.xml
- icwmpd_debug.txt

View file

@ -1,45 +0,0 @@
#!/bin/bash
echo "preparation script"
pwd
. ./gitlab-ci/shared.sh
trap cleanup EXIT
trap cleanup SIGINT
echo "Compiling icmwp"
build_icwmp
mkdir -p /var/state/icwmpd
echo "Starting Services..."
cp ./gitlab-ci/icwmp.conf /etc/supervisor/conf.d/
supervisorctl reread
supervisorctl update
supervisorctl restart bbfdmd
sleep 20
supervisorctl status all
# wait until cwmp status is up
check_cwmp_status
echo "Running the api test cases"
ubus-api-validator -t 10 -f ./test/api/json/tr069.validation.json > ./api-test-result.log
check_ret $?
sleep 5
echo "Stop all services"
supervisorctl stop icwmpd
# Artefact
gcovr -r . 2> /dev/null --xml -o ./api-test-coverage.xml
#GitLab-CI output
gcovr -r . 2> /dev/null
#report part
exec_cmd tap-junit --input ./api-test-result.log --output report
check_valgrind_xml
echo "Functional API test :: PASS"

View file

@ -29,13 +29,17 @@ echo "Checking cwmp status"
check_cwmp_status
supervisorctl status all
[ -f funl-test-result.log ] && rm -f funl-test-result.log
echo > ./functional-api-result.txt
echo > ./funl-test-debug.txt
echo "Running the api test cases"
ubus-api-validator -t 10 -f ./test/api/json/tr069.validation.json > ./api-test-result.txt
check_ret $?
sleep 5
echo "## Running script verification of functionalities ##"
echo > ./funl-test-result.log
echo > ./funl-test-debug.log
test_num=0
test_num=0
for test in $(cat test/script/run_sequence.txt); do
test=$(basename ${test})
test_num=$(( test_num + 1 ))
@ -43,12 +47,12 @@ for test in $(cat test/script/run_sequence.txt); do
echo "#### Start $test ####" >> "$icwmp_master_log"
./test/script/${test}
if [ "$?" -eq 0 ]; then
echo "ok ${test_num} - ${test}" >> ./funl-test-result.log
echo "ok ${test_num} - ${test}" >> ./functional-api-result.txt
remove_icwmp_log
echo "#### $test Done ####" >> "$icwmp_master_log"
echo "#### $test Done ####"
else
echo "not ok ${test_num} - ${test}" >> ./funl-test-result.log
echo "not ok ${test_num} - ${test}" >> ./functional-api-result.txt
remove_icwmp_log
echo "#### $test Ended with error ####" >> "$icwmp_master_log"
echo "#### $test Ended with error ####"
@ -66,17 +70,17 @@ echo "Verify Custom notifications"
echo "#### Start custom_notifications ####" >> "$icwmp_master_log"
./test/script/verify_custom_notifications.sh
if [ "$?" -eq 0 ]; then
echo "ok - verify_custom_notifications" >> ./funl-test-result.log
echo "ok - verify_custom_notifications" >> ./functional-api-result.txt
remove_icwmp_log
echo "#### Done custom_notifications ####" >> "$icwmp_master_log"
else
echo "not ok - verify_custom_notifications" >> ./funl-test-result.log
echo "not ok - verify_custom_notifications" >> ./functional-api-result.txt
remove_icwmp_log
echo "#### custom_notifications ended with error ####" >> "$icwmp_master_log"
fi
test_num=$(( test_num + 1 ))
echo "1..${test_num}" >> ./funl-test-result.log
echo "1..${test_num}" >> ./functional-api-result.txt
# Artefact
gcovr -r . 2> /dev/null --xml -o ./funl-test-coverage.xml
@ -84,9 +88,9 @@ gcovr -r . 2> /dev/null --xml -o ./funl-test-coverage.xml
gcovr -r . 2> /dev/null
#report part
exec_cmd tap-junit --input ./funl-test-result.log --output report
exec_cmd tap-junit --input ./functional-api-result.txt --output report
sleep 10
check_valgrind_xml
echo "Functional test :: PASS"
echo "Functional API test :: PASS"