ci.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. name: CI
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. # We want all branches so we configure types to be the GH default again
  7. types: [ opened, synchronize, reopened ]
  8. paths-ignore:
  9. - 'examples/**'
  10. - 'private/**'
  11. - 'website/**'
  12. - '.github/workflows/**'
  13. jobs:
  14. unit_tests:
  15. name: Unit tests
  16. runs-on: ubuntu-latest
  17. strategy:
  18. matrix:
  19. node-version: [14.x, 16.x, 18.x]
  20. steps:
  21. - name: Checkout sources
  22. uses: actions/checkout@v3
  23. - name: Get yarn cache directory path
  24. id: yarn-cache-dir-path
  25. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  26. - uses: actions/cache@v3
  27. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  28. with:
  29. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  30. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  31. restore-keys: |
  32. ${{ runner.os }}-yarn-
  33. - name: Install Node.js
  34. uses: actions/setup-node@v3
  35. with:
  36. node-version: ${{matrix.node-version}}
  37. - name: Install dependencies
  38. run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }')
  39. env:
  40. # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation
  41. CYPRESS_INSTALL_BINARY: 0
  42. - name: Run tests
  43. run: corepack yarn run test:unit
  44. lint_js:
  45. name: Lint JavaScript/TypeScript
  46. runs-on: ubuntu-latest
  47. steps:
  48. - name: Checkout sources
  49. uses: actions/checkout@v3
  50. - name: Get yarn cache directory path
  51. id: yarn-cache-dir-path
  52. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  53. - uses: actions/cache@v3
  54. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  55. with:
  56. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  57. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  58. restore-keys: |
  59. ${{ runner.os }}-yarn-
  60. - name: Install Node.js
  61. uses: actions/setup-node@v3
  62. with:
  63. node-version: lts/*
  64. - name: Install dependencies
  65. # List all projects that use a custom ESLint config:
  66. run: corepack yarn workspaces focus @uppy/angular @uppy-example/angular @uppy-example/react-native-expo @uppy/react-native @uppy-dev/build
  67. - name: Run linter
  68. run: corepack yarn run lint
  69. lint_md:
  70. name: Lint Markdown
  71. runs-on: ubuntu-latest
  72. steps:
  73. - name: Checkout sources
  74. uses: actions/checkout@v3
  75. - name: Get yarn cache directory path
  76. id: yarn-cache-dir-path
  77. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  78. - uses: actions/cache@v3
  79. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  80. with:
  81. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  82. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  83. restore-keys: |
  84. ${{ runner.os }}-yarn-
  85. - name: Install Node.js
  86. uses: actions/setup-node@v3
  87. with:
  88. node-version: lts/*
  89. - name: Install dependencies
  90. run: corepack yarn workspaces focus @uppy-dev/build
  91. - name: Run linter
  92. run: corepack yarn run lint:markdown
  93. types:
  94. name: Type tests
  95. runs-on: ubuntu-latest
  96. steps:
  97. - name: Checkout sources
  98. uses: actions/checkout@v3
  99. - name: Get yarn cache directory path
  100. id: yarn-cache-dir-path
  101. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  102. - uses: actions/cache@v3
  103. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  104. with:
  105. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  106. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  107. restore-keys: |
  108. ${{ runner.os }}-yarn-
  109. - name: Install Node.js
  110. uses: actions/setup-node@v3
  111. with:
  112. node-version: lts/*
  113. - name: Install dependencies
  114. run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }')
  115. env:
  116. # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation
  117. CYPRESS_INSTALL_BINARY: 0
  118. # Need to do a bunch of work to generate the locale typings 🙃
  119. - name: Prepare type declarations
  120. run: |
  121. corepack yarn run build:lib
  122. corepack yarn run build:companion
  123. corepack yarn run build:locale-pack
  124. - name: Run type tests
  125. run: corepack yarn run test:type