twisted_trunk.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. mypy:
  17. runs-on: ubuntu-latest
  18. steps:
  19. - uses: actions/checkout@v3
  20. - name: Install Rust
  21. uses: dtolnay/rust-toolchain@fc3253060d0c959bea12a59f10f8391454a0b02d
  22. with:
  23. toolchain: stable
  24. - uses: Swatinem/rust-cache@v2
  25. - uses: matrix-org/setup-python-poetry@v1
  26. with:
  27. python-version: "3.x"
  28. extras: "all"
  29. - run: |
  30. poetry remove twisted
  31. poetry add --extras tls git+https://github.com/twisted/twisted.git#${{ inputs.twisted_ref }}
  32. poetry install --no-interaction --extras "all test"
  33. - name: Remove warn_unused_ignores from mypy config
  34. run: sed '/warn_unused_ignores = True/d' -i mypy.ini
  35. - run: poetry run mypy
  36. trial:
  37. runs-on: ubuntu-latest
  38. steps:
  39. - uses: actions/checkout@v3
  40. - run: sudo apt-get -qq install xmlsec1
  41. - name: Install Rust
  42. uses: dtolnay/rust-toolchain@fc3253060d0c959bea12a59f10f8391454a0b02d
  43. with:
  44. toolchain: stable
  45. - uses: Swatinem/rust-cache@v2
  46. - uses: matrix-org/setup-python-poetry@v1
  47. with:
  48. python-version: "3.x"
  49. extras: "all test"
  50. - run: |
  51. poetry remove twisted
  52. poetry add --extras tls git+https://github.com/twisted/twisted.git#trunk
  53. poetry install --no-interaction --extras "all test"
  54. - run: poetry run trial --jobs 2 tests
  55. - name: Dump logs
  56. # Logs are most useful when the command fails, always include them.
  57. if: ${{ always() }}
  58. # Note: Dumps to workflow logs instead of using actions/upload-artifact
  59. # This keeps logs colocated with failing jobs
  60. # It also ignores find's exit code; this is a best effort affair
  61. run: >-
  62. find _trial_temp -name '*.log'
  63. -exec echo "::group::{}" \;
  64. -exec cat {} \;
  65. -exec echo "::endgroup::" \;
  66. || true
  67. sytest:
  68. runs-on: ubuntu-latest
  69. container:
  70. image: matrixdotorg/sytest-synapse:buster
  71. volumes:
  72. - ${{ github.workspace }}:/src
  73. steps:
  74. - uses: actions/checkout@v3
  75. - name: Install Rust
  76. uses: dtolnay/rust-toolchain@fc3253060d0c959bea12a59f10f8391454a0b02d
  77. with:
  78. toolchain: stable
  79. - uses: Swatinem/rust-cache@v2
  80. - name: Patch dependencies
  81. # Note: The poetry commands want to create a virtualenv in /src/.venv/,
  82. # but the sytest-synapse container expects it to be in /venv/.
  83. # We symlink it before running poetry so that poetry actually
  84. # ends up installing to `/venv`.
  85. run: |
  86. ln -s -T /venv /src/.venv
  87. poetry remove twisted
  88. poetry add --extras tls git+https://github.com/twisted/twisted.git#trunk
  89. poetry install --no-interaction --extras "all test"
  90. working-directory: /src
  91. - name: Run SyTest
  92. run: /bootstrap.sh synapse
  93. working-directory: /src
  94. env:
  95. # Use offline mode to avoid reinstalling the pinned version of
  96. # twisted.
  97. OFFLINE: 1
  98. - name: Summarise results.tap
  99. if: ${{ always() }}
  100. run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
  101. - name: Upload SyTest logs
  102. uses: actions/upload-artifact@v3
  103. if: ${{ always() }}
  104. with:
  105. name: Sytest Logs - ${{ job.status }} - (${{ join(matrix.*, ', ') }})
  106. path: |
  107. /logs/results.tap
  108. /logs/**/*.log*
  109. complement:
  110. if: "${{ !failure() && !cancelled() }}"
  111. runs-on: ubuntu-latest
  112. strategy:
  113. fail-fast: false
  114. matrix:
  115. include:
  116. - arrangement: monolith
  117. database: SQLite
  118. - arrangement: monolith
  119. database: Postgres
  120. - arrangement: workers
  121. database: Postgres
  122. steps:
  123. - name: Run actions/checkout@v3 for synapse
  124. uses: actions/checkout@v3
  125. with:
  126. path: synapse
  127. - name: Prepare Complement's Prerequisites
  128. run: synapse/.ci/scripts/setup_complement_prerequisites.sh
  129. # This step is specific to the 'Twisted trunk' test run:
  130. - name: Patch dependencies
  131. run: |
  132. set -x
  133. DEBIAN_FRONTEND=noninteractive sudo apt-get install -yqq python3 pipx
  134. pipx install poetry==1.3.2
  135. poetry remove -n twisted
  136. poetry add -n --extras tls git+https://github.com/twisted/twisted.git#trunk
  137. poetry lock --no-update
  138. working-directory: synapse
  139. - run: |
  140. set -o pipefail
  141. 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
  142. shell: bash
  143. name: Run Complement Tests
  144. # open an issue if the build fails, so we know about it.
  145. open-issue:
  146. if: failure()
  147. needs:
  148. - mypy
  149. - trial
  150. - sytest
  151. - complement
  152. runs-on: ubuntu-latest
  153. steps:
  154. - uses: actions/checkout@v3
  155. - uses: JasonEtco/create-an-issue@e27dddc79c92bc6e4562f268fffa5ed752639abd # v2.9.1
  156. env:
  157. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  158. with:
  159. update_existing: true
  160. filename: .ci/twisted_trunk_build_failed_issue_template.md