2022-10-27 12:12:50 +02:00
|
|
|
name: Scheduled
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *' # every day at midnight
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
# run Sytest in different variations
|
|
|
|
sytest:
|
|
|
|
timeout-minutes: 60
|
|
|
|
name: "Sytest (${{ matrix.label }})"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
2023-02-03 13:42:35 +01:00
|
|
|
- label: SQLite native
|
2022-10-27 12:12:50 +02:00
|
|
|
|
2023-02-03 13:42:35 +01:00
|
|
|
- label: SQLite Cgo
|
|
|
|
cgo: 1
|
|
|
|
|
2022-10-27 12:12:50 +02:00
|
|
|
- label: PostgreSQL
|
|
|
|
postgres: postgres
|
|
|
|
container:
|
|
|
|
image: matrixdotorg/sytest-dendrite:latest
|
|
|
|
volumes:
|
|
|
|
- ${{ github.workspace }}:/src
|
2022-12-02 11:44:20 +01:00
|
|
|
- /root/.cache/go-build:/github/home/.cache/go-build
|
|
|
|
- /root/.cache/go-mod:/gopath/pkg/mod
|
2022-10-27 12:12:50 +02:00
|
|
|
env:
|
|
|
|
POSTGRES: ${{ matrix.postgres && 1}}
|
|
|
|
SYTEST_BRANCH: ${{ github.head_ref }}
|
|
|
|
RACE_DETECTION: 1
|
2023-02-03 13:42:35 +01:00
|
|
|
COVER: 1
|
2022-10-27 12:12:50 +02:00
|
|
|
steps:
|
2022-12-02 11:44:20 +01:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
/gopath/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-sytest-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-sytest-
|
2022-10-27 12:12:50 +02:00
|
|
|
- name: Run Sytest
|
|
|
|
run: /bootstrap.sh dendrite
|
|
|
|
working-directory: /src
|
|
|
|
- name: Summarise results.tap
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
|
|
|
|
- name: Sytest List Maintenance
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: /src/show-expected-fail-tests.sh /logs/results.tap /src/sytest-whitelist /src/sytest-blacklist
|
|
|
|
continue-on-error: true # not fatal
|
|
|
|
- name: Are We Synapse Yet?
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: /src/are-we-synapse-yet.py /logs/results.tap -v
|
|
|
|
continue-on-error: true # not fatal
|
|
|
|
- name: Upload Sytest logs
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: ${{ always() }}
|
|
|
|
with:
|
2023-03-22 16:01:12 +01:00
|
|
|
name: Sytest Logs - ${{ job.status }} - (Dendrite ${{ join(matrix.*, ' ') }})
|
2022-10-27 12:12:50 +02:00
|
|
|
path: |
|
|
|
|
/logs/results.tap
|
|
|
|
/logs/**/*.log*
|
2023-03-22 17:36:33 +01:00
|
|
|
/logs/**/covdatafiles/**
|
2023-02-03 13:42:35 +01:00
|
|
|
|
|
|
|
sytest-coverage:
|
|
|
|
timeout-minutes: 5
|
|
|
|
name: "Sytest Coverage"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: sytest # only run once Sytest is done
|
2023-03-22 16:01:12 +01:00
|
|
|
if: ${{ always() }}
|
2023-02-03 13:42:35 +01:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
2023-02-14 12:47:47 +01:00
|
|
|
go-version: 'stable'
|
2023-02-03 13:42:35 +01:00
|
|
|
cache: true
|
|
|
|
- name: Download all artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
2023-03-22 14:51:18 +01:00
|
|
|
- name: Collect coverage
|
2023-02-03 13:42:35 +01:00
|
|
|
run: |
|
2023-03-22 16:01:12 +01:00
|
|
|
go tool covdata textfmt -i="$(find Sytest* -name 'covmeta*' -type f -exec dirname {} \; | uniq | paste -s -d ',' -)" -o sytest.cov
|
2023-03-22 14:58:36 +01:00
|
|
|
grep -Ev 'relayapi|setup/mscs|api_trace' sytest.cov > final.cov
|
2023-03-22 16:01:12 +01:00
|
|
|
go tool covdata func -i="$(find Sytest* -name 'covmeta*' -type f -exec dirname {} \; | uniq | paste -s -d ',' -)"
|
2023-02-03 13:42:35 +01:00
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
2023-03-22 14:51:18 +01:00
|
|
|
files: ./final.cov
|
2023-02-03 13:42:35 +01:00
|
|
|
flags: sytest
|
|
|
|
fail_ci_if_error: true
|
|
|
|
|
|
|
|
# run Complement
|
|
|
|
complement:
|
|
|
|
name: "Complement (${{ matrix.label }})"
|
|
|
|
timeout-minutes: 60
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- label: SQLite native
|
|
|
|
cgo: 0
|
|
|
|
|
|
|
|
- label: SQLite Cgo
|
|
|
|
cgo: 1
|
|
|
|
|
|
|
|
- label: PostgreSQL
|
|
|
|
postgres: Postgres
|
|
|
|
cgo: 0
|
|
|
|
steps:
|
|
|
|
# Env vars are set file a file given by $GITHUB_PATH. We need both Go 1.17 and GOPATH on env to run Complement.
|
|
|
|
# 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
|
|
|
|
- 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/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
|
|
|
|
- name: Run actions/checkout@v3 for dendrite
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
path: dendrite
|
|
|
|
|
|
|
|
# Attempt to check out the same branch of Complement as the PR. If it
|
|
|
|
# doesn't exist, fallback to main.
|
|
|
|
- name: Checkout complement
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p complement
|
|
|
|
# Attempt to use the version of complement 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. Attempt to use the base branch, e.g. when merging into release-vX.Y
|
|
|
|
# (GITHUB_BASE_REF for pull requests).
|
|
|
|
# 3. Use the default complement branch ("master").
|
|
|
|
for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "master"; 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/complement/archive/$BRANCH_NAME.tar.gz" | tar -xz --strip-components=1 -C complement) && break
|
|
|
|
done
|
|
|
|
# Build initial Dendrite image
|
2023-02-14 12:47:47 +01:00
|
|
|
- run: docker build --build-arg=CGO=${{ matrix.cgo }} -t complement-dendrite:${{ matrix.postgres }}${{ matrix.cgo }} -f build/scripts/Complement${{ matrix.postgres }}.Dockerfile .
|
2023-02-03 13:42:35 +01:00
|
|
|
working-directory: dendrite
|
|
|
|
env:
|
|
|
|
DOCKER_BUILDKIT: 1
|
|
|
|
|
|
|
|
- name: Create post test script
|
|
|
|
run: |
|
|
|
|
cat <<EOF > /tmp/posttest.sh
|
|
|
|
#!/bin/bash
|
|
|
|
mkdir -p /tmp/Complement/logs/\$2/\$1/
|
2023-03-22 14:12:06 +01:00
|
|
|
docker cp \$1:/tmp/covdatafiles/. /tmp/Complement/logs/\$2/\$1/
|
2023-02-03 13:42:35 +01:00
|
|
|
EOF
|
2023-01-11 17:52:58 +01:00
|
|
|
|
2023-02-03 13:42:35 +01:00
|
|
|
chmod +x /tmp/posttest.sh
|
|
|
|
# Run Complement
|
|
|
|
- run: |
|
|
|
|
set -o pipefail &&
|
|
|
|
go test -v -json -tags dendrite_blacklist ./tests/... 2>&1 | gotestfmt
|
|
|
|
shell: bash
|
|
|
|
name: Run Complement Tests
|
|
|
|
env:
|
2023-02-14 12:47:47 +01:00
|
|
|
COMPLEMENT_BASE_IMAGE: complement-dendrite:${{ matrix.postgres }}${{ matrix.cgo }}
|
2023-02-03 13:42:35 +01:00
|
|
|
COMPLEMENT_SHARE_ENV_PREFIX: COMPLEMENT_DENDRITE_
|
|
|
|
COMPLEMENT_DENDRITE_COVER: 1
|
|
|
|
COMPLEMENT_POST_TEST_SCRIPT: /tmp/posttest.sh
|
|
|
|
working-directory: complement
|
|
|
|
|
|
|
|
- name: Upload Complement logs
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
if: ${{ always() }}
|
|
|
|
with:
|
2023-03-22 16:01:12 +01:00
|
|
|
name: Complement Logs - (Dendrite ${{ join(matrix.*, ' ') }})
|
2023-02-03 13:42:35 +01:00
|
|
|
path: |
|
2023-03-22 14:12:06 +01:00
|
|
|
/tmp/Complement/logs/**
|
2023-02-03 13:42:35 +01:00
|
|
|
|
|
|
|
complement-coverage:
|
|
|
|
timeout-minutes: 5
|
|
|
|
name: "Complement Coverage"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: complement # only run once Complement is done
|
|
|
|
if: ${{ always() }}
|
|
|
|
steps:
|
2023-03-22 14:51:18 +01:00
|
|
|
- uses: actions/checkout@v3
|
2023-02-03 13:42:35 +01:00
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
2023-02-14 12:47:47 +01:00
|
|
|
go-version: 'stable'
|
2023-02-03 13:42:35 +01:00
|
|
|
cache: true
|
|
|
|
- name: Download all artifacts
|
|
|
|
uses: actions/download-artifact@v3
|
2023-03-22 14:12:06 +01:00
|
|
|
- name: Collect coverage
|
2023-02-03 13:42:35 +01:00
|
|
|
run: |
|
2023-03-22 16:01:12 +01:00
|
|
|
go tool covdata textfmt -i="$(find Complement* -name 'covmeta*' -type f -exec dirname {} \; | uniq | paste -s -d ',' -)" -o complement.cov
|
2023-03-22 14:12:06 +01:00
|
|
|
grep -Ev 'relayapi|setup/mscs|api_trace' complement.cov > final.cov
|
2023-03-22 16:01:12 +01:00
|
|
|
go tool covdata func -i="$(find Complement* -name 'covmeta*' -type f -exec dirname {} \; | uniq | paste -s -d ',' -)"
|
2023-02-03 13:42:35 +01:00
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
with:
|
2023-03-22 14:12:06 +01:00
|
|
|
files: ./final.cov
|
2023-02-03 13:42:35 +01:00
|
|
|
flags: complement
|
|
|
|
fail_ci_if_error: true
|
|
|
|
|
2023-01-11 17:52:58 +01:00
|
|
|
element_web:
|
2023-01-11 18:47:37 +01:00
|
|
|
timeout-minutes: 120
|
2023-01-11 17:52:58 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: tecolicom/actions-use-apt-tools@v1
|
|
|
|
with:
|
|
|
|
# Our test suite includes some screenshot tests with unusual diacritics, which are
|
|
|
|
# supposed to be covered by STIXGeneral.
|
|
|
|
tools: fonts-stix
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: matrix-org/matrix-react-sdk
|
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
cache: 'yarn'
|
|
|
|
- name: Fetch layered build
|
|
|
|
run: scripts/ci/layered.sh
|
|
|
|
- name: Copy config
|
|
|
|
run: cp element.io/develop/config.json config.json
|
|
|
|
working-directory: ./element-web
|
|
|
|
- name: Build
|
|
|
|
env:
|
|
|
|
CI_PACKAGE: true
|
2023-02-20 15:28:45 +01:00
|
|
|
NODE_OPTIONS: "--openssl-legacy-provider"
|
2023-01-11 17:52:58 +01:00
|
|
|
run: yarn build
|
|
|
|
working-directory: ./element-web
|
2023-01-11 18:10:24 +01:00
|
|
|
- name: Edit Test Config
|
|
|
|
run: |
|
|
|
|
sed -i '/HOMESERVER/c\ HOMESERVER: "dendrite",' cypress.config.ts
|
2023-01-11 17:52:58 +01:00
|
|
|
- name: "Run cypress tests"
|
|
|
|
uses: cypress-io/github-action@v4.1.1
|
|
|
|
with:
|
|
|
|
browser: chrome
|
|
|
|
start: npx serve -p 8080 ./element-web/webapp
|
|
|
|
wait-on: 'http://localhost:8080'
|
|
|
|
env:
|
|
|
|
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
|
|
|
|
TMPDIR: ${{ runner.temp }}
|