@@ -306,7 +306,7 @@ jobs:
306
306
- run : .ci/scripts/test_synapse_port_db.sh
307
307
308
308
complement :
309
- if : ${{ !failure() && !cancelled() }}
309
+ if : " ${{ !failure() && !cancelled() }}"
310
310
needs : linting-done
311
311
runs-on : ubuntu-latest
312
312
@@ -333,30 +333,50 @@ jobs:
333
333
# Attempt to check out the same branch of Complement as the PR. If it
334
334
# doesn't exist, fallback to HEAD.
335
335
- name : Checkout complement
336
+ run : synapse/.ci/scripts/checkout_complement.sh
337
+
338
+ - run : |
339
+ set -o pipefail
340
+ COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
336
341
shell: bash
342
+ name: Run Complement Tests
343
+
344
+ # We only run the workers tests on `develop` for now, because they're too slow to wait for on PRs.
345
+ # Sadly, you can't have an `if` condition on the value of a matrix, so this is a temporary, separate job for now.
346
+ # GitHub Actions doesn't support YAML anchors, so it's full-on duplication for now.
347
+ complement-developonly :
348
+ if : " ${{ !failure() && !cancelled() && (github.ref == 'refs/heads/develop') }}"
349
+ needs : linting-done
350
+ runs-on : ubuntu-latest
351
+
352
+ steps :
353
+ # The path is set via a file given by $GITHUB_PATH. We need both Go 1.17 and GOPATH on the path to run Complement.
354
+ # See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
355
+ - name : " Set Go Version"
337
356
run : |
338
- mkdir -p complement
339
- # Attempt to use the version of complement which best matches the current
340
- # build. Depending on whether this is a PR or release, etc. we need to
341
- # use different fallbacks.
342
- #
343
- # 1. First check if there's a similarly named branch (GITHUB_HEAD_REF
344
- # for pull requests, otherwise GITHUB_REF).
345
- # 2. Attempt to use the base branch, e.g. when merging into release-vX.Y
346
- # (GITHUB_BASE_REF for pull requests).
347
- # 3. Use the default complement branch ("HEAD").
348
- for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "HEAD"; do
349
- # Skip empty branch names and merge commits.
350
- if [[ -z "$BRANCH_NAME" || $BRANCH_NAME =~ ^refs/pull/.* ]]; then
351
- continue
352
- fi
353
-
354
- (wget -O - "https://github.com/matrix-org/complement/archive/$BRANCH_NAME.tar.gz" | tar -xz --strip-components=1 -C complement) && break
355
- done
357
+ # Add Go 1.17 to the PATH: see https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#environment-variables-2
358
+ echo "$GOROOT_1_17_X64/bin" >> $GITHUB_PATH
359
+ # Add the Go path to the PATH: We need this so we can call gotestfmt
360
+ echo "~/go/bin" >> $GITHUB_PATH
361
+
362
+ - name : " Install Complement Dependencies"
363
+ run : |
364
+ sudo apt-get update && sudo apt-get install -y libolm3 libolm-dev
365
+ go get -v github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@latest
366
+
367
+ - name : Run actions/checkout@v2 for synapse
368
+ uses : actions/checkout@v2
369
+ with :
370
+ path : synapse
371
+
372
+ # Attempt to check out the same branch of Complement as the PR. If it
373
+ # doesn't exist, fallback to HEAD.
374
+ - name : Checkout complement
375
+ run : .ci/scripts/checkout_complement.sh
356
376
357
377
- run : |
358
378
set -o pipefail
359
- COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
379
+ WORKERS=1 COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
360
380
shell: bash
361
381
name: Run Complement Tests
362
382
0 commit comments