Skip to content

Commit f169f70

Browse files
committed
ci(workflows): [typescript] add typescript workflow
Signed-off-by: Lexus Drumgold <unicornware@flexdevelopment.llc>
1 parent 78e41eb commit f169f70

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

.github/workflows/typescript.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# TypeScript Check
2+
#
3+
# Run type tests against different versions of TypeScript.
4+
#
5+
# References:
6+
#
7+
# - https://docs.github.com/actions/automating-builds-and-tests/building-and-testing-nodejs
8+
# - https://docs.github.com/actions/learn-github-actions/contexts
9+
# - https://docs.github.com/actions/using-jobs/using-a-matrix-for-your-jobs
10+
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#pull_request
11+
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#push
12+
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#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://vitest.dev/guide/testing-types.html#run-typechecking
17+
18+
---
19+
name: typescript
20+
on:
21+
pull_request:
22+
push:
23+
branches:
24+
- feat/**
25+
- hotfix/**
26+
- main
27+
workflow_dispatch:
28+
permissions:
29+
packages: read
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
HUSKY: 0
33+
REF: ${{ github.head_ref || github.ref_name }}
34+
concurrency:
35+
group: ${{ github.workflow }}-${{ github.ref }}
36+
cancel-in-progress: true
37+
jobs:
38+
typescript:
39+
if: |
40+
github.event_name == 'pull_request' ||
41+
github.event_name == 'workflow_dispatch' ||
42+
!startsWith(github.event.head_commit.message, 'release:')
43+
runs-on: ubuntu-latest
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
typescript-version:
48+
- latest
49+
- ~4.8.0
50+
- ~4.7.0
51+
steps:
52+
- id: debug
53+
name: Print environment variables and event payload
54+
uses: hmarr/debug-action@v2.1.0
55+
- id: checkout
56+
name: Checkout ${{ env.REF }}
57+
uses: actions/checkout@v3.2.0
58+
with:
59+
ref: ${{ env.REF }}
60+
- id: node
61+
name: Setup Node.js
62+
uses: actions/setup-node@v3.5.1
63+
with:
64+
cache: yarn
65+
cache-dependency-path: yarn.lock
66+
node-version-file: .nvmrc
67+
- id: yarn
68+
name: Install dependencies
69+
run: yarn ${{ github.actor == 'dependabot[bot]' && '--no-immutable' || '--immutable' }}
70+
- id: typescript
71+
name: Install typescript@${{ matrix.typescript-version }}
72+
run: yarn add -D typescript@${{ matrix.typescript-version }}
73+
- id: typecheck
74+
name: Run typecheck
75+
run: yarn typecheck

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const config: UserConfigExport = defineConfig((): UserConfig => {
103103
typecheck: {
104104
allowJs: false,
105105
checker: 'tsc',
106-
ignoreSourceErrors: !ci,
106+
ignoreSourceErrors: false,
107107
include: ['**/__tests__/*.spec-d.ts'],
108108
tsconfig: path.resolve('tsconfig.typecheck.json')
109109
}

0 commit comments

Comments
 (0)