integration.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 packages
  56. - name: Install node dependencies
  57. run: make V=1 node.env
  58. - name: Build themes
  59. run: make V=1 themes
  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: SEARX_DEBUG=1 make V=1 ci-gh-pages
  77. - name: Deploy
  78. if: github.ref == 'refs/heads/master'
  79. uses: JamesIves/github-pages-deploy-action@3.7.1
  80. with:
  81. GITHUB_TOKEN: ${{ github.token }}
  82. BRANCH: gh-pages
  83. FOLDER: build/gh-pages
  84. CLEAN: true # Automatically remove deleted files from the deploy branch
  85. SINGLE_COMMIT: True
  86. COMMIT_MESSAGE: build from commit ${{ github.sha }}
  87. dockers:
  88. name: Docker
  89. if: github.ref == 'refs/heads/master'
  90. needs:
  91. - python
  92. - themes
  93. - documentation
  94. env:
  95. DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
  96. runs-on: ubuntu-18.04
  97. steps:
  98. - name: Checkout
  99. if: env.DOCKERHUB_USERNAME != null
  100. uses: actions/checkout@v2
  101. with:
  102. # make sure "make docker.push" can get the git history
  103. fetch-depth: '0'
  104. - name: Set up QEMU
  105. if: env.DOCKERHUB_USERNAME != null
  106. uses: docker/setup-qemu-action@v1
  107. - name: Set up Docker Buildx
  108. if: env.DOCKERHUB_USERNAME != null
  109. uses: docker/setup-buildx-action@v1
  110. - name: Login to DockerHub
  111. if: env.DOCKERHUB_USERNAME != null
  112. uses: docker/login-action@v1
  113. with:
  114. username: ${{ secrets.DOCKERHUB_USERNAME }}
  115. password: ${{ secrets.DOCKERHUB_TOKEN }}
  116. - name: Build and push
  117. if: env.DOCKERHUB_USERNAME != null
  118. run: make -e GIT_URL=$(git remote get-url origin) docker.push