|
| 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://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions |
| 12 | +# - https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_dispatch |
| 13 | +# - https://github.com/actions/checkout |
| 14 | +# - https://github.com/actions/setup-node |
| 15 | +# - https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#yarn2-configuration |
| 16 | +# - https://github.com/hmarr/debug-action |
| 17 | +# - https://vitest.dev/guide/testing-types.html#run-typechecking |
| 18 | + |
| 19 | +--- |
| 20 | +name: typescript-canary |
| 21 | +on: |
| 22 | + schedule: |
| 23 | + # every day, 3 hours after typescript@next release |
| 24 | + # https://github.com/microsoft/TypeScript/blob/v4.9.5/.github/workflows/nightly.yaml |
| 25 | + - cron: 0 10 * * * |
| 26 | + workflow_dispatch: |
| 27 | +permissions: |
| 28 | + contents: read |
| 29 | + packages: read |
| 30 | +env: |
| 31 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + HUSKY: 0 |
| 33 | +concurrency: |
| 34 | + cancel-in-progress: true |
| 35 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 36 | +jobs: |
| 37 | + typescript-canary: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + matrix: |
| 42 | + typescript-version: |
| 43 | + - next |
| 44 | + - latest |
| 45 | + steps: |
| 46 | + - id: debug |
| 47 | + name: Print environment variables and event payload |
| 48 | + uses: hmarr/debug-action@v2.1.0 |
| 49 | + - id: checkout |
| 50 | + name: Checkout ${{ github.ref_name }} |
| 51 | + uses: actions/checkout@v3.5.2 |
| 52 | + with: |
| 53 | + persist-credentials: false |
| 54 | + ref: ${{ github.ref }} |
| 55 | + - id: node |
| 56 | + name: Setup Node.js |
| 57 | + uses: actions/setup-node@v3.6.0 |
| 58 | + with: |
| 59 | + cache: yarn |
| 60 | + cache-dependency-path: yarn.lock |
| 61 | + node-version-file: .nvmrc |
| 62 | + - id: yarn |
| 63 | + name: Install dependencies |
| 64 | + run: yarn ${{ github.actor == 'dependabot[bot]' && '--no-immutable' || '--immutable' }} |
| 65 | + - id: typescript |
| 66 | + name: Install typescript@${{ matrix.typescript-version }} |
| 67 | + run: yarn add -D typescript@${{ matrix.typescript-version }} |
| 68 | + - id: set-typescript-version |
| 69 | + name: Set env.TYPESCRIPT_VERSION |
| 70 | + run: | |
| 71 | + echo "TYPESCRIPT_VERSION=$(jq .devDependencies.typescript package.json -r)" >>$GITHUB_ENV |
| 72 | + - id: print-typescript-version |
| 73 | + name: Print TypeScript version |
| 74 | + run: echo $TYPESCRIPT_VERSION |
| 75 | + - id: build |
| 76 | + name: Build project |
| 77 | + run: yarn build |
| 78 | + - id: typecheck |
| 79 | + name: Run typecheck |
| 80 | + run: yarn typecheck |
| 81 | + - id: typecheck-build |
| 82 | + name: Run typecheck-build |
| 83 | + run: yarn check:types:build |
0 commit comments