latest_deps.yml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. # People who are freshly `pip install`ing from PyPI will pull in the latest versions of
  2. # dependencies which match the broad requirements. Since most CI runs are against
  3. # the locked poetry environment, run specifically against the latest dependencies to
  4. # know if there's an upcoming breaking change.
  5. #
  6. # As an overview this workflow:
  7. # - checks out develop,
  8. # - installs from source, pulling in the dependencies like a fresh `pip install` would, and
  9. # - runs mypy and test suites in that checkout.
  10. #
  11. # Based on the twisted trunk CI job.
  12. name: Latest dependencies
  13. on:
  14. schedule:
  15. - cron: 0 7 * * *
  16. workflow_dispatch:
  17. concurrency:
  18. group: ${{ github.workflow }}-${{ github.ref }}
  19. cancel-in-progress: true
  20. jobs:
  21. mypy:
  22. runs-on: ubuntu-latest
  23. steps:
  24. - uses: actions/checkout@v2
  25. # The dev dependencies aren't exposed in the wheel metadata (at least with current
  26. # poetry-core versions), so we install with poetry.
  27. - uses: matrix-org/setup-python-poetry@v1
  28. with:
  29. python-version: "3.x"
  30. poetry-version: "1.2.0b1"
  31. extras: "all"
  32. # Dump installed versions for debugging.
  33. - run: poetry run pip list > before.txt
  34. # Upgrade all runtime dependencies only. This is intended to mimic a fresh
  35. # `pip install matrix-synapse[all]` as closely as possible.
  36. - run: poetry update --no-dev
  37. - run: poetry run pip list > after.txt && (diff -u before.txt after.txt || true)
  38. - name: Remove warn_unused_ignores from mypy config
  39. run: sed '/warn_unused_ignores = True/d' -i mypy.ini
  40. - run: poetry run mypy
  41. trial:
  42. runs-on: ubuntu-latest
  43. strategy:
  44. matrix:
  45. include:
  46. - database: "sqlite"
  47. - database: "postgres"
  48. postgres-version: "14"
  49. steps:
  50. - uses: actions/checkout@v2
  51. - run: sudo apt-get -qq install xmlsec1
  52. - name: Set up PostgreSQL ${{ matrix.postgres-version }}
  53. if: ${{ matrix.postgres-version }}
  54. run: |
  55. docker run -d -p 5432:5432 \
  56. -e POSTGRES_PASSWORD=postgres \
  57. -e POSTGRES_INITDB_ARGS="--lc-collate C --lc-ctype C --encoding UTF8" \
  58. postgres:${{ matrix.postgres-version }}
  59. - uses: actions/setup-python@v2
  60. with:
  61. python-version: "3.x"
  62. - run: pip install .[all,test]
  63. - name: Await PostgreSQL
  64. if: ${{ matrix.postgres-version }}
  65. timeout-minutes: 2
  66. run: until pg_isready -h localhost; do sleep 1; done
  67. - run: python -m twisted.trial --jobs=2 tests
  68. env:
  69. SYNAPSE_POSTGRES: ${{ matrix.database == 'postgres' || '' }}
  70. SYNAPSE_POSTGRES_HOST: localhost
  71. SYNAPSE_POSTGRES_USER: postgres
  72. SYNAPSE_POSTGRES_PASSWORD: postgres
  73. - name: Dump logs
  74. # Logs are most useful when the command fails, always include them.
  75. if: ${{ always() }}
  76. # Note: Dumps to workflow logs instead of using actions/upload-artifact
  77. # This keeps logs colocated with failing jobs
  78. # It also ignores find's exit code; this is a best effort affair
  79. run: >-
  80. find _trial_temp -name '*.log'
  81. -exec echo "::group::{}" \;
  82. -exec cat {} \;
  83. -exec echo "::endgroup::" \;
  84. || true
  85. sytest:
  86. runs-on: ubuntu-latest
  87. container:
  88. image: matrixdotorg/sytest-synapse:testing
  89. volumes:
  90. - ${{ github.workspace }}:/src
  91. strategy:
  92. fail-fast: false
  93. matrix:
  94. include:
  95. - sytest-tag: focal
  96. - sytest-tag: focal
  97. postgres: postgres
  98. workers: workers
  99. redis: redis
  100. env:
  101. POSTGRES: ${{ matrix.postgres && 1}}
  102. WORKERS: ${{ matrix.workers && 1 }}
  103. REDIS: ${{ matrix.redis && 1 }}
  104. BLACKLIST: ${{ matrix.workers && 'synapse-blacklist-with-workers' }}
  105. steps:
  106. - uses: actions/checkout@v2
  107. - name: Ensure sytest runs `pip install`
  108. # Delete the lockfile so sytest will `pip install` rather than `poetry install`
  109. run: rm /src/poetry.lock
  110. working-directory: /src
  111. - name: Prepare test blacklist
  112. run: cat sytest-blacklist .ci/worker-blacklist > synapse-blacklist-with-workers
  113. - name: Run SyTest
  114. run: /bootstrap.sh synapse
  115. working-directory: /src
  116. - name: Summarise results.tap
  117. if: ${{ always() }}
  118. run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
  119. - name: Upload SyTest logs
  120. uses: actions/upload-artifact@v2
  121. if: ${{ always() }}
  122. with:
  123. name: Sytest Logs - ${{ job.status }} - (${{ join(matrix.*, ', ') }})
  124. path: |
  125. /logs/results.tap
  126. /logs/**/*.log*
  127. complement:
  128. if: "${{ !failure() && !cancelled() }}"
  129. runs-on: ubuntu-latest
  130. strategy:
  131. fail-fast: false
  132. matrix:
  133. include:
  134. - arrangement: monolith
  135. database: SQLite
  136. - arrangement: monolith
  137. database: Postgres
  138. - arrangement: workers
  139. database: Postgres
  140. steps:
  141. - name: Run actions/checkout@v2 for synapse
  142. uses: actions/checkout@v2
  143. with:
  144. path: synapse
  145. - name: Prepare Complement's Prerequisites
  146. run: synapse/.ci/scripts/setup_complement_prerequisites.sh
  147. - run: |
  148. set -o pipefail
  149. TEST_ONLY_IGNORE_POETRY_LOCKFILE=1 POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
  150. shell: bash
  151. name: Run Complement Tests
  152. # Open an issue if the build fails, so we know about it.
  153. # Only do this if we're not experimenting with this action in a PR.
  154. open-issue:
  155. if: "failure() && github.event_name != 'push' && github.event_name != 'pull_request'"
  156. needs:
  157. # TODO: should mypy be included here? It feels more brittle than the other two.
  158. - mypy
  159. - trial
  160. - sytest
  161. runs-on: ubuntu-latest
  162. steps:
  163. - uses: actions/checkout@v2
  164. - uses: JasonEtco/create-an-issue@5d9504915f79f9cc6d791934b8ef34f2353dd74d # v2.5.0, 2020-12-06
  165. env:
  166. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  167. with:
  168. update_existing: true
  169. filename: .ci/latest_deps_build_failed_issue_template.md