ci.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. name: CI
  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. unit_tests:
  10. name: Unit tests
  11. runs-on: ubuntu-latest
  12. strategy:
  13. matrix:
  14. node-version: [14.x, 16.x, 18.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 dependencies
  33. run: corepack yarn install --immutable
  34. - name: Run tests
  35. run: corepack yarn run test:unit
  36. lint_js:
  37. name: Lint JavaScript/TypeScript
  38. runs-on: ubuntu-latest
  39. steps:
  40. - name: Checkout sources
  41. uses: actions/checkout@v3
  42. - name: Get yarn cache directory path
  43. id: yarn-cache-dir-path
  44. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  45. - uses: actions/cache@v3
  46. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  47. with:
  48. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  49. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  50. restore-keys: |
  51. ${{ runner.os }}-yarn-
  52. - name: Install Node.js
  53. uses: actions/setup-node@v3
  54. with:
  55. node-version: lts/*
  56. - name: Install dependencies
  57. run: corepack yarn install --immutable
  58. - name: Run linter
  59. run: corepack yarn run lint
  60. lint_md:
  61. name: Lint Markdown
  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 "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  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 install --immutable
  82. - name: Run linter
  83. run: corepack yarn run lint:markdown
  84. types:
  85. name: Type tests
  86. runs-on: ubuntu-latest
  87. steps:
  88. - name: Checkout sources
  89. uses: actions/checkout@v3
  90. - name: Get yarn cache directory path
  91. id: yarn-cache-dir-path
  92. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  93. - uses: actions/cache@v3
  94. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  95. with:
  96. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  97. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  98. restore-keys: |
  99. ${{ runner.os }}-yarn-
  100. - name: Install Node.js
  101. uses: actions/setup-node@v3
  102. with:
  103. node-version: lts/*
  104. - name: Install dependencies
  105. run: corepack yarn install --immutable
  106. # Need to do a bunch of work to generate the locale typings 🙃
  107. - name: Prepare type declarations
  108. run: |
  109. corepack yarn run build:lib
  110. corepack yarn run build:companion
  111. corepack yarn run build:locale-pack
  112. - name: Run type tests
  113. run: corepack yarn run test:type