From 034810f3c48c17686b712ca8181284f0508d0195 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 26 Jul 2021 11:12:05 -0400 Subject: [PATCH 1/5] Attempt to pull the corresponding Synapse branch when running tests. --- .github/workflows/ci.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 30b7c002..5262fabb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,9 +25,11 @@ jobs: include: - homeserver: Synapse tags: synapse_blacklist,msc2403,msc2946,msc3083 + default_branch: develop - homeserver: Dendrite tags: msc2836 dendrite_blacklist + default_branch: master container: image: matrixdotorg/complement # dockerfiles/ComplementCIBuildkite.Dockerfile @@ -41,6 +43,35 @@ jobs: steps: - uses: actions/checkout@v2 + + - name: "Checkout corresponding ${{ matrix.homeserver }} branch" + if: ${{ matrix.homeserver == 'Synapse' }} + shell: bash + run: | + mkdir -p homeserver + # Attempt to use the version of of the homeserver 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 homeserver branch. + for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "${{ matrix.default_branch }}"; 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/${{ matrix.homeserver }}/archive/$BRANCH_NAME.tar.gz" | tar -xz --strip-components=1 -C homeserver) && break + done + + # Build initial homeserver image + - run: docker build -t matrixdotorg/synapse:latest -f docker/Dockerfile . + if: ${{ matrix.homeserver == 'Synapse' }} + working-directory: homeserver + - run: docker build -t homeserver -f dockerfiles/${{ matrix.homeserver }}.Dockerfile dockerfiles/ - run: go test -p 2 -v -tags "${{ matrix.tags }}" ./tests/... env: From 46204acedb735cca5afafd589b03a6514a3f34f8 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 26 Jul 2021 11:41:57 -0400 Subject: [PATCH 2/5] Skip using the GITHUB_BASE_PREF otherwise we always used master. --- .github/workflows/ci.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5262fabb..998b8531 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,10 +55,8 @@ jobs: # # 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 homeserver branch. - for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "${{ matrix.default_branch }}"; do + for BRANCH_NAME in "$GITHUB_HEAD_REF" "${GITHUB_REF#refs/heads/}" "${{ matrix.default_branch }}"; do # Skip empty branch names and merge commits. if [[ -z "$BRANCH_NAME" || $BRANCH_NAME =~ ^refs/pull/.* ]]; then continue From 05b6165442eb16501cfbac00d4ebcdef009c4afb Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 26 Jul 2021 12:25:30 -0400 Subject: [PATCH 3/5] Fix typo. Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 998b8531..96c4f214 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -49,7 +49,7 @@ jobs: shell: bash run: | mkdir -p homeserver - # Attempt to use the version of of the homeserver which best matches the + # Attempt to use the version of the homeserver which best matches the # current build. Depending on whether this is a PR or release, etc. we # need to use different fallbacks. # From 718d8104e3bd7321e47af2b95d1c7c66f768ecb2 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 26 Jul 2021 12:25:41 -0400 Subject: [PATCH 4/5] Fix numbering. Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 96c4f214..fdf27d97 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,7 +55,7 @@ jobs: # # 1. First check if there's a similarly named branch (GITHUB_HEAD_REF # for pull requests, otherwise GITHUB_REF). - # 3. Use the default homeserver branch. + # 2. Use the default homeserver branch. for BRANCH_NAME in "$GITHUB_HEAD_REF" "${GITHUB_REF#refs/heads/}" "${{ matrix.default_branch }}"; do # Skip empty branch names and merge commits. if [[ -z "$BRANCH_NAME" || $BRANCH_NAME =~ ^refs/pull/.* ]]; then From e9eb21df4d49d6375474918f410e2803e7b1876c Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Mon, 26 Jul 2021 12:26:58 -0400 Subject: [PATCH 5/5] Add a comment about why this is only for Synapse. --- .github/workflows/ci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index fdf27d97..6290b0f0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,6 +45,8 @@ jobs: - uses: actions/checkout@v2 - name: "Checkout corresponding ${{ matrix.homeserver }} branch" + # This is only done for Synapse since Dendrite's docker file pulls in + # the Dendrite sources directly. if: ${{ matrix.homeserver == 'Synapse' }} shell: bash run: | @@ -67,6 +69,9 @@ jobs: # Build initial homeserver image - run: docker build -t matrixdotorg/synapse:latest -f docker/Dockerfile . + # We only do this for Synapse since Dendrite's docker file pulls in + # the Dendrite sources directly (instead of being based on a previously + # built docker image). if: ${{ matrix.homeserver == 'Synapse' }} working-directory: homeserver