latest_deps.yml 6.9 KB

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