Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to pull the corresponding Synapse branch when running tests. #177

Merged
merged 5 commits into from
Jul 26, 2021
Merged
Changes from all commits
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
34 changes: 34 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -41,6 +43,38 @@ jobs:

steps:
- 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' }}
Copy link
Member

Choose a reason for hiding this comment

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

We should perhaps put in a comment here to explain why Dendrite doesn't need this.

shell: bash
run: |
mkdir -p homeserver
# 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.
#
# 1. First check if there's a similarly named branch (GITHUB_HEAD_REF
# for pull requests, otherwise GITHUB_REF).
# 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
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 .
# 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

- run: docker build -t homeserver -f dockerfiles/${{ matrix.homeserver }}.Dockerfile dockerfiles/
- run: go test -p 2 -v -tags "${{ matrix.tags }}" ./tests/...
env:
Expand Down