api-docs-test.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. restore-keys: |
  45. ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip.outputs.pip-version }}-${{ secrets.PIP_CACHE_VERSION }}
  46. - name: Setup sentry python env
  47. uses: ./.github/actions/setup-sentry
  48. id: setup
  49. if: steps.changes.outputs.api_docs == 'true'
  50. with:
  51. snuba: true
  52. - name: Install Javascript Dependencies
  53. if: steps.changes.outputs.api_docs == 'true'
  54. run: |
  55. cd api-docs && yarn install --frozen-lockfile
  56. - name: Run API docs tests
  57. if: steps.changes.outputs.api_docs == 'true'
  58. run: |
  59. make test-api-docs