You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

210 rivejä
6.9 KiB

  1. name: Twisted Trunk
  2. on:
  3. schedule:
  4. - cron: 0 8 * * *
  5. workflow_dispatch:
  6. inputs:
  7. twisted_ref:
  8. description: Commit, branch or tag to checkout from upstream Twisted.
  9. required: false
  10. default: 'trunk'
  11. type: string
  12. concurrency:
  13. group: ${{ github.workflow }}-${{ github.ref }}
  14. cancel-in-progress: true
  15. jobs:
  16. check_repo:
  17. # Prevent this workflow from running on any fork of Synapse other than matrix-org/synapse, as it is
  18. # only useful to the Synapse core team.
  19. # All other workflow steps depend on this one, thus if 'should_run_workflow' is not 'true', the rest
  20. # of the workflow will be skipped as well.
  21. if: github.repository == 'matrix-org/synapse'
  22. runs-on: ubuntu-latest
  23. outputs:
  24. should_run_workflow: ${{ steps.check_condition.outputs.should_run_workflow }}
  25. steps:
  26. - id: check_condition
  27. run: echo "should_run_workflow=${{ github.repository == 'matrix-org/synapse' }}" >> "$GITHUB_OUTPUT"
  28. mypy:
  29. needs: check_repo
  30. if: needs.check_repo.outputs.should_run_workflow == 'true'
  31. runs-on: ubuntu-latest
  32. steps:
  33. - uses: actions/checkout@v3
  34. - name: Install Rust
  35. uses: dtolnay/rust-toolchain@stable
  36. - uses: Swatinem/rust-cache@v2
  37. - uses: matrix-org/setup-python-poetry@v1
  38. with:
  39. python-version: "3.x"
  40. extras: "all"
  41. - run: |
  42. poetry remove twisted
  43. poetry add --extras tls git+https://github.com/twisted/twisted.git#${{ inputs.twisted_ref }}
  44. poetry install --no-interaction --extras "all test"
  45. - name: Remove warn_unused_ignores from mypy config
  46. run: sed '/warn_unused_ignores = True/d' -i mypy.ini
  47. - run: poetry run mypy
  48. trial:
  49. needs: check_repo
  50. if: needs.check_repo.outputs.should_run_workflow == 'true'
  51. runs-on: ubuntu-latest
  52. steps:
  53. - uses: actions/checkout@v3
  54. - run: sudo apt-get -qq install xmlsec1
  55. - name: Install Rust
  56. uses: dtolnay/rust-toolchain@stable
  57. - uses: Swatinem/rust-cache@v2
  58. - uses: matrix-org/setup-python-poetry@v1
  59. with:
  60. python-version: "3.x"
  61. extras: "all test"
  62. - run: |
  63. poetry remove twisted
  64. poetry add --extras tls git+https://github.com/twisted/twisted.git#trunk
  65. poetry install --no-interaction --extras "all test"
  66. - run: poetry run trial --jobs 2 tests
  67. - name: Dump logs
  68. # Logs are most useful when the command fails, always include them.
  69. if: ${{ always() }}
  70. # Note: Dumps to workflow logs instead of using actions/upload-artifact
  71. # This keeps logs colocated with failing jobs
  72. # It also ignores find's exit code; this is a best effort affair
  73. run: >-
  74. find _trial_temp -name '*.log'
  75. -exec echo "::group::{}" \;
  76. -exec cat {} \;
  77. -exec echo "::endgroup::" \;
  78. || true
  79. sytest:
  80. needs: check_repo
  81. if: needs.check_repo.outputs.should_run_workflow == 'true'
  82. runs-on: ubuntu-latest
  83. container:
  84. # We're using ubuntu:focal because it uses Python 3.8 which is our minimum supported Python version.
  85. # This job is a canary to warn us about unreleased twisted changes that would cause problems for us if
  86. # they were to be released immediately. For simplicity's sake (and to save CI runners) we use the oldest
  87. # version, assuming that any incompatibilities on newer versions would also be present on the oldest.
  88. image: matrixdotorg/sytest-synapse:focal
  89. volumes:
  90. - ${{ github.workspace }}:/src
  91. steps:
  92. - uses: actions/checkout@v3
  93. - name: Install Rust
  94. uses: dtolnay/rust-toolchain@stable
  95. - uses: Swatinem/rust-cache@v2
  96. - name: Patch dependencies
  97. # Note: The poetry commands want to create a virtualenv in /src/.venv/,
  98. # but the sytest-synapse container expects it to be in /venv/.
  99. # We symlink it before running poetry so that poetry actually
  100. # ends up installing to `/venv`.
  101. run: |
  102. ln -s -T /venv /src/.venv
  103. poetry remove twisted
  104. poetry add --extras tls git+https://github.com/twisted/twisted.git#trunk
  105. poetry install --no-interaction --extras "all test"
  106. working-directory: /src
  107. - name: Run SyTest
  108. run: /bootstrap.sh synapse
  109. working-directory: /src
  110. env:
  111. # Use offline mode to avoid reinstalling the pinned version of
  112. # twisted.
  113. OFFLINE: 1
  114. - name: Summarise results.tap
  115. if: ${{ always() }}
  116. run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
  117. - name: Upload SyTest logs
  118. uses: actions/upload-artifact@v3
  119. if: ${{ always() }}
  120. with:
  121. name: Sytest Logs - ${{ job.status }} - (${{ join(matrix.*, ', ') }})
  122. path: |
  123. /logs/results.tap
  124. /logs/**/*.log*
  125. complement:
  126. needs: check_repo
  127. if: "!failure() && !cancelled() && needs.check_repo.outputs.should_run_workflow == 'true'"
  128. runs-on: ubuntu-latest
  129. strategy:
  130. fail-fast: false
  131. matrix:
  132. include:
  133. - arrangement: monolith
  134. database: SQLite
  135. - arrangement: monolith
  136. database: Postgres
  137. - arrangement: workers
  138. database: Postgres
  139. steps:
  140. - name: Run actions/checkout@v3 for synapse
  141. uses: actions/checkout@v3
  142. with:
  143. path: synapse
  144. - uses: actions/setup-go@v4
  145. - name: Prepare Complement's Prerequisites
  146. run: synapse/.ci/scripts/setup_complement_prerequisites.sh
  147. # This step is specific to the 'Twisted trunk' test run:
  148. - name: Patch dependencies
  149. run: |
  150. set -x
  151. DEBIAN_FRONTEND=noninteractive sudo apt-get install -yqq python3 pipx
  152. pipx install poetry==1.3.2
  153. poetry remove -n twisted
  154. poetry add -n --extras tls git+https://github.com/twisted/twisted.git#trunk
  155. poetry lock --no-update
  156. working-directory: synapse
  157. - run: |
  158. set -o pipefail
  159. TEST_ONLY_SKIP_DEP_HASH_VERIFICATION=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
  160. shell: bash
  161. name: Run Complement Tests
  162. # open an issue if the build fails, so we know about it.
  163. open-issue:
  164. if: failure() && needs.check_repo.outputs.should_run_workflow == 'true'
  165. needs:
  166. - mypy
  167. - trial
  168. - sytest
  169. - complement
  170. runs-on: ubuntu-latest
  171. steps:
  172. - uses: actions/checkout@v3
  173. - uses: JasonEtco/create-an-issue@e27dddc79c92bc6e4562f268fffa5ed752639abd # v2.9.1
  174. env:
  175. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  176. with:
  177. update_existing: true
  178. filename: .ci/twisted_trunk_build_failed_issue_template.md