feat: modernize cross-env with TypeScript, Vitest, and ESM-only build #31
Workflow file for this run
This file contains hidden or 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: Validate | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: π¨ Build and Validate | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [22, 24] | |
steps: | |
- name: π₯ Checkout | |
uses: actions/checkout@v4 | |
- name: π’ Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: π¦ Install dependencies | |
run: npm ci | |
- name: π¨ Build | |
run: npm run build | |
- name: π Type check | |
run: npm run typecheck | |
- name: π§Ή Lint | |
run: npm run lint | |
- name: π§ͺ Test | |
run: npm run test:run | |
- name: π Upload coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: false | |
- name: πΎ Cache build output | |
uses: actions/cache@v4 | |
with: | |
path: dist | |
# prettier-ignore | |
key: dist-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
dist-${{ matrix.node-version }}- | |
e2e: | |
name: π E2E Tests | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
node-version: [24] | |
steps: | |
- name: π₯ Checkout | |
uses: actions/checkout@v4 | |
- name: π’ Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: π¦ Install dependencies | |
run: npm ci | |
# ensure we don't implicitly rely on dev dependencies | |
- name: π¦ Prune dependencies | |
run: npm prune --production | |
- name: π Restore build output | |
uses: actions/cache@v4 | |
with: | |
path: dist | |
# prettier-ignore | |
key: dist-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
dist-${{ matrix.node-version }}- | |
- name: π§ͺ Run cross-env e2e tests | |
run: node e2e/test-cross-env.js | |
- name: π Run cross-env-shell e2e tests | |
run: node e2e/test-cross-env-shell.js |