From 87777d293eb31236cf64a7ae4aba87ba47824fd2 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Thu, 16 Aug 2018 23:22:58 +1000 Subject: [PATCH 01/15] try some circle ci + merged stuff --- .circleci/config.yml | 58 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e03f01b83703..442e292d0b72 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,6 +9,8 @@ jobs: - store_artifacts: path: ~/project/logs destination: logs + - store_test_results: + path: logs sytestpy2postgres: machine: true steps: @@ -18,6 +20,32 @@ jobs: - store_artifacts: path: ~/project/logs destination: logs + - store_test_results: + path: logs + sytestpy2merged: + machine: true + steps: + - checkout + - run: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" + - run: docker pull matrixdotorg/sytest-synapsepy2 + - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs matrixdotorg/sytest-synapsepy2 + - store_artifacts: + path: ~/project/logs + destination: logs + - store_test_results: + path: logs + sytestpy2postgresmerged: + machine: true + steps: + - checkout + - run: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" + - run: docker pull matrixdotorg/sytest-synapsepy2 + - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 matrixdotorg/sytest-synapsepy2 + - store_artifacts: + path: ~/project/logs + destination: logs + - store_test_results: + path: logs sytestpy3: machine: true steps: @@ -27,6 +55,8 @@ jobs: - store_artifacts: path: ~/project/logs destination: logs + - store_test_results: + path: logs sytestpy3postgres: machine: true steps: @@ -36,6 +66,32 @@ jobs: - store_artifacts: path: ~/project/logs destination: logs + - store_test_results: + path: logs + sytestpy3merged: + machine: true + steps: + - checkout + - run: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" + - run: docker pull matrixdotorg/sytest-synapsepy3 + - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs hawkowl/sytestpy3 + - store_artifacts: + path: ~/project/logs + destination: logs + - store_test_results: + path: logs + sytestpy3postgresmerged: + machine: true + steps: + - checkout + - run: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" + - run: docker pull matrixdotorg/sytest-synapsepy3 + - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 matrixdotorg/sytest-synapsepy3 + - store_artifacts: + path: ~/project/logs + destination: logs + - store_test_results: + path: logs workflows: version: 2 @@ -43,6 +99,8 @@ workflows: jobs: - sytestpy2 - sytestpy2postgres + - sytestpy2merged + - sytestpy2postgresmerged # Currently broken while the Python 3 port is incomplete # - sytestpy3 # - sytestpy3postgres From 0e71a0da63104d23d34eaecd9f6899bb2b722ce7 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Thu, 16 Aug 2018 23:25:50 +1000 Subject: [PATCH 02/15] try this? --- .circleci/config.yml | 76 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 442e292d0b72..570d3caad6ea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,7 +26,24 @@ jobs: machine: true steps: - checkout - - run: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" + - | + if [[ -n "${CIRCLE_PR_NUMBER}" ]] + then + # Update PR refs for testing. + FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" + + # Retrieve the refs + git fetch -u origin ${FETCH_REFS} + + # Checkout PR merge ref. + git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" + + # Test for merge conflicts. + git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null + git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null + fi - run: docker pull matrixdotorg/sytest-synapsepy2 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs matrixdotorg/sytest-synapsepy2 - store_artifacts: @@ -38,7 +55,24 @@ jobs: machine: true steps: - checkout - - run: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" + - | + if [[ -n "${CIRCLE_PR_NUMBER}" ]] + then + # Update PR refs for testing. + FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" + + # Retrieve the refs + git fetch -u origin ${FETCH_REFS} + + # Checkout PR merge ref. + git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" + + # Test for merge conflicts. + git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null + git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null + fi - run: docker pull matrixdotorg/sytest-synapsepy2 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 matrixdotorg/sytest-synapsepy2 - store_artifacts: @@ -72,7 +106,24 @@ jobs: machine: true steps: - checkout - - run: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" + - | + if [[ -n "${CIRCLE_PR_NUMBER}" ]] + then + # Update PR refs for testing. + FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" + + # Retrieve the refs + git fetch -u origin ${FETCH_REFS} + + # Checkout PR merge ref. + git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" + + # Test for merge conflicts. + git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null + git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null + fi - run: docker pull matrixdotorg/sytest-synapsepy3 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs hawkowl/sytestpy3 - store_artifacts: @@ -84,7 +135,24 @@ jobs: machine: true steps: - checkout - - run: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge" + - | + if [[ -n "${CIRCLE_PR_NUMBER}" ]] + then + # Update PR refs for testing. + FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" + + # Retrieve the refs + git fetch -u origin ${FETCH_REFS} + + # Checkout PR merge ref. + git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" + + # Test for merge conflicts. + git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null + git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null + fi - run: docker pull matrixdotorg/sytest-synapsepy3 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 matrixdotorg/sytest-synapsepy3 - store_artifacts: From 5cf833e0c5c76fdb4de337f169e2066259be42cc Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Thu, 16 Aug 2018 23:38:08 +1000 Subject: [PATCH 03/15] try this --- .circleci/config.yml | 124 ++++++++++++++++++++++--------------------- 1 file changed, 64 insertions(+), 60 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 570d3caad6ea..6023d0878ce1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,24 +26,25 @@ jobs: machine: true steps: - checkout - - | - if [[ -n "${CIRCLE_PR_NUMBER}" ]] - then - # Update PR refs for testing. - FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" + - run: + command: | + if [[ -n "${CIRCLE_PR_NUMBER}" ]] + then + # Update PR refs for testing. + FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" - # Retrieve the refs - git fetch -u origin ${FETCH_REFS} + # Retrieve the refs + git fetch -u origin ${FETCH_REFS} - # Checkout PR merge ref. - git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" + # Checkout PR merge ref. + git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" - # Test for merge conflicts. - git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null - git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null - fi + # Test for merge conflicts. + git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null + git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null + fi - run: docker pull matrixdotorg/sytest-synapsepy2 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs matrixdotorg/sytest-synapsepy2 - store_artifacts: @@ -55,24 +56,25 @@ jobs: machine: true steps: - checkout - - | - if [[ -n "${CIRCLE_PR_NUMBER}" ]] - then - # Update PR refs for testing. - FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" + - run: + command: | + if [[ -n "${CIRCLE_PR_NUMBER}" ]] + then + # Update PR refs for testing. + FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" - # Retrieve the refs - git fetch -u origin ${FETCH_REFS} + # Retrieve the refs + git fetch -u origin ${FETCH_REFS} - # Checkout PR merge ref. - git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" + # Checkout PR merge ref. + git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" - # Test for merge conflicts. - git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null - git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null - fi + # Test for merge conflicts. + git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null + git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null + fi - run: docker pull matrixdotorg/sytest-synapsepy2 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 matrixdotorg/sytest-synapsepy2 - store_artifacts: @@ -106,24 +108,25 @@ jobs: machine: true steps: - checkout - - | - if [[ -n "${CIRCLE_PR_NUMBER}" ]] - then - # Update PR refs for testing. - FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" + - run: + command: | + if [[ -n "${CIRCLE_PR_NUMBER}" ]] + then + # Update PR refs for testing. + FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" - # Retrieve the refs - git fetch -u origin ${FETCH_REFS} + # Retrieve the refs + git fetch -u origin ${FETCH_REFS} - # Checkout PR merge ref. - git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" + # Checkout PR merge ref. + git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" - # Test for merge conflicts. - git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null - git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null - fi + # Test for merge conflicts. + git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null + git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null + fi - run: docker pull matrixdotorg/sytest-synapsepy3 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs hawkowl/sytestpy3 - store_artifacts: @@ -135,24 +138,25 @@ jobs: machine: true steps: - checkout - - | - if [[ -n "${CIRCLE_PR_NUMBER}" ]] - then - # Update PR refs for testing. - FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" + - run: + command: | + if [[ -n "${CIRCLE_PR_NUMBER}" ]] + then + # Update PR refs for testing. + FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" - # Retrieve the refs - git fetch -u origin ${FETCH_REFS} + # Retrieve the refs + git fetch -u origin ${FETCH_REFS} - # Checkout PR merge ref. - git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" + # Checkout PR merge ref. + git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" - # Test for merge conflicts. - git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null - git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null - fi + # Test for merge conflicts. + git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null + git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null + fi - run: docker pull matrixdotorg/sytest-synapsepy3 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 matrixdotorg/sytest-synapsepy3 - store_artifacts: From 03efbf2f5f67af693ae8180260bb2c5ff9eb0c78 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Thu, 16 Aug 2018 23:45:48 +1000 Subject: [PATCH 04/15] *unhappy noises* --- .circleci/config.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6023d0878ce1..358be549424d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,6 +28,8 @@ jobs: - checkout - run: command: | + echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV + source $BASH_ENV if [[ -n "${CIRCLE_PR_NUMBER}" ]] then # Update PR refs for testing. @@ -58,6 +60,8 @@ jobs: - checkout - run: command: | + echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV + source $BASH_ENV if [[ -n "${CIRCLE_PR_NUMBER}" ]] then # Update PR refs for testing. @@ -110,6 +114,8 @@ jobs: - checkout - run: command: | + echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV + source $BASH_ENV if [[ -n "${CIRCLE_PR_NUMBER}" ]] then # Update PR refs for testing. @@ -140,6 +146,8 @@ jobs: - checkout - run: command: | + echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV + source $BASH_ENV if [[ -n "${CIRCLE_PR_NUMBER}" ]] then # Update PR refs for testing. From 9bb96a6675ba4bec0cf08a587182c0bc456dd54c Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Thu, 16 Aug 2018 23:56:59 +1000 Subject: [PATCH 05/15] try this maybeee --- .circleci/config.yml | 88 ++-------------------------------- .circleci/merge_base_branch.sh | 18 +++++++ 2 files changed, 22 insertions(+), 84 deletions(-) create mode 100644 .circleci/merge_base_branch.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 358be549424d..dd55b54114e6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,27 +26,7 @@ jobs: machine: true steps: - checkout - - run: - command: | - echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV - source $BASH_ENV - if [[ -n "${CIRCLE_PR_NUMBER}" ]] - then - # Update PR refs for testing. - FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" - - # Retrieve the refs - git fetch -u origin ${FETCH_REFS} - - # Checkout PR merge ref. - git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" - - # Test for merge conflicts. - git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null - git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null - fi + - run: bash .circleci/merge_base_branch.sh - run: docker pull matrixdotorg/sytest-synapsepy2 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs matrixdotorg/sytest-synapsepy2 - store_artifacts: @@ -58,27 +38,7 @@ jobs: machine: true steps: - checkout - - run: - command: | - echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV - source $BASH_ENV - if [[ -n "${CIRCLE_PR_NUMBER}" ]] - then - # Update PR refs for testing. - FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" - - # Retrieve the refs - git fetch -u origin ${FETCH_REFS} - - # Checkout PR merge ref. - git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" - - # Test for merge conflicts. - git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null - git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null - fi + - run: bash .circleci/merge_base_branch.sh - run: docker pull matrixdotorg/sytest-synapsepy2 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 matrixdotorg/sytest-synapsepy2 - store_artifacts: @@ -112,27 +72,7 @@ jobs: machine: true steps: - checkout - - run: - command: | - echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV - source $BASH_ENV - if [[ -n "${CIRCLE_PR_NUMBER}" ]] - then - # Update PR refs for testing. - FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" - - # Retrieve the refs - git fetch -u origin ${FETCH_REFS} - - # Checkout PR merge ref. - git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" - - # Test for merge conflicts. - git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null - git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null - fi + - run: bash .circleci/merge_base_branch.sh - run: docker pull matrixdotorg/sytest-synapsepy3 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs hawkowl/sytestpy3 - store_artifacts: @@ -144,27 +84,7 @@ jobs: machine: true steps: - checkout - - run: - command: | - echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV - source $BASH_ENV - if [[ -n "${CIRCLE_PR_NUMBER}" ]] - then - # Update PR refs for testing. - FETCH_REFS="+${CIRCLE_PR_BASE_BRANCH}:${CIRCLE_PR_BASE_BRANCH}" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" - - # Retrieve the refs - git fetch -u origin ${FETCH_REFS} - - # Checkout PR merge ref. - git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" - - # Test for merge conflicts. - git branch --merged | grep ${CIRCLE_PR_BASE_BRANCH} > /dev/null - git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null - fi + - run: bash .circleci/merge_base_branch.sh - run: docker pull matrixdotorg/sytest-synapsepy3 - run: docker run --rm -it -v $(pwd)\:/src -v $(pwd)/logs\:/logs -e POSTGRES=1 matrixdotorg/sytest-synapsepy3 - store_artifacts: diff --git a/.circleci/merge_base_branch.sh b/.circleci/merge_base_branch.sh new file mode 100644 index 000000000000..8e7899514be1 --- /dev/null +++ b/.circleci/merge_base_branch.sh @@ -0,0 +1,18 @@ +echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV +source $BASH_ENV + +if [[ -n "${CIRCLE_PR_NUMBER}" ]] +then + # Update PR refs for testing. + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" + FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" + + # Retrieve the refs + git fetch -u origin ${FETCH_REFS} + + # Checkout PR merge ref. + git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" + + # Test for merge conflicts. + git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null +fi From 21e24e2f9170223d9d22db9a74f021b84ddfc7e1 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Thu, 16 Aug 2018 23:58:36 +1000 Subject: [PATCH 06/15] fixup --- .circleci/merge_base_branch.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/merge_base_branch.sh b/.circleci/merge_base_branch.sh index 8e7899514be1..6d0fceb060b6 100644 --- a/.circleci/merge_base_branch.sh +++ b/.circleci/merge_base_branch.sh @@ -15,4 +15,8 @@ then # Test for merge conflicts. git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null + fi + +# Log what we are +git show -s From 83a027213bbc08f19e1327d4011f861cf28af248 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Fri, 17 Aug 2018 00:11:23 +1000 Subject: [PATCH 07/15] changelog --- changelog.d/3704.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/3704.misc diff --git a/changelog.d/3704.misc b/changelog.d/3704.misc new file mode 100644 index 000000000000..aaae0fbd6304 --- /dev/null +++ b/changelog.d/3704.misc @@ -0,0 +1 @@ +CircleCI tests now run on the potential merge of a PR. From d4df26268d72eb2d09846eae982a53a6a302ed42 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Fri, 17 Aug 2018 02:43:06 +1000 Subject: [PATCH 08/15] bump the CI --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index dd55b54114e6..80f45fdd0a8e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,6 +46,7 @@ jobs: destination: logs - store_test_results: path: logs + sytestpy3: machine: true steps: From b125a87a95b1fe30c4e1d4b92b9117152085f882 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Tue, 21 Aug 2018 01:17:44 +1000 Subject: [PATCH 09/15] review comments --- .circleci/merge_base_branch.sh | 4 ++++ 1 file changed, 4 insertions(+) mode change 100644 => 100755 .circleci/merge_base_branch.sh diff --git a/.circleci/merge_base_branch.sh b/.circleci/merge_base_branch.sh old mode 100644 new mode 100755 index 6d0fceb060b6..7a9e06b22744 --- a/.circleci/merge_base_branch.sh +++ b/.circleci/merge_base_branch.sh @@ -1,3 +1,7 @@ +#!/usr/bin/env bash + +set -e + echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV source $BASH_ENV From 9e49f283fb6208a3224af245a59fc615ee7fbeda Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Tue, 21 Aug 2018 01:31:04 +1000 Subject: [PATCH 10/15] comment --- .circleci/merge_base_branch.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/merge_base_branch.sh b/.circleci/merge_base_branch.sh index 7a9e06b22744..775ba7536be8 100755 --- a/.circleci/merge_base_branch.sh +++ b/.circleci/merge_base_branch.sh @@ -2,6 +2,8 @@ set -e +# CircleCI doesn't give CIRCLE_PR_NUMBER in the environment for non-forked PRs. Wonderful. +# In this case, we just need to do some ~shell magic~ to strip it out of the PULL_REQUEST URL. echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV source $BASH_ENV From 2c5f22ae8ce2b36b9df60334d71a401f4f6b90e5 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Wed, 12 Sep 2018 22:50:14 +1000 Subject: [PATCH 11/15] fixes --- .circleci/config.yml | 17 +++++++++++++++++ .circleci/merge_base_branch.sh | 29 ++++++++++++++--------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 80f45fdd0a8e..70ed91761e3b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,6 +24,10 @@ jobs: path: logs sytestpy2merged: machine: true + branches: + ignore: + - develop + - master steps: - checkout - run: bash .circleci/merge_base_branch.sh @@ -34,8 +38,13 @@ jobs: destination: logs - store_test_results: path: logs + sytestpy2postgresmerged: machine: true + branches: + ignore: + - develop + - master steps: - checkout - run: bash .circleci/merge_base_branch.sh @@ -71,6 +80,10 @@ jobs: path: logs sytestpy3merged: machine: true + branches: + ignore: + - develop + - master steps: - checkout - run: bash .circleci/merge_base_branch.sh @@ -83,6 +96,10 @@ jobs: path: logs sytestpy3postgresmerged: machine: true + branches: + ignore: + - develop + - master steps: - checkout - run: bash .circleci/merge_base_branch.sh diff --git a/.circleci/merge_base_branch.sh b/.circleci/merge_base_branch.sh index 775ba7536be8..2d700dbf1189 100755 --- a/.circleci/merge_base_branch.sh +++ b/.circleci/merge_base_branch.sh @@ -4,25 +4,24 @@ set -e # CircleCI doesn't give CIRCLE_PR_NUMBER in the environment for non-forked PRs. Wonderful. # In this case, we just need to do some ~shell magic~ to strip it out of the PULL_REQUEST URL. -echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> $BASH_ENV +echo 'export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}"' >> "$BASH_ENV" source $BASH_ENV -if [[ -n "${CIRCLE_PR_NUMBER}" ]] +if [[ -z "${CIRCLE_PR_NUMBER}" ]] then - # Update PR refs for testing. - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/head:pr/${CIRCLE_PR_NUMBER}/head" - FETCH_REFS="${FETCH_REFS} +refs/pull/${CIRCLE_PR_NUMBER}/merge:pr/${CIRCLE_PR_NUMBER}/merge" + echo "Can't figure out what the PR number is!" + exit 1 +fi - # Retrieve the refs - git fetch -u origin ${FETCH_REFS} +# Get the reference, using the GitHub API +GITBASE=`curl -q https://api.github.com/repos/matrix-org/synapse/pulls/${CIRCLE_PR_NUMBER} | jq -r '.base.ref'` - # Checkout PR merge ref. - git checkout -qf "pr/${CIRCLE_PR_NUMBER}/merge" +# Show what we are before +git show -s - # Test for merge conflicts. - git branch --merged | grep "pr/${CIRCLE_PR_NUMBER}/head" > /dev/null +# Fetch and merge. If it doesn't work, it will raise due to set -e. +git fetch -u origin $GITBASE +git merge --no-edit origin/$GITBASE -fi - -# Log what we are -git show -s +# Show what we are after. +git show -s \ No newline at end of file From 3a5ef4993c9684cf39dd106b37d58a5c02e9fb43 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Wed, 12 Sep 2018 23:00:23 +1000 Subject: [PATCH 12/15] fix? --- .circleci/config.yml | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 70ed91761e3b..bb461c2d14e4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,10 +24,6 @@ jobs: path: logs sytestpy2merged: machine: true - branches: - ignore: - - develop - - master steps: - checkout - run: bash .circleci/merge_base_branch.sh @@ -41,10 +37,6 @@ jobs: sytestpy2postgresmerged: machine: true - branches: - ignore: - - develop - - master steps: - checkout - run: bash .circleci/merge_base_branch.sh @@ -80,10 +72,6 @@ jobs: path: logs sytestpy3merged: machine: true - branches: - ignore: - - develop - - master steps: - checkout - run: bash .circleci/merge_base_branch.sh @@ -96,10 +84,6 @@ jobs: path: logs sytestpy3postgresmerged: machine: true - branches: - ignore: - - develop - - master steps: - checkout - run: bash .circleci/merge_base_branch.sh @@ -117,8 +101,20 @@ workflows: jobs: - sytestpy2 - sytestpy2postgres - - sytestpy2merged - - sytestpy2postgresmerged + build-merged: + jobs: + - sytestpy2merged: + filters: + branches: + ignore: + - develop + - master + - sytestpy2postgresmerged: + filters: + branches: + ignore: + - develop + - master # Currently broken while the Python 3 port is incomplete # - sytestpy3 # - sytestpy3postgres From 70aa93ad6f6c29a94cf513f6521814b93325f499 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Wed, 12 Sep 2018 23:02:34 +1000 Subject: [PATCH 13/15] fix??? --- .circleci/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bb461c2d14e4..5b5f6796cbb8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -101,8 +101,6 @@ workflows: jobs: - sytestpy2 - sytestpy2postgres - build-merged: - jobs: - sytestpy2merged: filters: branches: From a6f970d06fd258163f6170d16de1ab80a86d45e4 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Wed, 12 Sep 2018 23:10:53 +1000 Subject: [PATCH 14/15] try>? --- .circleci/config.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5b5f6796cbb8..cc892affb0b8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -104,15 +104,11 @@ workflows: - sytestpy2merged: filters: branches: - ignore: - - develop - - master + ignore: /develop|master/ - sytestpy2postgresmerged: filters: branches: - ignore: - - develop - - master + ignore: /develop|master/ # Currently broken while the Python 3 port is incomplete # - sytestpy3 # - sytestpy3postgres From 0ee96d2cdd0fd0e08959e459760055ad53fa4874 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Wed, 12 Sep 2018 23:13:57 +1000 Subject: [PATCH 15/15] i hate yaml --- .circleci/config.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cc892affb0b8..5266544f3c37 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,13 +102,13 @@ workflows: - sytestpy2 - sytestpy2postgres - sytestpy2merged: - filters: - branches: - ignore: /develop|master/ + filters: + branches: + ignore: /develop|master/ - sytestpy2postgresmerged: - filters: - branches: - ignore: /develop|master/ + filters: + branches: + ignore: /develop|master/ # Currently broken while the Python 3 port is incomplete # - sytestpy3 # - sytestpy3postgres