run-tests.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. name: Tests
  2. on:
  3. push:
  4. paths-ignore:
  5. - "*.md"
  6. branches-ignore:
  7. - master
  8. workflow_call:
  9. # Ensure that multiple runs on the same branch do not overlap.
  10. concurrency:
  11. group: ${{ github.workflow }}-${{ github.ref }}
  12. cancel-in-progress: true
  13. defaults:
  14. run:
  15. shell: bash
  16. jobs:
  17. build-test:
  18. name: Build and test
  19. runs-on: ubuntu-24.04
  20. strategy:
  21. matrix:
  22. nim: ["2.0.x", "2.2.x", "devel"]
  23. steps:
  24. - name: Checkout Code
  25. uses: actions/checkout@v6
  26. - name: Cache Nimble Dependencies
  27. id: cache-nimble
  28. uses: actions/cache@v5
  29. with:
  30. path: |
  31. ~/.nimble/pkgcache
  32. ~/.nimble/packages_official.json
  33. key: ${{ matrix.nim }}-nimble-v6-${{ hashFiles('*.nimble') }}
  34. restore-keys: |
  35. ${{ matrix.nim }}-nimble-v6-
  36. - name: Setup Nim
  37. uses: jiro4989/setup-nim-action@v2
  38. with:
  39. nim-version: ${{ matrix.nim }}
  40. use-nightlies: true
  41. repo-token: ${{ secrets.GITHUB_TOKEN }}
  42. - name: Build Project
  43. run: nimble build -Y
  44. - name: Upload 2.2.x build artifact
  45. if: matrix.nim == '2.2.x'
  46. uses: actions/upload-artifact@v6
  47. with:
  48. name: nitter-linux-nim-2.2.x-${{ github.sha }}
  49. path: |
  50. ./nitter
  51. if-no-files-found: error
  52. integration-test:
  53. needs: [build-test]
  54. name: Integration test
  55. runs-on: ubuntu-24.04
  56. services:
  57. redis:
  58. image: redis:7
  59. ports:
  60. - 6379:6379
  61. steps:
  62. - name: Install runtime deps
  63. run: |
  64. sudo apt-get install -y --no-install-recommends libsass-dev libpcre3
  65. - name: Checkout code
  66. uses: actions/checkout@v6
  67. - name: Cache pipx (poetry)
  68. uses: actions/cache@v5
  69. with:
  70. path: |
  71. ~/.local/pipx
  72. ~/.local/bin
  73. key: pipx-poetry-${{ runner.os }}
  74. - name: Install poetry
  75. env:
  76. PIPX_HOME: ~/.local/pipx
  77. PIPX_BIN_DIR: ~/.local/bin
  78. run: command -v poetry >/dev/null 2>&1 || pipx install poetry
  79. - name: Setup Python (3.14) with Poetry cache
  80. uses: actions/setup-python@v6
  81. with:
  82. python-version: "3.14"
  83. cache: poetry
  84. cache-dependency-path: tests/poetry.lock
  85. - name: Install Python deps
  86. working-directory: tests
  87. run: poetry sync
  88. - name: Cache Nimble Dependencies
  89. uses: actions/cache@v5
  90. with:
  91. path: |
  92. ~/.nimble/pkgcache
  93. ~/.nimble/packages_official.json
  94. key: 2.2.x-nimble-v6-${{ hashFiles('*.nimble') }}
  95. restore-keys: |
  96. 2.2.x-nimble-v6-
  97. - name: Setup Nim
  98. uses: jiro4989/setup-nim-action@v2
  99. with:
  100. nim-version: 2.2.x
  101. use-nightlies: true
  102. repo-token: ${{ secrets.GITHUB_TOKEN }}
  103. - name: Install Nimble dependencies
  104. run: nimble install -y --depsOnly
  105. - name: Download 2.2.x build artifact
  106. uses: actions/download-artifact@v4
  107. with:
  108. name: nitter-linux-nim-2.2.x-${{ github.sha }}
  109. path: .
  110. - name: Make nitter binary executable
  111. run: chmod +x ./nitter
  112. - name: Prepare Nitter Environment
  113. run: |
  114. cp nitter.example.conf nitter.conf
  115. sed -i 's/enableDebug = false/enableDebug = true/g' nitter.conf
  116. sed -i 's/maxRetries = 1/maxRetries = 10/g' nitter.conf
  117. nim r tools/rendermd.nim
  118. nim r tools/gencss.nim
  119. echo '${{ secrets.SESSIONS }}' | head -n1
  120. echo '${{ secrets.SESSIONS }}' > ./sessions.jsonl
  121. - name: Run Tests
  122. run: |
  123. ./nitter &
  124. cd tests
  125. poetry run pytest -n3 --reruns=5 --rs .