ci.yml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. name: CI
  2. on:
  3. push:
  4. branches: [ main ]
  5. paths-ignore:
  6. - '**.md'
  7. - 'assets/**'
  8. - 'e2e/**'
  9. - 'examples/**'
  10. - 'private/**'
  11. - 'website/**'
  12. - '.github/**'
  13. - '!.github/workflows/ci.yml'
  14. pull_request:
  15. # We want all branches so we configure types to be the GH default again
  16. types: [ opened, synchronize, reopened ]
  17. paths-ignore:
  18. - '**.md'
  19. - 'assets/**'
  20. - 'e2e/**'
  21. - 'examples/**'
  22. - 'private/**'
  23. - 'website/**'
  24. - '.github/**'
  25. - '!.github/workflows/ci.yml'
  26. env:
  27. YARN_ENABLE_GLOBAL_CACHE: false
  28. jobs:
  29. unit_tests:
  30. name: Unit tests
  31. runs-on: ubuntu-latest
  32. strategy:
  33. matrix:
  34. node-version: [16.x, 18.x, 20.x]
  35. steps:
  36. - name: Checkout sources
  37. uses: actions/checkout@v3
  38. - name: Get yarn cache directory path
  39. id: yarn-cache-dir-path
  40. run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  41. - uses: actions/cache@v3
  42. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  43. with:
  44. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  45. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  46. restore-keys: |
  47. ${{ runner.os }}-yarn-
  48. - name: Install Node.js
  49. uses: actions/setup-node@v3
  50. with:
  51. node-version: ${{matrix.node-version}}
  52. - name: Install dependencies
  53. run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }')
  54. env:
  55. # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation
  56. CYPRESS_INSTALL_BINARY: 0
  57. - name: Run tests
  58. run: corepack yarn run test:unit
  59. types:
  60. name: Type tests
  61. runs-on: ubuntu-latest
  62. steps:
  63. - name: Checkout sources
  64. uses: actions/checkout@v3
  65. - name: Get yarn cache directory path
  66. id: yarn-cache-dir-path
  67. run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  68. - uses: actions/cache@v3
  69. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  70. with:
  71. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  72. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  73. restore-keys: |
  74. ${{ runner.os }}-yarn-
  75. - name: Install Node.js
  76. uses: actions/setup-node@v3
  77. with:
  78. node-version: lts/*
  79. - name: Install dependencies
  80. run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }')
  81. env:
  82. # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation
  83. CYPRESS_INSTALL_BINARY: 0
  84. # Need to do a bunch of work to generate the locale typings 🙃
  85. - name: Prepare type declarations
  86. run: |
  87. corepack yarn run build:lib
  88. corepack yarn run build:companion
  89. corepack yarn run build:locale-pack
  90. - name: Run type tests
  91. run: corepack yarn run test:type