integration.yml 6.2 KB

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