api-docs-test.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: api docs
  2. on:
  3. push:
  4. branches:
  5. - master
  6. pull_request:
  7. branches:
  8. - master
  9. jobs:
  10. test:
  11. name: api docs test
  12. runs-on: ubuntu-20.04
  13. steps:
  14. - uses: actions/checkout@v2
  15. - name: Check for python and `api-docs` file changes
  16. uses: getsentry/paths-filter@v2
  17. id: changes
  18. with:
  19. token: ${{ github.token }}
  20. filters: .github/file-filters.yml
  21. - uses: volta-cli/action@v1
  22. if: steps.changes.outputs.api_docs == 'true'
  23. - name: Set python version output
  24. id: python-version
  25. if: steps.changes.outputs.api_docs == 'true'
  26. run: |
  27. echo "::set-output name=python-version::$(cat .python-version)"
  28. # Until GH composite actions can use `uses`, we need to setup python here
  29. - uses: actions/setup-python@v2
  30. if: steps.changes.outputs.api_docs == 'true'
  31. with:
  32. python-version: ${{ steps.python-version.outputs.python-version }}
  33. - name: Setup pip
  34. uses: ./.github/actions/setup-pip
  35. id: pip
  36. if: steps.changes.outputs.api_docs == 'true'
  37. - name: pip cache
  38. uses: actions/cache@v2
  39. if: steps.changes.outputs.api_docs == 'true'
  40. with:
  41. path: ${{ steps.pip.outputs.pip-cache-dir }}
  42. key: |
  43. ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}-${{ secrets.PIP_CACHE_VERSION }}-${{ hashFiles('requirements-*.txt', '!requirements-pre-commit.txt') }}
  44. - name: Setup sentry python env
  45. uses: ./.github/actions/setup-sentry
  46. id: setup
  47. if: steps.changes.outputs.api_docs == 'true'
  48. with:
  49. snuba: true
  50. - name: Install Javascript Dependencies
  51. if: steps.changes.outputs.api_docs == 'true'
  52. run: |
  53. cd api-docs && yarn install --frozen-lockfile
  54. - name: Run API docs tests
  55. if: steps.changes.outputs.api_docs == 'true'
  56. run: |
  57. make test-api-docs