ci.yml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. jobs:
  27. unit_tests:
  28. name: Unit tests
  29. runs-on: ubuntu-latest
  30. strategy:
  31. matrix:
  32. node-version: [14.x, 16.x, 18.x]
  33. steps:
  34. - name: Checkout sources
  35. uses: actions/checkout@v3
  36. - name: Get yarn cache directory path
  37. id: yarn-cache-dir-path
  38. run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  39. - uses: actions/cache@v3
  40. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  41. with:
  42. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  43. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  44. restore-keys: |
  45. ${{ runner.os }}-yarn-
  46. - name: Install Node.js
  47. uses: actions/setup-node@v3
  48. with:
  49. node-version: ${{matrix.node-version}}
  50. - name: Install dependencies
  51. run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }')
  52. env:
  53. # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation
  54. CYPRESS_INSTALL_BINARY: 0
  55. - name: Run tests
  56. run: corepack yarn run test:unit
  57. types:
  58. name: Type tests
  59. runs-on: ubuntu-latest
  60. steps:
  61. - name: Checkout sources
  62. uses: actions/checkout@v3
  63. - name: Get yarn cache directory path
  64. id: yarn-cache-dir-path
  65. run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  66. - uses: actions/cache@v3
  67. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  68. with:
  69. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  70. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  71. restore-keys: |
  72. ${{ runner.os }}-yarn-
  73. - name: Install Node.js
  74. uses: actions/setup-node@v3
  75. with:
  76. node-version: lts/*
  77. - name: Install dependencies
  78. run: corepack yarn workspaces focus $(corepack yarn workspaces list --json | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io") print $0 }')
  79. env:
  80. # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation
  81. CYPRESS_INSTALL_BINARY: 0
  82. # Need to do a bunch of work to generate the locale typings 🙃
  83. - name: Prepare type declarations
  84. run: |
  85. corepack yarn run build:lib
  86. corepack yarn run build:companion
  87. corepack yarn run build:locale-pack
  88. - name: Run type tests
  89. run: corepack yarn run test:type