integration.yml 5.7 KB

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