Loading .gitlab-ci.yml +43 −0 Original line number Diff line number Diff line Loading @@ -1161,6 +1161,49 @@ clang-format-check: name: "$ARTIFACT_BASE_NAME" expose_as: "formatting patch" copyright-header-check: extends: - .test-job-linux - .rules-merge-request variables: ARTIFACT_BASE_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--copyright-fix" stage: prevalidate needs: [] timeout: "5 minutes" script: # Set up variables. This can't be done in the "variables" section because variables are not expanded properly there - PATCH_FILE_NAME="$ARTIFACT_BASE_NAME".patch - > INSTRUCTIONS_GITLAB="To fix the copyright header:\n - download the diff patch available as artifact of this job\n - unzip the artifact and place the patch file in the root directory of your local IVAS repo\n - run: git apply $PATCH_FILE_NAME\n - commit new changes" - > INSTRUCTIONS_README="To fix the copyright header:\n - place the patch file in the root directory of your local IVAS repo\n - run: git apply $PATCH_FILE_NAME\n - commit new changes" - mkdir tmp-copyright-fix - changes=$(ci/check_update_copyright.sh tmp-copyright-fix/$PATCH_FILE_NAME) - if [[ $changes -eq 0 ]]; then exit 0; fi # Print instructions to job output - echo -e "$INSTRUCTIONS_GITLAB" # Include readme in the artifact, in case someone misses the job printout (e.g. getting the artifact via MR interface) - echo -e "$INSTRUCTIONS_README" > "tmp-copyright-fix/readme.txt" - exit $changes artifacts: expire_in: 1 day paths: - tmp-copyright-fix/ when: on_failure name: "$ARTIFACT_BASE_NAME" expose_as: "copyright patch" # check for crashes if first received frame on decoder side is an SID check-first-frame-is-sid: extends: Loading ci/check_update_copyright.sh 0 → 100755 +34 −0 Original line number Diff line number Diff line #!/bin/bash if [[ $# -ne 1 ]]; then echo "USAGE: $0 <PATCH_FILE_NAME>" exit -1 fi PATCH_FILE_NAME=$1 curr_year=$(date +'%Y') changes=0 lfs_files=$(git lfs ls-files -n) sed_list=$(mktemp) # iterate through tracked files for file in $(git ls-files); do # skip LFS files if [[ "$lfs_Files" == *"$file"* ]]; then continue fi # process only text files if file "$file" | grep -q 'text'; then echo $file >>$sed_list fi done xargs -n 1 -P 8 sed -i -E "s/\(C\)\s+202[0-9]-202[0-9]/(C) 2022-$curr_year/g" <$sed_list if [[ $(git status --porcelain --untracked-files=no) ]]; then changes=1 git diff >"$PATCH_FILE_NAME" fi exit $changes Loading
.gitlab-ci.yml +43 −0 Original line number Diff line number Diff line Loading @@ -1161,6 +1161,49 @@ clang-format-check: name: "$ARTIFACT_BASE_NAME" expose_as: "formatting patch" copyright-header-check: extends: - .test-job-linux - .rules-merge-request variables: ARTIFACT_BASE_NAME: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--copyright-fix" stage: prevalidate needs: [] timeout: "5 minutes" script: # Set up variables. This can't be done in the "variables" section because variables are not expanded properly there - PATCH_FILE_NAME="$ARTIFACT_BASE_NAME".patch - > INSTRUCTIONS_GITLAB="To fix the copyright header:\n - download the diff patch available as artifact of this job\n - unzip the artifact and place the patch file in the root directory of your local IVAS repo\n - run: git apply $PATCH_FILE_NAME\n - commit new changes" - > INSTRUCTIONS_README="To fix the copyright header:\n - place the patch file in the root directory of your local IVAS repo\n - run: git apply $PATCH_FILE_NAME\n - commit new changes" - mkdir tmp-copyright-fix - changes=$(ci/check_update_copyright.sh tmp-copyright-fix/$PATCH_FILE_NAME) - if [[ $changes -eq 0 ]]; then exit 0; fi # Print instructions to job output - echo -e "$INSTRUCTIONS_GITLAB" # Include readme in the artifact, in case someone misses the job printout (e.g. getting the artifact via MR interface) - echo -e "$INSTRUCTIONS_README" > "tmp-copyright-fix/readme.txt" - exit $changes artifacts: expire_in: 1 day paths: - tmp-copyright-fix/ when: on_failure name: "$ARTIFACT_BASE_NAME" expose_as: "copyright patch" # check for crashes if first received frame on decoder side is an SID check-first-frame-is-sid: extends: Loading
ci/check_update_copyright.sh 0 → 100755 +34 −0 Original line number Diff line number Diff line #!/bin/bash if [[ $# -ne 1 ]]; then echo "USAGE: $0 <PATCH_FILE_NAME>" exit -1 fi PATCH_FILE_NAME=$1 curr_year=$(date +'%Y') changes=0 lfs_files=$(git lfs ls-files -n) sed_list=$(mktemp) # iterate through tracked files for file in $(git ls-files); do # skip LFS files if [[ "$lfs_Files" == *"$file"* ]]; then continue fi # process only text files if file "$file" | grep -q 'text'; then echo $file >>$sed_list fi done xargs -n 1 -P 8 sed -i -E "s/\(C\)\s+202[0-9]-202[0-9]/(C) 2022-$curr_year/g" <$sed_list if [[ $(git status --porcelain --untracked-files=no) ]]; then changes=1 git diff >"$PATCH_FILE_NAME" fi exit $changes