-
Notifications
You must be signed in to change notification settings - Fork 54
87 lines (76 loc) · 3.1 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Tests
on:
push:
branches: [ 'master' ]
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: sudo apt-get -qq install libolm-dev
- uses: golangci/golangci-lint-action@v2
with:
version: v1.33
args: ./internal/... ./tests/...
complement:
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false # ensure if synapse fails we keep running dendrite and vice-versa
matrix:
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
env:
CI: true
DOCKER_BUILDKIT: 1
ports:
- 8448:8448
volumes:
- /var/run/docker.sock:/var/run/docker.sock
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. Check if there's a similarly named branch (GITHUB_HEAD_REF for pull
# requests, otherwise GITHUB_REF), but if this is the default complement
# branch, 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
continue
fi
# If this is complement's default branch, use the homeserver's default branch.
if [[ "$BRANCH_NAME" == "master" ]]; then
BRANCH_NAME="${{ matrix.default_branch }}"
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:
COMPLEMENT_BASE_IMAGE: homeserver