From 812e68c8ec6f4c0c1025aa5c289e99c56b4cf9b7 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 6 Sep 2021 12:15:00 +0100 Subject: [PATCH 1/7] Dummy to run tests --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index 2249c8038..4f17d87ac 100644 --- a/README.rst +++ b/README.rst @@ -1,3 +1,5 @@ +Dummy to get tests to runnnn + SyTest ====== From 749c21d8ae20ad13d354c680cb311d2c62bda9db Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 6 Sep 2021 12:48:57 +0100 Subject: [PATCH 2/7] Another test --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index 4f17d87ac..52c80b43b 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,7 @@ Dummy to get tests to runnnn +Again now that I've made a corresponding branch + SyTest ====== From 82dc63701cc4799527bee04c97163ff62f3a2c60 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 6 Sep 2021 13:35:07 +0100 Subject: [PATCH 3/7] Try to fix CI fetching synapse branch --- .github/workflows/pipeline.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 9bb6fed32..386a2a3cf 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -60,12 +60,30 @@ jobs: with: path: sytest + # TODO the shell script below is nicked from complement. We use this pattern + # in a few places. Can we make this an Action so it's easier to reuse? - name: Fetch corresponding synapse branch shell: bash run: | - BRANCH=${GITHUB_REF#refs/heads/} - (wget -O - https://github.com/matrix-org/synapse/archive/$BRANCH.tar.gz || wget -O - https://github.com/matrix-org/synapse/archive/develop.tar.gz) \ - | tar -xz --strip-components=1 -C /src/ + # Attempt to use the version of synapse which best matches the current + # build. Depending on whether this is a PR or release, etc. we need to + # use different fallbacks. + # + # 1. First check if there's a similarly named branch (GITHUB_HEAD_REF + # for pull requests, otherwise GITHUB_REF). + # 2. Attempt to use the base branch, e.g. when merging into release-vX.Y + # (GITHUB_BASE_REF for pull requests). + # 3. Use the default synapse branch ("develop"). + for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "develop"; do + # Skip empty branch names and merge commits. + if [[ -z "$BRANCH_NAME" || $BRANCH_NAME =~ ^refs/pull/.* ]]; then + continue + fi + (wget -O - "https://github.com/matrix-org/synapse/archive/$BRANCH_NAME.tar.gz" \ + | tar -xz --strip-components=1 -C /src/) \ + && echo "Successully downloaded and extracted $BRANCH_NAME.tar.gz" \ + && break + done - name: Prepare blacklist file for running with workers if: ${{ matrix.workers }} From 0a2545f9396b7e7e325d4a2cfd7e8959e5864867 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 6 Sep 2021 13:45:58 +0100 Subject: [PATCH 4/7] Same fix for dendrite --- .github/workflows/pipeline.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 386a2a3cf..14fefc34c 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -147,12 +147,30 @@ jobs: with: path: sytest + # TODO the shell script below is nicked from complement. We use this pattern + # in a few places. Can we make this an Action so it's easier to reuse? - name: Fetch corresponding dendrite branch shell: bash run: | - BRANCH=${GITHUB_REF#refs/heads/} - (wget -O - https://github.com/matrix-org/dendrite/archive/$BRANCH.tar.gz || wget -O - https://github.com/matrix-org/dendrite/archive/master.tar.gz) \ - | tar -xz --strip-components=1 -C /src/ + # Attempt to use the version of dendrite which best matches the current + # build. Depending on whether this is a PR or release, etc. we need to + # use different fallbacks. + # + # 1. First check if there's a similarly named branch (GITHUB_HEAD_REF + # for pull requests, otherwise GITHUB_REF). + # 2. Attempt to use the base branch, e.g. when merging into release-vX.Y + # (GITHUB_BASE_REF for pull requests). + # 3. Use the default dendrite branch ("master"). + for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "master"; do + # Skip empty branch names and merge commits. + if [[ -z "$BRANCH_NAME" || $BRANCH_NAME =~ ^refs/pull/.* ]]; then + continue + fi + (wget -O - "https://github.com/matrix-org/dendrite/archive/$BRANCH_NAME.tar.gz" \ + | tar -xz --strip-components=1 -C /src/) \ + && echo "Successully downloaded and extracted $BRANCH_NAME.tar.gz" \ + && break + done - name: Run sytest run: | From 7956b51137c1b2dd5454b15ea6a4fffc87bf7321 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 6 Sep 2021 13:46:11 +0100 Subject: [PATCH 5/7] Revert the dummy test commits --- README.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.rst b/README.rst index 52c80b43b..2249c8038 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,3 @@ -Dummy to get tests to runnnn - -Again now that I've made a corresponding branch - SyTest ====== From 7af373c4672512e0cb60d02d44a85e290213ed5a Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 6 Sep 2021 15:39:41 +0100 Subject: [PATCH 6/7] Kill typo Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> --- .github/workflows/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 14fefc34c..97dcd9e10 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -168,7 +168,7 @@ jobs: fi (wget -O - "https://github.com/matrix-org/dendrite/archive/$BRANCH_NAME.tar.gz" \ | tar -xz --strip-components=1 -C /src/) \ - && echo "Successully downloaded and extracted $BRANCH_NAME.tar.gz" \ + && echo "Successfully downloaded and extracted $BRANCH_NAME.tar.gz" \ && break done From 20f92da9a5bed6af059ee940ebd3819f81fbe193 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Mon, 6 Sep 2021 18:42:57 +0100 Subject: [PATCH 7/7] Fix other typo (and trigger a CI run) --- .github/workflows/pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 97dcd9e10..4b9ebe0df 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -81,7 +81,7 @@ jobs: fi (wget -O - "https://github.com/matrix-org/synapse/archive/$BRANCH_NAME.tar.gz" \ | tar -xz --strip-components=1 -C /src/) \ - && echo "Successully downloaded and extracted $BRANCH_NAME.tar.gz" \ + && echo "Successfully downloaded and extracted $BRANCH_NAME.tar.gz" \ && break done