Skip to content
Snippets Groups Projects
Commit 26a364b5 authored by catch's avatar catch
Browse files

Issue #3419182 by longwave: Test-only job fails with "couldn't find remote ref...

Issue #3419182 by longwave: Test-only job fails with "couldn't find remote ref refs/heads/11.x" when 11.x branch does not exist in fork

(cherry picked from commit 1911eb11)
parent 6567f4f0
Branches
Tags
9 merge requests!8376Drupal views: adding more granularity to the ‘use ajax’ functionality,!8300Issue #3443586 View area displays even when parent view has no results.,!7567Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7565Issue #3153723 by quietone, Hardik_Patel_12: Change the scaffolding...,!7509Change label "Block description" to "Block type",!7344Issue #3292350 by O'Briat, KlemenDEV, hswong3i, smustgrave, quietone: Update...,!6922Issue #3412959 by quietone, smustgrave, longwave: Fix 12 'un' words,!6848Issue #3417553 by longwave: Remove withConsecutive() in CacheCollectorTest,!6720Revert "Issue #3358581 by pfrenssen, _tarik_, a.dmitriiev, smustgrave:...
Pipeline #99719 passed
Pipeline: drupal

#99735

    Pipeline: drupal

    #99729

      Pipeline: drupal

      #99725

        +1
        #!/bin/bash
        export TARGET_BRANCH=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}${CI_COMMIT_BRANCH}
        git fetch -vn --depth=50 origin "+refs/heads/$TARGET_BRANCH:refs/heads/$TARGET_BRANCH"
        BASELINE=${CI_MERGE_REQUEST_TARGET_BRANCH_SHA:-$CI_MERGE_REQUEST_DIFF_BASE_SHA}
        echo "ℹ️ Changes from ${TARGET_BRANCH}"
        git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --name-only
        echo "ℹ️ Changes from ${BASELINE}"
        git diff ${BASELINE} --name-only
        echo "If this list contains more files than what you changed, then you need to rebase your branch."
        echo "1️⃣ Reverting non test changes"
        if [[ $(git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --diff-filter=DM --name-only|grep -Ev "*/tests/*"|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 "*/tests/*"|grep -v .gitlab-ci|grep -v scripts/run-tests.sh|while read file;do
        if [[ $(git diff ${BASELINE} --diff-filter=DM --name-only|grep -Ev "*/tests/*"|grep -v .gitlab-ci|grep -v scripts/run-tests.sh) ]]; then
        git diff ${BASELINE} --diff-filter=DM --name-only|grep -Ev "*/tests/*"|grep -v .gitlab-ci|grep -v scripts/run-tests.sh|while read file;do
        echo "↩️ Reverting $file";
        git checkout refs/heads/${TARGET_BRANCH} -- $file;
        git checkout ${BASELINE} -- $file;
        done
        fi
        if [[ $(git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --diff-filter=A --name-only|grep -Ev "*/tests/*"|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 "*/tests/*"|grep -v .gitlab-ci|grep -v scripts/run-tests.sh|while read file;do
        if [[ $(git diff ${BASELINE} --diff-filter=A --name-only|grep -Ev "*/tests/*"|grep -v .gitlab-ci|grep -v scripts/run-tests.sh) ]]; then
        git diff ${BASELINE} --diff-filter=A --name-only|grep -Ev "*/tests/*"|grep -v .gitlab-ci|grep -v scripts/run-tests.sh|while read file;do
        echo "🗑️️ Deleting $file";
        git rm $file;
        done
        fi
        echo "2️⃣ Running test changes for this branch"
        if [[ $(git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --name-only|grep -E "Test.php$") ]]; then
        for test in `git diff ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --name-only|grep -E "Test.php$"`; do
        if [[ $(git diff ${BASELINE} --name-only|grep -E "Test.php$") ]]; then
        for test in `git diff ${BASELINE} --name-only|grep -E "Test.php$"`; do
        sudo SIMPLETEST_BASE_URL="$SIMPLETEST_BASE_URL" SIMPLETEST_DB="$SIMPLETEST_DB" MINK_DRIVER_ARGS_WEBDRIVER="$MINK_DRIVER_ARGS_WEBDRIVER" -u www-data ./vendor/bin/phpunit -c core $test --log-junit=./sites/default/files/simpletest/phpunit-`echo $test|sed 's/\//_/g' `.xml;
        done;
        fi
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment