integration.yml 4.7 KB

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