latest_deps.yml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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@v3
  25. - name: Install Rust
  26. uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb
  27. with:
  28. toolchain: stable
  29. - uses: Swatinem/rust-cache@v2
  30. # The dev dependencies aren't exposed in the wheel metadata (at least with current
  31. # poetry-core versions), so we install with poetry.
  32. - uses: matrix-org/setup-python-poetry@v1
  33. with:
  34. python-version: "3.x"
  35. poetry-version: "1.2.0"
  36. extras: "all"
  37. # Dump installed versions for debugging.
  38. - run: poetry run pip list > before.txt
  39. # Upgrade all runtime dependencies only. This is intended to mimic a fresh
  40. # `pip install matrix-synapse[all]` as closely as possible.
  41. - run: poetry update --no-dev
  42. - run: poetry run pip list > after.txt && (diff -u before.txt after.txt || true)
  43. - name: Remove warn_unused_ignores from mypy config
  44. run: sed '/warn_unused_ignores = True/d' -i mypy.ini
  45. - run: poetry run mypy
  46. trial:
  47. runs-on: ubuntu-latest
  48. strategy:
  49. matrix:
  50. include:
  51. - database: "sqlite"
  52. - database: "postgres"
  53. postgres-version: "14"
  54. steps:
  55. - uses: actions/checkout@v3
  56. - name: Install Rust
  57. uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb
  58. with:
  59. toolchain: stable
  60. - uses: Swatinem/rust-cache@v2
  61. - run: sudo apt-get -qq install xmlsec1
  62. - name: Set up PostgreSQL ${{ matrix.postgres-version }}
  63. if: ${{ matrix.postgres-version }}
  64. run: |
  65. docker run -d -p 5432:5432 \
  66. -e POSTGRES_PASSWORD=postgres \
  67. -e POSTGRES_INITDB_ARGS="--lc-collate C --lc-ctype C --encoding UTF8" \
  68. postgres:${{ matrix.postgres-version }}
  69. - uses: actions/setup-python@v4
  70. with:
  71. python-version: "3.x"
  72. - run: pip install .[all,test]
  73. - name: Await PostgreSQL
  74. if: ${{ matrix.postgres-version }}
  75. timeout-minutes: 2
  76. run: until pg_isready -h localhost; do sleep 1; done
  77. # We nuke the local copy, as we've installed synapse into the virtualenv
  78. # (rather than use an editable install, which we no longer support). If we
  79. # don't do this then python can't find the native lib.
  80. - run: rm -rf synapse/
  81. - run: python -m twisted.trial --jobs=2 tests
  82. env:
  83. SYNAPSE_POSTGRES: ${{ matrix.database == 'postgres' || '' }}
  84. SYNAPSE_POSTGRES_HOST: localhost
  85. SYNAPSE_POSTGRES_USER: postgres
  86. SYNAPSE_POSTGRES_PASSWORD: postgres
  87. - name: Dump logs
  88. # Logs are most useful when the command fails, always include them.
  89. if: ${{ always() }}
  90. # Note: Dumps to workflow logs instead of using actions/upload-artifact
  91. # This keeps logs colocated with failing jobs
  92. # It also ignores find's exit code; this is a best effort affair
  93. run: >-
  94. find _trial_temp -name '*.log'
  95. -exec echo "::group::{}" \;
  96. -exec cat {} \;
  97. -exec echo "::endgroup::" \;
  98. || true
  99. sytest:
  100. runs-on: ubuntu-latest
  101. container:
  102. image: matrixdotorg/sytest-synapse:testing
  103. volumes:
  104. - ${{ github.workspace }}:/src
  105. strategy:
  106. fail-fast: false
  107. matrix:
  108. include:
  109. - sytest-tag: focal
  110. - sytest-tag: focal
  111. postgres: postgres
  112. workers: workers
  113. redis: redis
  114. env:
  115. POSTGRES: ${{ matrix.postgres && 1}}
  116. WORKERS: ${{ matrix.workers && 1 }}
  117. REDIS: ${{ matrix.redis && 1 }}
  118. BLACKLIST: ${{ matrix.workers && 'synapse-blacklist-with-workers' }}
  119. steps:
  120. - uses: actions/checkout@v3
  121. - name: Install Rust
  122. uses: dtolnay/rust-toolchain@55c7845fad90d0ae8b2e83715cb900e5e861e8cb
  123. with:
  124. toolchain: stable
  125. - uses: Swatinem/rust-cache@v2
  126. - name: Ensure sytest runs `pip install`
  127. # Delete the lockfile so sytest will `pip install` rather than `poetry install`
  128. run: rm /src/poetry.lock
  129. working-directory: /src
  130. - name: Prepare test blacklist
  131. run: cat sytest-blacklist .ci/worker-blacklist > synapse-blacklist-with-workers
  132. - name: Run SyTest
  133. run: /bootstrap.sh synapse
  134. working-directory: /src
  135. - name: Summarise results.tap
  136. if: ${{ always() }}
  137. run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
  138. - name: Upload SyTest logs
  139. uses: actions/upload-artifact@v3
  140. if: ${{ always() }}
  141. with:
  142. name: Sytest Logs - ${{ job.status }} - (${{ join(matrix.*, ', ') }})
  143. path: |
  144. /logs/results.tap
  145. /logs/**/*.log*
  146. complement:
  147. if: "${{ !failure() && !cancelled() }}"
  148. runs-on: ubuntu-latest
  149. strategy:
  150. fail-fast: false
  151. matrix:
  152. include:
  153. - arrangement: monolith
  154. database: SQLite
  155. - arrangement: monolith
  156. database: Postgres
  157. - arrangement: workers
  158. database: Postgres
  159. steps:
  160. - name: Run actions/checkout@v3 for synapse
  161. uses: actions/checkout@v3
  162. with:
  163. path: synapse
  164. - name: Prepare Complement's Prerequisites
  165. run: synapse/.ci/scripts/setup_complement_prerequisites.sh
  166. - run: |
  167. set -o pipefail
  168. 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 | synapse/.ci/scripts/gotestfmt
  169. shell: bash
  170. name: Run Complement Tests
  171. # Open an issue if the build fails, so we know about it.
  172. # Only do this if we're not experimenting with this action in a PR.
  173. open-issue:
  174. if: "failure() && github.event_name != 'push' && github.event_name != 'pull_request'"
  175. needs:
  176. # TODO: should mypy be included here? It feels more brittle than the others.
  177. - mypy
  178. - trial
  179. - sytest
  180. - complement
  181. runs-on: ubuntu-latest
  182. steps:
  183. - uses: actions/checkout@v3
  184. - uses: JasonEtco/create-an-issue@5d9504915f79f9cc6d791934b8ef34f2353dd74d # v2.5.0, 2020-12-06
  185. env:
  186. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  187. with:
  188. update_existing: true
  189. filename: .ci/latest_deps_build_failed_issue_template.md