integration.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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.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. dockers:
  87. name: Docker
  88. if: github.ref == 'refs/heads/master'
  89. needs:
  90. - python
  91. - themes
  92. - documentation
  93. env:
  94. DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
  95. runs-on: ubuntu-18.04
  96. steps:
  97. - name: Checkout
  98. if: env.DOCKERHUB_USERNAME != null
  99. uses: actions/checkout@v2
  100. with:
  101. # make sure "make docker.push" can get the git history
  102. fetch-depth: '0'
  103. - name: Set up QEMU
  104. if: env.DOCKERHUB_USERNAME != null
  105. uses: docker/setup-qemu-action@v1
  106. - name: Set up Docker Buildx
  107. if: env.DOCKERHUB_USERNAME != null
  108. uses: docker/setup-buildx-action@v1
  109. - name: Login to DockerHub
  110. if: env.DOCKERHUB_USERNAME != null
  111. uses: docker/login-action@v1
  112. with:
  113. username: ${{ secrets.DOCKERHUB_USERNAME }}
  114. password: ${{ secrets.DOCKERHUB_TOKEN }}
  115. - name: Build and push
  116. if: env.DOCKERHUB_USERNAME != null
  117. run: make -e GIT_URL=$(git remote get-url origin) docker.push