Skip to content
Snippets Groups Projects
Verified Commit dc8edd13 authored by Juraj Nemec's avatar Juraj Nemec
Browse files

Issue #3402945 by fjgarlin: [D7] Test-only job shouldn't require constant...

Issue #3402945 by fjgarlin: [D7] Test-only job shouldn't require constant rebases to detect which files were changed
parent 5542bf25
No related branches found
No related tags found
1 merge request!7330Issue #3306390 by poker10, catch, Fabianx, pwolanin, rvtraveller: [D7]...
Pipeline #57004 passed with warnings
Pipeline: drupal

#57013

    Pipeline: drupal

    #57012

      Pipeline: drupal

      #57011

        +6
        ......@@ -103,27 +103,27 @@ stages:
        - *prepare-dirs
        - *install-drupal
        - export TARGET_BRANCH=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}
        - git fetch -vn --depth=3 "$CI_MERGE_REQUEST_PROJECT_URL" "+refs/heads/$TARGET_BRANCH:refs/heads/$TARGET_BRANCH"
        - git fetch -vn --depth=50 "$CI_MERGE_REQUEST_PROJECT_URL" "+refs/heads/$TARGET_BRANCH:refs/heads/$TARGET_BRANCH"
        - |
        echo "ℹ️ Changes from ${TARGET_BRANCH}"
        git diff refs/heads/${TARGET_BRANCH} --name-only
        git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --name-only
        echo "1️⃣ Reverting non test changes"
        if [[ $(git diff refs/heads/${TARGET_BRANCH} --diff-filter=DM --name-only|grep -Ev '.test$'|grep -v .gitlab-ci|grep -v scripts/run-tests.sh) ]]; then
        git diff refs/heads/${TARGET_BRANCH} --diff-filter=DM --name-only|grep -Ev '.test$'|grep -v .gitlab-ci|grep -v scripts/run-tests.sh|while read file;do
        if [[ $(git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --diff-filter=DM --name-only|grep -Ev '.test$'|grep -v .gitlab-ci|grep -v scripts/run-tests.sh) ]]; then
        git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --diff-filter=DM --name-only|grep -Ev '.test$'|grep -v .gitlab-ci|grep -v scripts/run-tests.sh|while read file;do
        echo "↩️ Reverting $file"
        git checkout refs/heads/${TARGET_BRANCH} -- $file;
        done
        fi
        echo "2️⃣ Deleting new files"
        if [[ $(git diff refs/heads/${TARGET_BRANCH} --diff-filter=A --name-only|grep -Ev '.test$'|grep -v .gitlab-ci|grep -v scripts/run-tests.sh) ]]; then
        git diff refs/heads/${TARGET_BRANCH} --diff-filter=A --name-only|grep -Ev '.test$'|grep -v .gitlab-ci|grep -v scripts/run-tests.sh|while read file;do
        if [[ $(git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --diff-filter=A --name-only|grep -Ev '.test$'|grep -v .gitlab-ci|grep -v scripts/run-tests.sh) ]]; then
        git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --diff-filter=A --name-only|grep -Ev '.test$'|grep -v .gitlab-ci|grep -v scripts/run-tests.sh|while read file;do
        echo "🗑️️ Deleting $file"
        git rm $file
        done
        fi
        echo "3️⃣ Running test changes for this branch"
        if [[ $(git diff refs/heads/${TARGET_BRANCH} --name-only|grep -E '.test$') ]]; then
        git diff refs/heads/${TARGET_BRANCH} --name-only|grep -E ".test$"|while read file;do
        if [[ $(git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --name-only|grep -E '.test$') ]]; then
        git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --name-only|grep -E ".test$"|while read file;do
        sudo -u www-data php ./scripts/run-tests.sh --color --concurrency "$CONCURRENCY" --url "$SIMPLETEST_BASE_URL" --verbose --fail-only --xml "$CI_PROJECT_DIR/sites/default/files/simpletest/test-only" --file "$file"
        done
        fi
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment