Skip to content

Commit b3889a9

Browse files
setup(ci): separate legacy/new
1 parent b1e9a9d commit b3889a9

File tree

4 files changed

+53
-10
lines changed

4 files changed

+53
-10
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,41 @@ jobs:
9292
- name: Validate YAML files
9393
run: yamllint -c .yamllint.yaml -f github ./
9494

95-
tests:
95+
test:
96+
name: Unit, e2e, coverage
97+
98+
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
99+
100+
runs-on: ${{ matrix.os }}
101+
102+
strategy:
103+
fail-fast: false
104+
matrix:
105+
os:
106+
- macos-latest
107+
- ubuntu-latest
108+
- windows-latest
109+
110+
steps:
111+
- name: Harden the runner (Audit all outbound calls)
112+
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
113+
with:
114+
egress-policy: audit
115+
116+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
117+
with:
118+
persist-credentials: false
119+
show-progress: false
120+
- name: Set up Node.js LTS
121+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
122+
with:
123+
cache: "npm"
124+
check-latest: true
125+
node-version-file: ".nvmrc"
126+
- run: npm ci
127+
- run: node --run test
128+
129+
legacy-tests:
96130
name: Unit, e2e, coverage
97131

98132
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
@@ -126,10 +160,9 @@ jobs:
126160
check-latest: true
127161
node-version: ${{ matrix.node-version }}
128162
- run: npm ci
129-
- name: Run recipe tests
130-
run: >-
131-
node
132-
--run test
133-
--test-coverage-lines=0.8
134-
--test-reporter-destination=./coverage.lcov
135-
--test-reporter=lcov
163+
# Codemod has changed its paradigm, but there is still a recipe that uses the old one, which is why we run it alongside it.
164+
# The old paradigm used node to run codemod, which is why we run it on several versions.
165+
# REF: https://codemod.com/blog/new-codemod-cli
166+
- name: Run legacy recipe tests
167+
run: node --run test-legacy
168+

package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"lint:fix": "biome lint --fix ./",
88
"lint": "biome lint ./",
99
"pre-commit": "node --run lint:fix; node --run type-check; node --run test",
10-
"test": "npm run test --workspaces",
10+
"test": "npm run test --workspaces --if-present",
11+
"test-legacy": "npm run test-legacy --workspaces --if-present",
1112
"type-check": "tsc"
1213
},
1314
"repository": {

recipes/correct-ts-specifiers/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"scripts": {
1111
"start": "node --no-warnings --experimental-import-meta-resolve --experimental-strip-types ./src/workflow.ts",
12-
"test": "node --no-warnings --experimental-import-meta-resolve --experimental-test-module-mocks --experimental-test-snapshots --experimental-strip-types --import='@nodejs/codemod-utils/snapshots' --test --experimental-test-coverage --test-coverage-include='src/**/*' --test-coverage-exclude='**/*.test.ts' './**/*.test.ts'"
12+
"test-legacy": "node --no-warnings --experimental-import-meta-resolve --experimental-test-module-mocks --experimental-test-snapshots --experimental-strip-types --import='@nodejs/codemod-utils/snapshots' --test --experimental-test-coverage --test-coverage-include='src/**/*' --test-coverage-exclude='**/*.test.ts' './**/*.test.ts'"
1313
},
1414
"repository": {
1515
"type": "git",

0 commit comments

Comments
 (0)