v0.99.17 #1224
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
permissions: | |
packages: read | |
# Note: from https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs | |
# > If you specify the access for any of these scopes, all of those that are not specified are set to none. | |
jobs: | |
check-signoff: | |
if: "github.event_name == 'pull_request'" | |
uses: "matrix-org/backend-meta/.github/workflows/sign-off.yml@v2" | |
integration: | |
runs-on: ubuntu-latest | |
# Service containers to run with `container-job` | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres:13-alpine | |
# Provide the password for postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: syncv3 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
- name: Build | |
run: go build ./cmd/syncv3 | |
- name: Set up gotestfmt | |
uses: GoTestTools/gotestfmt-action@v2 | |
with: | |
# Note: constrained to `packages:read` only at the top of the file | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test | |
run: | | |
set -euo pipefail | |
go test -count=1 -race -covermode=atomic -coverpkg ./... -p 1 -v -json $(go list ./... | grep -v tests-e2e) -coverprofile synccoverage.out 2>&1 | tee ./test-integration.log | gotestfmt -hide all | |
shell: bash | |
env: | |
POSTGRES_HOST: localhost | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: syncv3 | |
SYNCV3_DEBUG: "1" | |
SYNCV3_SECRET: itsasecret | |
- name: Coverage | |
run: go tool cover -func=synccoverage.out | |
- name: Check /client works | |
run: ./tests-e2e/client-check.sh | |
env: | |
SYNCV3_DB: user=postgres dbname=syncv3 sslmode=disable password=postgres host=localhost | |
SYNCV3_SERVER: https://matrix-client.matrix.org | |
SYNCV3_SECRET: itsasecret | |
- name: Upload test log | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: Integration test logs | |
path: ./test-integration.log | |
if-no-files-found: error | |
end_to_end: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# test with unlimited + 1 + 2 max db conns. If we end up double transacting in the tests anywhere, conn=1 tests will fail. | |
max_db_conns: [0,1,2] | |
# If the server fails to start, we'll wait for GHA to cancel the job after 6 hours. | |
# Ensure we fail sooner than that to avoid clogging up GHA runners. | |
timeout-minutes: 30 | |
services: | |
synapse: | |
# Custom image built from https://github.com/matrix-org/synapse/tree/v1.94.0/docker/complement with a dummy /complement/ca set | |
image: ghcr.io/matrix-org/synapse-service:v1.94.0 | |
env: | |
SYNAPSE_COMPLEMENT_DATABASE: sqlite | |
SERVER_NAME: synapse | |
ports: | |
- 8008:8008 | |
# Set health checks to wait until synapse has started | |
options: >- | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres:13-alpine | |
# Provide the password for postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: syncv3 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
- name: Build | |
run: go build ./cmd/syncv3 | |
- name: Set up gotestfmt | |
uses: GoTestTools/gotestfmt-action@v2 | |
with: | |
# Note: constrained to `packages:read` only at the top of the file | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install libolm | |
run: sudo apt-get update && sudo apt-get install -y libolm3 libolm-dev | |
- name: Run end-to-end tests | |
run: | | |
set -euo pipefail | |
./run-tests.sh -count=1 -v -json . 2>&1 | tee test-e2e-runner.log | gotestfmt -hide all | |
working-directory: tests-e2e | |
shell: bash | |
env: | |
SYNCV3_DB: user=postgres dbname=syncv3 sslmode=disable password=postgres host=localhost | |
SYNCV3_SERVER: http://localhost:8008 | |
SYNCV3_SECRET: itsasecret | |
SYNCV3_MAX_DB_CONN: ${{ matrix.max_db_conns }} | |
E2E_TEST_SERVER_STDOUT: test-e2e-server.log | |
- name: Upload test log | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: E2E test logs | |
path: | | |
./tests-e2e/test-e2e-runner.log | |
./tests-e2e/test-e2e-server.log | |
if-no-files-found: error | |
element_web: | |
# Cypress seems consistently unable to connect to its browser: | |
# | |
# Still waiting to connect to Chrome, retrying in 1 second (attempt 18/62) | |
# read ECONNRESET | |
# Error: read ECONNRESET | |
# at TCP.onStreamRead (node:internal/stream_base_commons:217:20) | |
# | |
# Disable this job for now---it's not useful at present. | |
if: false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Build docker image" | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: docker build -f Dockerfile -t ghcr.io/matrix-org/sliding-sync:ci . | |
- uses: actions/checkout@v3 | |
with: | |
repository: matrix-org/matrix-react-sdk | |
ref: "v3.71.0" # later versions break the SS E2E tests which need to be fixed :( | |
- uses: actions/setup-node@v3 | |
with: | |
cache: 'yarn' | |
# we need this so we can use a tag instead of a branch name for JS_SDK_GITHUB_BASE_REF | |
# we also skip a flakey test | |
- name: Patch script | |
run: | | |
sed -i 's/git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF/git fetch --depth 1 origin $JS_SDK_GITHUB_BASE_REF --tags/' scripts/ci/layered.sh | |
sed -i 's/it("should send unsubscribe_rooms for every room switch"/xit("should send unsubscribe_rooms for every room switch"/' cypress/e2e/sliding-sync/sliding-sync.ts | |
- name: Fetch layered build | |
run: scripts/ci/layered.sh | |
env: | |
JS_SDK_GITHUB_BASE_REF: "v25.0.0-rc.1" | |
- name: Copy config | |
run: cp element.io/develop/config.json config.json | |
working-directory: ./element-web | |
- name: Build | |
env: | |
CI_PACKAGE: true | |
run: yarn build | |
working-directory: ./element-web | |
- name: "Run cypress tests" | |
uses: cypress-io/[email protected] | |
with: | |
browser: chrome | |
start: npx serve -p 8080 ./element-web/webapp | |
wait-on: 'http://localhost:8080' | |
spec: cypress/e2e/sliding-sync/*.ts | |
env: | |
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true | |
TMPDIR: ${{ runner.temp }} | |
CYPRESS_SLIDING_SYNC_PROXY_TAG: 'ci' | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-captures | |
path: | | |
cypress/screenshots | |
cypress/videos | |
upgrade-test: | |
runs-on: ubuntu-latest | |
env: | |
PREV_VERSION: "v0.99.4" | |
# If the server fails to start, we'll wait for GHA to cancel the job after 6 hours. | |
# Ensure we fail sooner than that to avoid clogging up GHA runners. | |
timeout-minutes: 30 | |
# Service containers to run with `container-job` | |
services: | |
synapse: | |
# Custom image built from https://github.com/matrix-org/synapse/tree/v1.94.0/docker/complement with a dummy /complement/ca set | |
image: ghcr.io/matrix-org/synapse-service:v1.94.0 | |
env: | |
SYNAPSE_COMPLEMENT_DATABASE: sqlite | |
SERVER_NAME: synapse | |
ports: | |
- 8008:8008 | |
# Set health checks to wait until synapse has started | |
options: >- | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres:13-alpine | |
# Provide the password for postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: syncv3 | |
ports: | |
# Maps tcp port 5432 on service container to the host | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
# E2E tests with ${{env.PREV_VERSION}} | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{env.PREV_VERSION}} | |
- name: Set up gotestfmt | |
uses: GoTestTools/gotestfmt-action@v2 | |
with: | |
# Note: constrained to `packages:read` only at the top of the file | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build ${{env.PREV_VERSION}} | |
run: go build ./cmd/syncv3 | |
- name: Install libolm | |
run: sudo apt-get update && sudo apt-get install -y libolm3 libolm-dev | |
- name: Run end-to-end tests | |
run: | | |
set -euo pipefail | |
./run-tests.sh -count=1 -v -json . 2>&1 | tee test-e2e-runner-${{env.PREV_VERSION}}.log | gotestfmt -hide all | |
working-directory: tests-e2e | |
shell: bash | |
env: | |
SYNCV3_DB: user=postgres dbname=syncv3 sslmode=disable password=postgres host=localhost | |
SYNCV3_SERVER: http://localhost:8008 | |
SYNCV3_SECRET: itsasecret | |
SYNCV3_MAX_DB_CONN: ${{ matrix.max_db_conns }} | |
E2E_TEST_SERVER_STDOUT: test-e2e-server-${{env.PREV_VERSION}}.log | |
- name: Upload test log ${{env.PREV_VERSION}} | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: E2E test logs upgrade ${{env.PREV_VERSION}} | |
path: | | |
./tests-e2e/test-e2e-runner-${{env.PREV_VERSION}}.log | |
./tests-e2e/test-e2e-server-${{env.PREV_VERSION}}.log | |
if-no-files-found: error | |
# E2E tests with current commit | |
- uses: actions/checkout@v3 | |
- name: Set up gotestfmt | |
uses: GoTestTools/gotestfmt-action@v2 | |
with: | |
# Note: constrained to `packages:read` only at the top of the file | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
run: go build ./cmd/syncv3 | |
- name: Run end-to-end tests | |
run: | | |
set -euo pipefail | |
./run-tests.sh -count=1 -v -json . 2>&1 | tee test-e2e-runner.log | gotestfmt -hide all | |
working-directory: tests-e2e | |
shell: bash | |
env: | |
SYNCV3_DB: user=postgres dbname=syncv3 sslmode=disable password=postgres host=localhost | |
SYNCV3_SERVER: http://localhost:8008 | |
SYNCV3_SECRET: itsasecret | |
SYNCV3_MAX_DB_CONN: ${{ matrix.max_db_conns }} | |
E2E_TEST_SERVER_STDOUT: test-e2e-server.log | |
- name: Upload test log | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: E2E test logs upgrade | |
path: | | |
./tests-e2e/test-e2e-runner.log | |
./tests-e2e/test-e2e-server.log | |
if-no-files-found: error |