ci.yml 4.7 KB

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