linters.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. name: Linters
  2. on:
  3. push:
  4. branches: [main, 4.x]
  5. paths-ignore:
  6. - '.github/**'
  7. - '!.github/workflows/linters.yml'
  8. - '!.github/CONTRIBUTING.md'
  9. pull_request:
  10. # We want all branches so we configure types to be the GH default again
  11. types: [opened, synchronize, reopened]
  12. paths-ignore:
  13. - '.github/**'
  14. - '!.github/workflows/linters.yml'
  15. - '!.github/CONTRIBUTING.md'
  16. env:
  17. YARN_ENABLE_GLOBAL_CACHE: false
  18. jobs:
  19. lint_js:
  20. name: Lint JavaScript/TypeScript
  21. runs-on: ubuntu-latest
  22. steps:
  23. - name: Checkout sources
  24. uses: actions/checkout@v3
  25. - name: Get yarn cache directory path
  26. id: yarn-cache-dir-path
  27. run:
  28. echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  29. - uses: actions/cache@v4
  30. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  31. with:
  32. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  33. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  34. restore-keys: |
  35. ${{ runner.os }}-yarn-
  36. - name: Install Node.js
  37. uses: actions/setup-node@v4
  38. with:
  39. node-version: lts/*
  40. - name: Install dependencies
  41. # List all projects that use a custom ESLint config:
  42. run:
  43. corepack yarn workspaces focus @uppy/angular @uppy-example/angular
  44. @uppy-example/react-native-expo @uppy/react-native @uppy-dev/build
  45. - name: Run linter
  46. run: corepack yarn run lint
  47. - name: Run Prettier
  48. run: corepack yarn run format:check-diff
  49. lint_md:
  50. name: Lint Markdown
  51. runs-on: ubuntu-latest
  52. steps:
  53. - name: Checkout sources
  54. uses: actions/checkout@v3
  55. - name: Get yarn cache directory path
  56. id: yarn-cache-dir-path
  57. run:
  58. echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  59. - uses: actions/cache@v4
  60. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  61. with:
  62. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  63. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  64. restore-keys: |
  65. ${{ runner.os }}-yarn-
  66. - name: Install Node.js
  67. uses: actions/setup-node@v4
  68. with:
  69. node-version: lts/*
  70. - name: Install dependencies
  71. run: corepack yarn workspaces focus @uppy-dev/build
  72. - name: Run linter
  73. run: corepack yarn run lint:markdown
  74. lint_docs:
  75. name: Lint Docs
  76. runs-on: ubuntu-latest
  77. steps:
  78. - name: Checkout Uppy.io sources
  79. uses: actions/checkout@v3
  80. with:
  81. repository: transloadit/uppy.io
  82. - run: rm -rf docs # the other PR has not landed
  83. - name: Checkout docs
  84. uses: actions/checkout@v3
  85. with:
  86. path: uppy
  87. - run: mv uppy /tmp/uppy && ln -s /tmp/uppy/docs docs
  88. - name: Install dependencies
  89. run: corepack yarn --immutable
  90. - name: Lint files
  91. run: corepack yarn lint
  92. - name: Test build website
  93. run: corepack yarn build