Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Manually pull the complement branch matching the current branch name. #10160

Merged
merged 4 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,12 @@ jobs:
with:
path: synapse

- name: Run actions/checkout@v2 for complement
uses: actions/checkout@v2
with:
repository: "matrix-org/complement"
path: complement
# Attempt to check out the same branch of Complement as the PR. If it
# doesn't exist, fallback to master.
- name: Checkout complement
run: |
mkdir -p complement
(wget -O - https://github.com/matrix-org/complement/archive/$GITHUB_HEAD_REF.tar.gz || wget -O - https://github.com/matrix-org/complement/archive/master.tar.gz) | tar -xz --strip-components=1 -C complement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up $GITHUB_HEAD_REF is only set for PRs, though I think this is fine as probably will want to test release-* and develop branches against Complement master anyhow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that, but don't we only run builds for PRs anyway?

There's also $GITHUB_REF, but I don't think that returns the information I need.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check the top of the workflow file you'll see that we run it whenever develop or release-* branches are pushed to:

on:
push:
branches: ["develop", "release-*"]
pull_request:

Copy link
Contributor

@callahad callahad Jun 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be cleaner to keep using actions/checkout@v2 here and just do a full clone (fetch-depth: 0) followed by opportunistically trying to git checkout the matching branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anoadragon453 Thanks! I believe I've updated this to take this into account, it now:

  1. Uses GITHUB_HEAD_REF if it exists.
  2. Falls back to GITHUB_REF (and cuts off a refs/head/ prefix)
  3. Falls back to master


# Build initial Synapse image
- run: docker build -t matrixdotorg/synapse:latest -f docker/Dockerfile .
Expand Down
1 change: 1 addition & 0 deletions changelog.d/10160.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fetch the corresponding complement branch when performing CI.