Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add CI job to act as a canary for testing against latest dependencies #12472

Merged
merged 30 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .ci/latest_deps_build_failed_issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: CI run against latest deps is failing
---
See https://github.com/{{env.GITHUB_REPOSITORY}}/actions/runs/{{env.GITHUB_RUN_ID}}
160 changes: 160 additions & 0 deletions .github/workflows/latest_deps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# People who are freshly `pip install`ing from the wheels we publish to PyPI will pull
# in the latest versions of all dependencies. We used to do this in our CI runs, which
# would detect any incompatibilities due to new package releases. Now that we use the
# locked poetry environment, we don't have advance notice of these breakages.defaults:
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
#
# To plug that hole, this job is a canary which periodically
# - checks out develop,
# - pip installs from source (building a wheel locally using `poetry-core`,
# and `pip install`ing from that), and
# - runs test suites against that checkout.
#
# Based on the twisted trunk CI job.

name: Latest dependencies

on:
schedule:
- cron: 0 7 * * *
pull_request:
branches: [dmr/poetry-wheel-ci]
push:
branches: [dmr/poetry-wheel-ci]
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# TODO(dmr): I'm not sure if we want to run mypy here, nor if mypy failures should
# merit an issue.
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# The dev dependencies aren't exposed in the wheel metadata (at least with current
# poetry-core versions). So we'll have to be dirty: `poetry install` to get the
# dev deps, then upgrade them in situ with pip.
- uses: matrix-org/setup-python-poetry@v1
with:
python-version: "3.x"
# Lacking a `pip install --upgrade-literally-everything` option, concoct our own.
- run: "poetry run pip freeze | cut -d' ' -f 1 | xargs pip install --upgrade --upgrade-strategy eager"
clokep marked this conversation as resolved.
Show resolved Hide resolved
# Dump installed versions for debugging
- run: pip freeze
- run: poetry run mypy
trial:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- database: "sqlite"
- database: "postgres"
postgres-version: "14"

steps:
- uses: actions/checkout@v2
- run: sudo apt-get -qq install xmlsec1
- name: Set up PostgreSQL ${{ matrix.postgres-version }}
if: ${{ matrix.postgres-version }}
run: |
docker run -d -p 5432:5432 \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_INITDB_ARGS="--lc-collate C --lc-ctype C --encoding UTF8" \
postgres:${{ matrix.postgres-version }}
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- run: pip install -e .[all,test]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a bunch of:

Using legacy 'setup.py install' for jaeger-client, since package 'wheel' is not installed.

Should we be installing wheel first in the environment? (Is this just copied from somewhere else?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't copy this, but I also can't see anywhere that we manually installed wheel before.

It'd be nice to have for (hopefully) quicker CI, but I don't think I want to get stuck into that right now.

- name: Await PostgreSQL
if: ${{ matrix.postgres-version }}
timeout-minutes: 2
run: until pg_isready -h localhost; do sleep 1; done
- run: trial --jobs=2 tests
env:
SYNAPSE_POSTGRES: ${{ matrix.database == 'postgres' || '' }}
SYNAPSE_POSTGRES_HOST: localhost
SYNAPSE_POSTGRES_USER: postgres
SYNAPSE_POSTGRES_PASSWORD: postgres
- name: Dump logs
# Logs are most useful when the command fails, always include them.
if: ${{ always() }}
# Note: Dumps to workflow logs instead of using actions/upload-artifact
# This keeps logs colocated with failing jobs
# It also ignores find's exit code; this is a best effort affair
run: >-
find _trial_temp -name '*.log'
-exec echo "::group::{}" \;
-exec cat {} \;
-exec echo "::endgroup::" \;
|| true


sytest:
runs-on: ubuntu-latest
container:
image: matrixdotorg/sytest-synapse:testing
volumes:
- ${{ github.workspace }}:/src
strategy:
fail-fast: false
matrix:
include:
- sytest-tag: focal

- sytest-tag: focal
postgres: postgres
workers: workers
redis: redis
env:
POSTGRES: ${{ matrix.postgres && 1}}
WORKERS: ${{ matrix.workers && 1 }}
REDIS: ${{ matrix.redis && 1 }}
BLACKLIST: ${{ matrix.workers && 'synapse-blacklist-with-workers' }}

steps:
- uses: actions/checkout@v2
- name: Ensure systest runs `pip install`
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
# Delete the lockfile so sytest will `pip install` rather than `poetry install`
run: rm /src/poetry.lock
working-directory: /src
- name: Prepare test blacklist
run: cat sytest-blacklist .ci/worker-blacklist > synapse-blacklist-with-workers
- name: Run SyTest
run: /bootstrap.sh synapse
working-directory: /src
- name: Summarise results.tap
if: ${{ always() }}
run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
- name: Upload SyTest logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: Sytest Logs - ${{ job.status }} - (${{ join(matrix.*, ', ') }})
path: |
/logs/results.tap
/logs/**/*.log*


# TODO: run complement (as with twisted trunk, see #12473).

# open an issue if the build fails, so we know about it.
# open-issue:
# if: failure()
# needs:
# # TODO: should mypy be included here? It feels more brittle than the other two.
# - mypy
# - trial
# - sytest
#
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v2
# - uses: JasonEtco/create-an-issue@5d9504915f79f9cc6d791934b8ef34f2353dd74d # v2.5.0, 2020-12-06
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# update_existing: true
# filename: .ci/latest_deps_build_failed_issue_template.md
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions changelog.d/12472.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a CI job which tests Synapse against the latest version of all dependencies.