integration.yml 5.3 KB

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