integration.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. name: Integration
  2. on: [push, pull_request]
  3. jobs:
  4. python:
  5. name: Python ${{ matrix.python-version }}
  6. runs-on: ubuntu-20.04
  7. strategy:
  8. matrix:
  9. os: [ubuntu-20.04]
  10. python-version: [3.6, 3.7, 3.8, 3.9]
  11. steps:
  12. - name: Checkout
  13. uses: actions/checkout@v2
  14. - name: Install Ubuntu packages
  15. run: |
  16. sudo ./utils/searx.sh install packages
  17. sudo apt install firefox
  18. - name: Set up Python
  19. uses: actions/setup-python@v2
  20. with:
  21. python-version: ${{ matrix.python-version }}
  22. architecture: 'x64'
  23. - name: Cache Python dependencies
  24. id: cache-python
  25. uses: actions/cache@v2
  26. with:
  27. path: ./local
  28. key: python-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements*.txt', 'setup.py') }}
  29. - name: Install Python dependencies
  30. if: steps.cache-python.outputs.cache-hit != 'true'
  31. run: |
  32. make V=1 install
  33. make V=1 gecko.driver
  34. - name: Run tests
  35. run: make V=1 ci.test
  36. - name: Test coverage
  37. run: make V=1 test.coverage
  38. - name: Store coverage result
  39. uses: actions/upload-artifact@v2
  40. with:
  41. name: coverage-${{ matrix.python-version }}
  42. path: coverage/
  43. retention-days: 60
  44. themes:
  45. name: Themes
  46. runs-on: ubuntu-20.04
  47. steps:
  48. - name: Checkout
  49. uses: actions/checkout@v2
  50. - name: Install Ubuntu packages
  51. run: sudo ./utils/searx.sh install packages
  52. - name: Install node dependencies
  53. run: make V=1 node.env
  54. - name: Build themes
  55. run: make V=1 themes
  56. documentation:
  57. name: Documentation
  58. runs-on: ubuntu-20.04
  59. steps:
  60. - name: Checkout
  61. uses: actions/checkout@v2
  62. with:
  63. persist-credentials: false
  64. - name: Install Ubuntu packages
  65. run: sudo ./utils/searx.sh install buildhost
  66. - name: Set up Python
  67. uses: actions/setup-python@v2
  68. with:
  69. python-version: '3.9'
  70. architecture: 'x64'
  71. - name: Build documentation
  72. run: SEARX_DEBUG=1 make V=1 ci-gh-pages
  73. - name: Deploy
  74. if: github.ref == 'refs/heads/master'
  75. uses: JamesIves/github-pages-deploy-action@3.7.1
  76. with:
  77. GITHUB_TOKEN: ${{ github.token }}
  78. BRANCH: gh-pages
  79. FOLDER: build/gh-pages
  80. CLEAN: true # Automatically remove deleted files from the deploy branch
  81. dockers:
  82. name: Docker
  83. if: github.ref == 'refs/heads/master'
  84. needs:
  85. - python
  86. - themes
  87. - documentation
  88. env:
  89. DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
  90. runs-on: ubuntu-18.04
  91. steps:
  92. - name: Checkout
  93. if: env.DOCKERHUB_USERNAME != null
  94. uses: actions/checkout@v2
  95. with:
  96. # make sure "make docker.push" can get the git history
  97. fetch-depth: '0'
  98. - name: Set up QEMU
  99. if: env.DOCKERHUB_USERNAME != null
  100. uses: docker/setup-qemu-action@v1
  101. - name: Set up Docker Buildx
  102. if: env.DOCKERHUB_USERNAME != null
  103. uses: docker/setup-buildx-action@v1
  104. - name: Login to DockerHub
  105. if: env.DOCKERHUB_USERNAME != null
  106. uses: docker/login-action@v1
  107. with:
  108. username: ${{ secrets.DOCKERHUB_USERNAME }}
  109. password: ${{ secrets.DOCKERHUB_TOKEN }}
  110. - name: Build and push
  111. if: env.DOCKERHUB_USERNAME != null
  112. run: make -e GIT_URL=$(git remote get-url origin) docker.push