Skip to content

Commit 2a8b7bc

Browse files
committed
chore: set tsx env vars per job
1 parent b23547d commit 2a8b7bc

File tree

7 files changed

+40
-14
lines changed

7 files changed

+40
-14
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ on:
99
env:
1010
NX_NON_NATIVE_HASHER: true
1111
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
12-
NODE_OPTIONS: --import tsx
13-
TSX_TSCONFIG_PATH: tsconfig.base.json
1412

1513
jobs:
1614
format:
@@ -31,6 +29,9 @@ jobs:
3129
- name: Install dependencies
3230
run: npm ci
3331
- name: Check formatting of affected files
32+
env:
33+
NODE_OPTIONS: --import tsx
34+
TSX_TSCONFIG_PATH: tsconfig.base.json
3435
run: npx nx format:check
3536

3637
lint:
@@ -51,6 +52,9 @@ jobs:
5152
- name: Install dependencies
5253
run: npm ci
5354
- name: Lint affected projects
55+
env:
56+
NODE_OPTIONS: --import tsx
57+
TSX_TSCONFIG_PATH: tsconfig.base.json
5458
run: npx nx affected -t lint --parallel=3
5559

5660
unit-test:
@@ -75,6 +79,9 @@ jobs:
7579
- name: Install dependencies
7680
run: npm ci
7781
- name: Unit test affected projects
82+
env:
83+
NODE_OPTIONS: --import tsx
84+
TSX_TSCONFIG_PATH: tsconfig.base.json
7885
run: npx nx affected -t unit-test --parallel=3
7986

8087
integration-test:
@@ -99,6 +106,9 @@ jobs:
99106
- name: Install dependencies
100107
run: npm ci
101108
- name: Integration test affected projects
109+
env:
110+
NODE_OPTIONS: --import tsx
111+
TSX_TSCONFIG_PATH: tsconfig.base.json
102112
run: npx nx affected -t int-test --parallel=3
103113

104114
e2e:
@@ -123,6 +133,9 @@ jobs:
123133
- name: Install dependencies
124134
run: npm ci
125135
- name: E2E test affected projects
136+
env:
137+
NODE_OPTIONS: --import tsx
138+
TSX_TSCONFIG_PATH: tsconfig.base.json
126139
run: npx nx affected -t e2e-test --parallel=1
127140

128141
build:
@@ -143,6 +156,9 @@ jobs:
143156
- name: Install dependencies
144157
run: npm ci
145158
- name: Build all projects # affected is not used to be able to test-releae packages
159+
env:
160+
NODE_OPTIONS: --import tsx
161+
TSX_TSCONFIG_PATH: tsconfig.base.json
146162
run: npx nx run-many --target=build --parallel=3
147163
- name: Test-release packages
148164
run: npx pkg-pr-new publish "packages/**/dist"

.github/workflows/code-pushup-fork.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ on:
1313

1414
env:
1515
NX_NON_NATIVE_HASHER: true
16-
NODE_OPTIONS: --import tsx
17-
TSX_TSCONFIG_PATH: tsconfig.base.json
1816

1917
permissions:
2018
pull-requests: write
@@ -24,6 +22,9 @@ jobs:
2422
runs-on: ubuntu-latest
2523
name: Standalone mode (fork)
2624
if: github.event.pull_request.head.repo.fork
25+
env:
26+
NODE_OPTIONS: --import tsx
27+
TSX_TSCONFIG_PATH: tsconfig.base.json
2728
steps:
2829
- name: Checkout repository
2930
uses: actions/checkout@v4
@@ -48,6 +49,9 @@ jobs:
4849
runs-on: ubuntu-latest
4950
name: Monorepo mode (fork)
5051
if: github.event.pull_request.head.repo.fork
52+
env:
53+
NODE_OPTIONS: --import tsx
54+
TSX_TSCONFIG_PATH: tsconfig.base.json
5155
steps:
5256
- name: Checkout repository
5357
uses: actions/checkout@v4

