|
| 1 | +# TypeScript Canary Check |
| 2 | +# |
| 3 | +# Run type tests against the latest and next versions of TypeScript. |
| 4 | +# |
| 5 | +# References: |
| 6 | +# |
| 7 | +# - https://docs.github.com/actions/learn-github-actions/contexts |
| 8 | +# - https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs |
| 9 | +# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#schedule |
| 10 | +# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch |
| 11 | +# - https://github.com/actions/checkout |
| 12 | +# - https://github.com/actions/setup-node |
| 13 | +# - https://vitest.dev/guide/testing-types.html#run-typechecking |
| 14 | + |
| 15 | +--- |
| 16 | +name: typescript-canary |
| 17 | +on: |
| 18 | + schedule: |
| 19 | + # every day, 3 hours after typescript@next release |
| 20 | + # https://github.com/microsoft/TypeScript/blob/v4.9.4/.github/workflows/nightly.yaml |
| 21 | + - cron: 0 10 * * * |
| 22 | + workflow_dispatch: |
| 23 | +permissions: |
| 24 | + packages: read |
| 25 | +env: |
| 26 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + HUSKY: 0 |
| 28 | + REF: ${{ github.head_ref || github.ref_name }} |
| 29 | +jobs: |
| 30 | + typescript-canary: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + typescript-version: |
| 36 | + - next |
| 37 | + - latest |
| 38 | + steps: |
| 39 | + - id: debug |
| 40 | + name: Print environment variables and event payload |
| 41 | + |
| 42 | + - id: checkout |
| 43 | + name: Checkout ${{ env.REF }} |
| 44 | + |
| 45 | + with: |
| 46 | + ref: ${{ env.REF }} |
| 47 | + - id: node |
| 48 | + name: Setup Node.js |
| 49 | + |
| 50 | + with: |
| 51 | + cache: yarn |
| 52 | + cache-dependency-path: yarn.lock |
| 53 | + node-version-file: .nvmrc |
| 54 | + - id: yarn |
| 55 | + name: Install dependencies |
| 56 | + run: yarn ${{ github.actor == 'dependabot[bot]' && '--no-immutable' || '--immutable' }} |
| 57 | + - id: typescript |
| 58 | + name: Install typescript@${{ matrix.typescript-version }} |
| 59 | + run: yarn add -D typescript@${{ matrix.typescript-version }} |
| 60 | + - id: typescript-version |
| 61 | + name: Print TypeScript version |
| 62 | + run: jq .devDependencies.typescript package.json -r |
| 63 | + - id: build |
| 64 | + name: Build project |
| 65 | + run: yarn build |
| 66 | + env: |
| 67 | + NODE_ENV: production |
| 68 | + - id: typecheck |
| 69 | + name: Run typecheck |
| 70 | + run: yarn typecheck |
| 71 | + - id: typecheck-build |
| 72 | + name: Run typecheck-build |
| 73 | + run: yarn check:types:build |
0 commit comments