ci.yml 3.1 KB

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