.github/workflows/code-pushup.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ on:
99
env:
1010
NX_NON_NATIVE_HASHER: true
1111
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
12-
NODE_OPTIONS: --import tsx
13-
TSX_TSCONFIG_PATH: tsconfig.base.json
1412

1513
permissions:
1614
pull-requests: write
@@ -50,6 +48,8 @@ jobs:
5048
if: ${{ !github.event.pull_request.head.repo.fork }}
5149
env:
5250
CP_API_KEY: ${{ secrets.CP_API_KEY }}
51+
NODE_OPTIONS: --import tsx
52+
TSX_TSCONFIG_PATH: tsconfig.base.json
5353
steps:
5454
- name: Checkout repository
5555
uses: actions/checkout@v4

.github/workflows/coverage.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ on:
77
env:
88
NX_NON_NATIVE_HASHER: true
99
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
10-
NODE_OPTIONS: --import tsx
11-
TSX_TSCONFIG_PATH: tsconfig.base.json
1210

1311
jobs:
1412
list-packages:
@@ -26,6 +24,9 @@ jobs:
2624
run: npm ci
2725
- name: List packages using Nx CLI
2826
id: list-packages
27+
env:
28+
NODE_OPTIONS: --import tsx
29+
TSX_TSCONFIG_PATH: tsconfig.base.json
2930
run: |
3031
matrix=$(node tools/scripts/create-codecov-matrix.js)
3132
echo "matrix=$matrix" >> $GITHUB_OUTPUT
@@ -50,6 +51,9 @@ jobs:
5051
- name: Install dependencies
5152
run: npm ci
5253
- name: Execute tests with coverage
54+
env:
55+
NODE_OPTIONS: --import tsx
56+
TSX_TSCONFIG_PATH: tsconfig.base.json
5357
run: npx nx run ${{ matrix.project }}:${{ matrix.target }}
5458
- name: Upload coverage reports to Codecov
5559
uses: codecov/codecov-action@v4

.github/workflows/publish.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ permissions:
1818
env:
1919
NX_NON_NATIVE_HASHER: true
2020
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
21-
NODE_OPTIONS: --import tsx
22-
TSX_TSCONFIG_PATH: tsconfig.base.json
2321

2422
jobs:
2523
publish:
@@ -44,4 +42,7 @@ jobs:
4442
- name: Install dependencies
4543
run: npm ci
4644
- name: Publish packages to npm
45+
env:
46+
NODE_OPTIONS: --import tsx
47+
TSX_TSCONFIG_PATH: tsconfig.base.json
4748
run: npx nx release publish

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ jobs:
1717
env:
1818
NX_NON_NATIVE_HASHER: true
1919
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
20-
NODE_OPTIONS: --import tsx
21-
TSX_TSCONFIG_PATH: tsconfig.base.json
2220
steps:
2321
- name: Authenticate as "Code PushUp Bot" GitHub App
2422
uses: actions/create-github-app-token@v2
@@ -48,6 +46,8 @@ jobs:
4846
- name: Install dependencies
4947
run: npm ci
5048
- name: Version, release and generate changelog
51-
run: npx nx release --skip-publish
5249
env:
50+
NODE_OPTIONS: --import tsx
51+
TSX_TSCONFIG_PATH: tsconfig.base.json
5352
GH_TOKEN: ${{ steps.app-token.outputs.token }}
53+
run: npx nx release --skip-publish

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ This project uses local Nx plugins and generators written in TypeScript. To run
4646
- `TSX_TSCONFIG_PATH` - Enables path aliases like `@code-pushup/models` in generators/executors
4747

4848
4. **CI Configuration**:
49-
- Both variables are set **globally** in all GitHub Actions workflows
49+
- Both variables are set at the **job or step level** in all GitHub Actions workflows
50+
- Applied after `npm ci` to ensure `tsx` is installed before Node tries to import it
5051
- Ensures consistent behavior between local development and CI
5152

5253
**❗️** Test Inclusion Logic

0 commit comments

Comments
 (0)