chore(.github/workflows): improve workflow with removing duplicated configs #980
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Old TypeScript | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
test_matrix: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
typescript: | |
- 5.5.4 | |
- 5.4.5 | |
- 5.3.3 | |
- 5.2.2 | |
- 5.1.6 | |
- 5.0.4 | |
- 4.9.5 | |
- 4.8.4 | |
- 4.7.4 | |
- 4.6.4 | |
- 4.5.5 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
cache-dependency-path: '**/pnpm-lock.yaml' | |
- run: pnpm install --frozen-lockfile | |
- run: pnpm build | |
- name: Patch for all TS | |
run: | | |
sed -i~ 's/"isolatedDeclarations": true,//' tsconfig.json | |
- name: Patch for v4/v3 TS | |
if: ${{ startsWith(matrix.typescript, '4.') || startsWith(matrix.typescript, '3.') }} | |
run: | | |
sed -i~ 's/"verbatimModuleSyntax": true,//' tsconfig.json | |
- name: Patch for Old TS | |
run: | | |
sed -i~ 's/"moduleResolution": "bundler",/"moduleResolution": "node",/' tsconfig.json | |
sed -i~ 's/"allowImportingTsExtensions": true,//' tsconfig.json | |
sed -i~ 's/"valtio": \["\.\/src\/index\.ts"\],/"valtio": [".\/dist\/index.d.ts"],/' tsconfig.json | |
sed -i~ 's/"valtio\/\*": \["\.\/src\/\*\.ts"\]/"valtio\/*": [".\/dist\/*.d.ts"]/' tsconfig.json | |
sed -i~ 's/"include": .*/"include": ["src\/types.d.ts", "dist\/**\/*", "tests\/**\/*"],/' tsconfig.json | |
pnpm add -D @types/node@22.2.0 | |
- name: Install old TypeScript | |
run: pnpm add -D typescript@${{ matrix.typescript }} | |
- name: Test ${{ matrix.typescript }} | |
run: pnpm test:types |