latest_deps.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. # TODO: run complement (as with twisted trunk, see #12473).
  128. # open an issue if the build fails, so we know about it.
  129. open-issue:
  130. if: failure()
  131. needs:
  132. # TODO: should mypy be included here? It feels more brittle than the other two.
  133. - mypy
  134. - trial
  135. - sytest
  136. runs-on: ubuntu-latest
  137. steps:
  138. - uses: actions/checkout@v2
  139. - uses: JasonEtco/create-an-issue@5d9504915f79f9cc6d791934b8ef34f2353dd74d # v2.5.0, 2020-12-06
  140. env:
  141. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  142. with:
  143. update_existing: true
  144. filename: .ci/latest_deps_build_failed_issue_template.md