ci.yml 3.2 KB

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