-
Notifications
You must be signed in to change notification settings - Fork 54
106 lines (92 loc) · 4.49 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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,msc3083
default_branch: develop
- homeserver: Dendrite
tags: msc2836 dendrite_blacklist
default_branch: master
steps:
- uses: actions/checkout@v2 # Checkout complement
# Env vars are set file a file given by $GITHUB_PATH. We need both Go 1.17 and GOPATH on env.
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
- name: "Set Go Version"
run: |
echo "$GOROOT_1_17_X64/bin" >> $GITHUB_PATH
echo "~/go/bin" >> $GITHUB_PATH
# Similar steps as dockerfiles/ComplementCIBuildkite.Dockerfile but on the host. We need
# to do this so we can _be_ the host when running Complement so we can snaffle all the ports. If
# we run Complement _in_ Docker then we can't -p all high numbered ports which then breaks federation
# servers which listen on random high numbered ports.
- name: "Install Complement Dependencies"
# We don't need to install Go because it is included on the Ubuntu 20.04 image:
# See https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md specifically GOROOT_1_17_X64
run: |
sudo apt-get update && sudo apt-get install -y libolm3 libolm-dev
go get -v github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
- name: "Checkout corresponding ${{ matrix.homeserver }} branch"
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 homeserver image
# Build the base Synapse dockerfile and then build a Complement-specific image from that base.
- run: docker build -t matrixdotorg/synapse:latest -f docker/Dockerfile .
if: ${{ matrix.homeserver == 'Synapse' }}
working-directory: homeserver
env:
DOCKER_BUILDKIT: 1
- run: docker build -t homeserver -f dockerfiles/${{ matrix.homeserver }}.Dockerfile dockerfiles/
if: ${{ matrix.homeserver == 'Synapse' }}
# Build the Complement-specific dendrite image from the dockerfile in the Dendrite repo.
# We don't use the dockerfiles in the Complement repo as they tend to get stale quickly.
- run: docker build -t homeserver -f build/scripts/Complement.Dockerfile .
if: ${{ matrix.homeserver == 'Dendrite' }}
working-directory: homeserver
- run: |
set -o pipefail &&
go test -p 1 -v -json -tags "${{ matrix.tags }}" ./tests/... 2>&1 | gotestfmt
shell: bash # required for pipefail to be A Thing. pipefail is required to stop gotestfmt swallowing non-zero exit codes
name: Run Complement Tests
env:
COMPLEMENT_BASE_IMAGE: homeserver
COMPLEMENT_DEBUG: 1
DOCKER_BUILDKIT: 1