1
0

latest_deps.yml 7.0 KB

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