integration.yml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. name: Integration
  2. on: # yamllint disable-line rule:truthy
  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-24.04
  13. strategy:
  14. matrix:
  15. os: [ubuntu-24.04]
  16. python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
  17. steps:
  18. - name: Checkout
  19. uses: actions/checkout@v4
  20. - name: Install Ubuntu packages
  21. run: |
  22. sudo ./utils/searxng.sh install packages
  23. sudo apt install firefox
  24. - name: Set up Python
  25. uses: actions/setup-python@v5
  26. with:
  27. python-version: ${{ matrix.python-version }}
  28. architecture: 'x64'
  29. - name: Cache Python dependencies
  30. id: cache-python
  31. uses: actions/cache@v4
  32. with:
  33. path: |
  34. ./local
  35. ./.nvm
  36. ./node_modules
  37. key: python-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements*.txt', 'setup.py') }}
  38. - name: Install Python dependencies
  39. if: steps.cache-python.outputs.cache-hit != 'true'
  40. run: |
  41. make V=1 install
  42. make V=1 gecko.driver
  43. - name: Run tests
  44. run: make V=1 ci.test
  45. themes:
  46. name: Themes
  47. runs-on: ubuntu-24.04
  48. steps:
  49. - name: Checkout
  50. uses: actions/checkout@v4
  51. - name: Install Ubuntu packages
  52. run: sudo ./utils/searxng.sh install buildhost
  53. - name: Set up Python
  54. uses: actions/setup-python@v5
  55. with:
  56. python-version: '3.12'
  57. architecture: 'x64'
  58. - name: Cache Python dependencies
  59. id: cache-python
  60. uses: actions/cache@v4
  61. with:
  62. path: |
  63. ./local
  64. ./.nvm
  65. ./node_modules
  66. key: python-ubuntu-24.04-3.12-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }}
  67. - name: Install node dependencies
  68. run: make V=1 node.env
  69. - name: Build themes
  70. run: make V=1 themes.all
  71. documentation:
  72. name: Documentation
  73. runs-on: ubuntu-24.04
  74. permissions:
  75. contents: write # for JamesIves/github-pages-deploy-action to push changes in repo
  76. steps:
  77. - name: Checkout
  78. uses: actions/checkout@v4
  79. with:
  80. fetch-depth: '0'
  81. persist-credentials: false
  82. - name: Install Ubuntu packages
  83. run: sudo ./utils/searxng.sh install buildhost
  84. - name: Set up Python
  85. uses: actions/setup-python@v5
  86. with:
  87. python-version: '3.12'
  88. architecture: 'x64'
  89. - name: Cache Python dependencies
  90. id: cache-python
  91. uses: actions/cache@v4
  92. with:
  93. path: |
  94. ./local
  95. ./.nvm
  96. ./node_modules
  97. key: python-ubuntu-24.04-3.12-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }}
  98. - name: Build documentation
  99. run: |
  100. make V=1 docs.clean docs.html
  101. - name: Deploy
  102. if: github.ref == 'refs/heads/master'
  103. uses: JamesIves/github-pages-deploy-action@3.7.1
  104. with:
  105. GITHUB_TOKEN: ${{ github.token }}
  106. BRANCH: gh-pages
  107. FOLDER: dist/docs
  108. CLEAN: true # Automatically remove deleted files from the deploy branch
  109. SINGLE_COMMIT: true
  110. COMMIT_MESSAGE: '[doc] build from commit ${{ github.sha }}'
  111. babel:
  112. name: Update translations branch
  113. runs-on: ubuntu-24.04
  114. if: ${{ github.repository_owner == 'searxng' && github.ref == 'refs/heads/master' }}
  115. needs:
  116. - python
  117. - themes
  118. - documentation
  119. permissions:
  120. contents: write # for make V=1 weblate.push.translations
  121. steps:
  122. - name: Checkout
  123. uses: actions/checkout@v4
  124. with:
  125. fetch-depth: '0'
  126. token: ${{ secrets.WEBLATE_GITHUB_TOKEN }}
  127. - name: Set up Python
  128. uses: actions/setup-python@v5
  129. with:
  130. python-version: '3.12'
  131. architecture: 'x64'
  132. - name: Cache Python dependencies
  133. id: cache-python
  134. uses: actions/cache@v4
  135. with:
  136. path: |
  137. ./local
  138. ./.nvm
  139. ./node_modules
  140. key: python-ubuntu-20.04-3.12-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }}
  141. - name: weblate & git setup
  142. env:
  143. WEBLATE_CONFIG: ${{ secrets.WEBLATE_CONFIG }}
  144. run: |
  145. mkdir -p ~/.config
  146. echo "${WEBLATE_CONFIG}" > ~/.config/weblate
  147. git config --global user.email "searxng-bot@users.noreply.github.com"
  148. git config --global user.name "searxng-bot"
  149. - name: Update transations
  150. id: update
  151. run: |
  152. make V=1 weblate.push.translations
  153. dockers:
  154. name: Docker
  155. if: github.ref == 'refs/heads/master'
  156. needs:
  157. - python
  158. - themes
  159. - documentation
  160. env:
  161. DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
  162. runs-on: ubuntu-24.04
  163. steps:
  164. - name: Checkout
  165. if: env.DOCKERHUB_USERNAME != null
  166. uses: actions/checkout@v4
  167. with:
  168. # make sure "make docker.push" can get the git history
  169. fetch-depth: '0'
  170. - name: Set up Python
  171. uses: actions/setup-python@v5
  172. with:
  173. python-version: '3.12'
  174. architecture: 'x64'
  175. - name: Cache Python dependencies
  176. id: cache-python
  177. uses: actions/cache@v4
  178. with:
  179. path: |
  180. ./local
  181. ./.nvm
  182. ./node_modules
  183. key: python-ubuntu-20.04-3.12-${{ hashFiles('requirements*.txt', 'setup.py','.nvmrc', 'package.json') }}
  184. - name: Set up QEMU
  185. if: env.DOCKERHUB_USERNAME != null
  186. uses: docker/setup-qemu-action@v1
  187. - name: Set up Docker Buildx
  188. if: env.DOCKERHUB_USERNAME != null
  189. uses: docker/setup-buildx-action@v1
  190. - name: Login to DockerHub
  191. if: env.DOCKERHUB_USERNAME != null
  192. uses: docker/login-action@v1
  193. with:
  194. username: ${{ secrets.DOCKERHUB_USERNAME }}
  195. password: ${{ secrets.DOCKERHUB_TOKEN }}
  196. - name: Build and push
  197. if: env.DOCKERHUB_USERNAME != null
  198. run: make -e GIT_URL=$(git remote get-url origin) docker.buildx