ci.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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: [18.x, 20.x]
  35. steps:
  36. - name: Checkout sources
  37. uses: actions/checkout@v4
  38. - name: Get yarn cache directory path
  39. id: yarn-cache-dir-path
  40. run:
  41. echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  42. - uses: actions/cache@v4
  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@v4
  51. with:
  52. node-version: ${{matrix.node-version}}
  53. - name: Install dependencies
  54. run:
  55. corepack yarn workspaces focus $(corepack yarn workspaces list --json
  56. | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io")
  57. print $0 }')
  58. env:
  59. # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation
  60. CYPRESS_INSTALL_BINARY: 0
  61. - name: Run tests
  62. run: corepack yarn run test:unit
  63. types:
  64. name: Type tests
  65. runs-on: ubuntu-latest
  66. steps:
  67. - name: Checkout sources
  68. uses: actions/checkout@v4
  69. - name: Get yarn cache directory path
  70. id: yarn-cache-dir-path
  71. run:
  72. echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
  73. - uses: actions/cache@v4
  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@v4
  82. with:
  83. node-version: lts/*
  84. - name: Install dependencies
  85. run:
  86. corepack yarn workspaces focus $(corepack yarn workspaces list --json
  87. | jq -r .name | awk '/^@uppy-example/{ next } { if ($0!="uppy.io")
  88. print $0 }')
  89. env:
  90. # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation
  91. CYPRESS_INSTALL_BINARY: 0
  92. - name: Attempt building TS packages
  93. run: corepack yarn run build:ts