integration.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. name: Integration
  2. on:
  3. push:
  4. branches: ["master"]
  5. pull_request:
  6. branches: ["master"]
  7. permissions:
  8. contents: read
  9. jobs:
  10. python:
  11. name: Python ${{ matrix.python-version }}
  12. runs-on: ubuntu-20.04
  13. strategy:
  14. matrix:
  15. os: [ubuntu-20.04]
  16. python-version: [3.7, 3.8, 3.9, "3.10"]
  17. steps:
  18. - name: Checkout
  19. uses: actions/checkout@v2
  20. - name: Install Ubuntu packages
  21. run: |
  22. sudo ./utils/searx.sh install packages
  23. sudo apt install firefox
  24. - name: Set up Python
  25. uses: actions/setup-python@v2
  26. with:
  27. python-version: ${{ matrix.python-version }}
  28. architecture: 'x64'
  29. - name: Cache Python dependencies
  30. id: cache-python
  31. uses: actions/cache@v2
  32. with:
  33. path: ./local
  34. key: python-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements*.txt', 'setup.py') }}
  35. - name: Install Python dependencies
  36. if: steps.cache-python.outputs.cache-hit != 'true'
  37. run: |
  38. make V=1 install
  39. make V=1 gecko.driver
  40. - name: Run tests
  41. run: make V=1 ci.test
  42. - name: Test coverage
  43. run: make V=1 test.coverage
  44. - name: Store coverage result
  45. uses: actions/upload-artifact@v2
  46. with:
  47. name: coverage-${{ matrix.python-version }}
  48. path: coverage/
  49. retention-days: 60
  50. themes:
  51. name: Themes
  52. runs-on: ubuntu-20.04
  53. steps:
  54. - name: Checkout
  55. uses: actions/checkout@v2
  56. - name: Install Ubuntu packages
  57. run: sudo ./utils/searx.sh install packages
  58. - name: Set up Python
  59. uses: actions/setup-python@v2
  60. with:
  61. python-version: '3.9'
  62. architecture: 'x64'
  63. - name: Cache Python dependencies
  64. id: cache-python
  65. uses: actions/cache@v2
  66. with:
  67. path: ./local
  68. key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
  69. - name: Install node dependencies
  70. run: make V=1 node.env
  71. - name: Build themes
  72. run: make V=1 themes.all
  73. documentation:
  74. permissions:
  75. contents: write # for JamesIves/github-pages-deploy-action to push changes in repo
  76. name: Documentation
  77. runs-on: ubuntu-20.04
  78. steps:
  79. - name: Checkout
  80. uses: actions/checkout@v2
  81. with:
  82. fetch-depth: '0'
  83. persist-credentials: false
  84. - name: Install Ubuntu packages
  85. run: sudo ./utils/searx.sh install buildhost
  86. - name: Set up Python
  87. uses: actions/setup-python@v2
  88. with:
  89. python-version: '3.10'
  90. architecture: 'x64'
  91. - name: Cache Python dependencies
  92. id: cache-python
  93. uses: actions/cache@v2
  94. with:
  95. path: ./local
  96. key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
  97. - name: Build documentation
  98. run: |
  99. make V=1 docs.clean docs.html
  100. - name: Deploy
  101. if: github.ref == 'refs/heads/master'
  102. uses: JamesIves/github-pages-deploy-action@3.7.1
  103. with:
  104. GITHUB_TOKEN: ${{ github.token }}
  105. BRANCH: gh-pages
  106. FOLDER: dist/docs
  107. CLEAN: true # Automatically remove deleted files from the deploy branch
  108. dockers:
  109. name: Docker
  110. if: github.ref == 'refs/heads/master'
  111. needs:
  112. - python
  113. - themes
  114. - documentation
  115. env:
  116. DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
  117. runs-on: ubuntu-20.04
  118. steps:
  119. - name: Checkout
  120. if: env.DOCKERHUB_USERNAME != null
  121. uses: actions/checkout@v2
  122. with:
  123. # make sure "make docker.push" can get the git history
  124. fetch-depth: '0'
  125. - name: Set up Python
  126. uses: actions/setup-python@v2
  127. with:
  128. python-version: '3.9'
  129. architecture: 'x64'
  130. - name: Cache Python dependencies
  131. id: cache-python
  132. uses: actions/cache@v2
  133. with:
  134. path: ./local
  135. key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
  136. - name: Set up QEMU
  137. if: env.DOCKERHUB_USERNAME != null
  138. uses: docker/setup-qemu-action@v1
  139. - name: Set up Docker Buildx
  140. if: env.DOCKERHUB_USERNAME != null
  141. uses: docker/setup-buildx-action@v1
  142. - name: Login to DockerHub
  143. if: env.DOCKERHUB_USERNAME != null
  144. uses: docker/login-action@v1
  145. with:
  146. username: ${{ secrets.DOCKERHUB_USERNAME }}
  147. password: ${{ secrets.DOCKERHUB_TOKEN }}
  148. - name: Build and push
  149. if: env.DOCKERHUB_USERNAME != null
  150. run: make -e GIT_URL=$(git remote get-url origin) docker.push