run-tests.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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: buildjet-2vcpu-ubuntu-2204
  20. strategy:
  21. matrix:
  22. nim: ["2.0.x", "2.2.x", "devel"]
  23. steps:
  24. - name: Checkout Code
  25. uses: actions/checkout@v4
  26. with:
  27. fetch-depth: 0
  28. - name: Cache Nimble Dependencies
  29. id: cache-nimble
  30. uses: buildjet/cache@v4
  31. with:
  32. path: ~/.nimble
  33. key: ${{ matrix.nim }}-nimble-v2-${{ hashFiles('*.nimble') }}
  34. restore-keys: |
  35. ${{ matrix.nim }}-nimble-v2-
  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 -d:release -Y
  44. integration-test:
  45. needs: [build-test]
  46. name: Integration test
  47. runs-on: buildjet-2vcpu-ubuntu-2204
  48. steps:
  49. - name: Checkout code
  50. uses: actions/checkout@v4
  51. with:
  52. fetch-depth: 0
  53. - name: Cache Nimble Dependencies
  54. id: cache-nimble
  55. uses: buildjet/cache@v4
  56. with:
  57. path: ~/.nimble
  58. key: devel-nimble-v2-${{ hashFiles('*.nimble') }}
  59. restore-keys: |
  60. devel-nimble-v2-
  61. - name: Setup Python (3.10) with pip cache
  62. uses: buildjet/setup-python@v4
  63. with:
  64. python-version: "3.10"
  65. cache: pip
  66. - name: Setup Nim
  67. uses: jiro4989/setup-nim-action@v2
  68. with:
  69. nim-version: devel
  70. use-nightlies: true
  71. repo-token: ${{ secrets.GITHUB_TOKEN }}
  72. - name: Build Project
  73. run: nimble build -d:release -Y
  74. - name: Install SeleniumBase and Chromedriver
  75. run: |
  76. pip install seleniumbase
  77. seleniumbase install chromedriver
  78. - name: Start Redis Service
  79. uses: supercharge/redis-github-action@1.5.0
  80. - name: Prepare Nitter Environment
  81. run: |
  82. sudo apt-get update && sudo apt-get install -y libsass-dev
  83. cp nitter.example.conf nitter.conf
  84. sed -i 's/enableDebug = false/enableDebug = true/g' nitter.conf
  85. nimble md
  86. nimble scss
  87. echo '${{ secrets.SESSIONS }}' | head -n1
  88. echo '${{ secrets.SESSIONS }}' > ./sessions.jsonl
  89. - name: Run Tests
  90. run: |
  91. ./nitter &
  92. pytest -n1 tests