ci.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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: [12.x, 14.x, 16.x, 17.x]
  15. steps:
  16. - name: Checkout sources
  17. uses: actions/checkout@v3
  18. - name: Install Corepack if needed
  19. run: corepack -v || npm install -g corepack
  20. - name: Get yarn cache directory path
  21. id: yarn-cache-dir-path
  22. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  23. - uses: actions/cache@v3
  24. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  25. with:
  26. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  27. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  28. restore-keys: |
  29. ${{ runner.os }}-yarn-
  30. - name: Install Node.js
  31. uses: actions/setup-node@v3
  32. with:
  33. node-version: ${{matrix.node-version}}
  34. - name: Install dependencies
  35. run: corepack yarn install --immutable
  36. - name: Run tests
  37. run: corepack yarn run test:unit
  38. lint_js:
  39. name: Lint JavaScript/TypeScript
  40. runs-on: ubuntu-latest
  41. steps:
  42. - name: Checkout sources
  43. uses: actions/checkout@v3
  44. - name: Get yarn cache directory path
  45. id: yarn-cache-dir-path
  46. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  47. - uses: actions/cache@v3
  48. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  49. with:
  50. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  51. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  52. restore-keys: |
  53. ${{ runner.os }}-yarn-
  54. - name: Install Node.js
  55. uses: actions/setup-node@v3
  56. with:
  57. node-version: lts/*
  58. - name: Install dependencies
  59. run: corepack yarn install --immutable
  60. - name: Run linter
  61. run: corepack yarn run lint
  62. lint_md:
  63. name: Lint Markdown
  64. runs-on: ubuntu-latest
  65. steps:
  66. - name: Checkout sources
  67. uses: actions/checkout@v3
  68. - name: Get yarn cache directory path
  69. id: yarn-cache-dir-path
  70. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  71. - uses: actions/cache@v3
  72. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  73. with:
  74. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  75. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  76. restore-keys: |
  77. ${{ runner.os }}-yarn-
  78. - name: Install Node.js
  79. uses: actions/setup-node@v3
  80. with:
  81. node-version: lts/*
  82. - name: Install dependencies
  83. run: corepack yarn install --immutable
  84. - name: Run linter
  85. run: corepack yarn run lint:markdown
  86. types:
  87. name: Type tests
  88. runs-on: ubuntu-latest
  89. steps:
  90. - name: Checkout sources
  91. uses: actions/checkout@v3
  92. - name: Get yarn cache directory path
  93. id: yarn-cache-dir-path
  94. run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)"
  95. - uses: actions/cache@v3
  96. id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
  97. with:
  98. path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
  99. key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
  100. restore-keys: |
  101. ${{ runner.os }}-yarn-
  102. - name: Install Node.js
  103. uses: actions/setup-node@v3
  104. with:
  105. node-version: lts/*
  106. - name: Install dependencies
  107. run: corepack yarn install --immutable
  108. # Need to do a bunch of work to generate the locale typings 🙃
  109. - name: Prepare type declarations
  110. run: |
  111. corepack yarn run build:lib
  112. corepack yarn run build:companion
  113. corepack yarn run build:locale-pack
  114. - name: Run type tests
  115. run: corepack yarn run test:type