Skip to content

Commit

Permalink
Attempt to pull the corresponding Synapse branch when running tests. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep authored Jul 26, 2021
1 parent eff9d80 commit dccd7c1
Showing 1 changed file with 34 additions and 0 deletions.
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' }}
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

0 comments on commit dccd7c1

Please sign in to comment.