companion.yml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. name: Companion
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. # We want all branches so we configure types to be the GH default again
  7. types: [ opened, synchronize, reopened ]
  8. jobs:
  9. test-legacy:
  10. name: Unit tests (legacy)
  11. runs-on: ubuntu-latest
  12. strategy:
  13. matrix:
  14. node-version: [10.20.1, 12.x, 17.x]
  15. steps:
  16. - name: Checkout sources
  17. uses: actions/checkout@v3
  18. - name: Get yarn cache directory path
  19. id: yarn-cache-dir-path
  20. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  21. - uses: actions/cache@v3
  22. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  23. with:
  24. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  25. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  26. restore-keys: |
  27. ${{ runner.os }}-yarn-
  28. - name: Install Node.js
  29. uses: actions/setup-node@v3
  30. with:
  31. node-version: ${{matrix.node-version}}
  32. - name: Install Corepack if needed
  33. run: corepack -v || npm install -g corepack
  34. - name: Install dependencies
  35. run: corepack yarn@3.1.1 install --no-immutable
  36. env:
  37. # Necessary for Node.js v10.x
  38. NODE_OPTIONS: --experimental-worker
  39. YARN_IGNORE_NODE: 1
  40. - name: Run tests
  41. run: corepack yarn run test:companion
  42. env:
  43. # Necessary for Node.js v10.x
  44. NODE_OPTIONS: --experimental-worker
  45. YARN_IGNORE_NODE: 1
  46. test:
  47. name: Unit tests
  48. runs-on: ubuntu-latest
  49. strategy:
  50. matrix:
  51. node-version: [14.x, 16.x, 18.x]
  52. steps:
  53. - name: Checkout sources
  54. uses: actions/checkout@v3
  55. - name: Get yarn cache directory path
  56. id: yarn-cache-dir-path
  57. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  58. - uses: actions/cache@v3
  59. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  60. with:
  61. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  62. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  63. restore-keys: |
  64. ${{ runner.os }}-yarn-
  65. - name: Install Node.js
  66. uses: actions/setup-node@v3
  67. with:
  68. node-version: ${{matrix.node-version}}
  69. - name: Install dependencies
  70. run: corepack yarn install --immutable
  71. - name: Run tests
  72. run: corepack yarn run test:companion