integration.yml 5.6 KB

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