diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9db233dff5ef0cf3548d8decdc29af90f9f91b21..f5a10f4a5fa3c2f487913429d9128bc8a7dee1b0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -533,6 +533,14 @@ build-npm-cspell: .oe-selftest-rules: rules: - if: $CI_PIPELINE_SOURCE == "schedule" && $OE_SELFTEST == "gcc" + - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^(wip|draft):.*/i' + when: manual + variables: + CI_ONIRO_MANIFEST_URL: "$CI_MERGE_REQUEST_SOURCE_PROJECT_URL" + CI_ONIRO_MANIFEST_BRANCH: "$CI_COMMIT_REF_NAME" + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + changes: + - manifests/*.xml oe-selftest-gcc-qemu-linux-user: extends: [.oe-selftest, .oe-selftest-rules] @@ -602,6 +610,7 @@ oe-selftest-report: python3 $CI_PROJECT_DIR/gcc-result-parser.py $sum_file done # Upload result to squad. + gcc_version="$(cat gcc_version)" for result_file in $(ls result_*.json); do component="$(basename $result_file .json | cut -d'_' -f2-)" job_id="$job-$component" @@ -609,7 +618,7 @@ oe-selftest-report: --header "Auth-Token: $CI_SQUAD_TOKEN" \ https://squadp.svc.ostc-eu.dev/api/submit/oniro-core/gcc-test/$CI_PIPELINE_ID/$test_env \ --form tests=@$result_file \ - --form metadata='{"job_id": "'$job_id'"}' + --form "metadata={\"job_id\": \"$job_id\", \"gcc_version\": \"$gcc_version\"}" done ) done diff --git a/.oniro-ci/build-generic.yaml b/.oniro-ci/build-generic.yaml index 9b490352ab93e555c8fed3d67d7cb78f66b5854b..5c73fa5a06c531c69b70edf5a5326dcf0589b6a8 100644 --- a/.oniro-ci/build-generic.yaml +++ b/.oniro-ci/build-generic.yaml @@ -483,6 +483,7 @@ CI_ONIRO_BB_LOCAL_CONF_SANITY_TESTED_DISTROS: "" CI_ONIRO_OE_SELFTESTS: "" CI_ONIRO_OE_SEFLTEST_SKIPS: "" + CI_SQUAD_INSTANCE: "https://squadp.svc.ostc-eu.dev" # The USER variable is required by oe-selftest but missing in env. USER: "builder" ARTIFACTS_DIR: "$CI_PROJECT_DIR/artifacts/$CI_JOB_NAME" @@ -491,6 +492,19 @@ echo "nothing to test - CI_ONIRO_OE_SELFTESTS is empty" && exit 1 ) - !reference [.bitbake-workspace, script] + # Only run tests when gcc version changed. + - gcc_version="$(bitbake -s | grep '^gcc-runtime' | awk -F':' '{print $NF}' | head -1 | awk '{$1=$1;print}')" + - echo "Current GCC version $gcc_version" + - last_build_id="$(curl --silent $CI_SQUAD_INSTANCE/api/projects/5/builds/ | jq -r '.results | .[] | .id' | head -1)" + - last_tested_gcc_version="$(curl --silent $CI_SQUAD_INSTANCE/api/builds/$last_build_id/metadata/ | jq -r '.gcc_version')" + - echo "The last tested GCC version $last_tested_gcc_version" + - | + if [ "$gcc_version" != "$last_tested_gcc_version" ]; then + echo "GCC verion changed, about to test the new version ..." + else + echo "GCC verion not changed, skipping gcc tests ..." + exit 0 + fi # oe-selftest inherits the current 'build/conf/local.conf' to create # '../build-st/conf/local.conf' for qemu image building. Adding the # MACHINE variable to the current local conf allows test job to customize @@ -502,6 +516,7 @@ - find ../build-st \( -name "*.sum" -o -name "*.log" \) \( -path "*/gcc-runtime/*testsuite*" \) -exec cp --verbose {} "$ARTIFACTS_DIR" \; - for file in $(find "$ARTIFACTS_DIR" -type f); do xz $file; done + - echo "$gcc_version" > $ARTIFACTS_DIR/gcc_version - rm -rf ../build-st artifacts: paths: