Skip to content

Commit b6c9510

Browse files
committed
chore: fix-ci
1 parent fc59acd commit b6c9510

File tree

5 files changed

+47
-29
lines changed

5 files changed

+47
-29
lines changed

.envrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1+
# Ensure Nix is available even in non-login shells (what direnv uses)
2+
if [ -r /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]; then
3+
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
4+
elif [ -r "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
5+
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
6+
fi
7+
18
use flake

.github/workflows/ci.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ jobs:
3737
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
3838

3939
- name: Install Dependencies
40-
run: nix develop --command pnpm install --frozen-lockfile
40+
run: nix develop --command bash -c 'pnpm install --frozen-lockfile'
4141

4242
# This line enables distribution
4343
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
4444
- name: Start Nx Cloud CI Run
45-
run: nix develop --command pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN"
45+
run: nix develop --command bash -c 'pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN"'
4646

4747
- name: Check Sync
48-
run: nix develop --command pnpm nx sync:check
48+
run: nix develop --command bash -c 'pnpm nx sync:check'
4949

5050
- name: Cache Playwright browsers
5151
uses: actions/cache@v4
@@ -56,22 +56,22 @@ jobs:
5656
${{ runner.os }}-playwright-
5757
5858
- name: Install Playwright Browsers
59-
run: nix develop --command pnpm exec playwright install
59+
run: nix develop --command bash -c 'pnpm exec playwright install'
6060

6161
- uses: nrwl/nx-set-shas@v4
6262
# This line is needed for nx affected to work when CI is running on a PR
6363
- run: git branch --track main origin/main
6464

6565
- name: Run Core Nx Commands
6666
run: |
67-
nix develop --command -- <<EOF
67+
nix develop --command bash -c '
6868
pnpm exec nx-cloud record -- nx format:check
6969
pnpm exec nx affected -t build typecheck lint test e2e-ci
70-
EOF
70+
'
7171
7272
- name: Fix CI (if necessary)
7373
if: always()
74-
run: nix develop --command npx nx-cloud fix-ci
74+
run: nix develop --command bash -c 'npx nx-cloud fix-ci'
7575

7676
- uses: codecov/codecov-action@v5
7777
with:
@@ -88,10 +88,14 @@ jobs:
8888
retention-days: 30
8989

9090
- name: Ensure builds run
91-
run: nix develop --command pnpm nx run-many -t build
91+
run: nix develop --command bash -c 'NX_CLOUD_DISTRIBUTED_EXECUTION=false pnpm nx run-many -t build'
92+
93+
- name: Preview Publish
94+
run: nix develop --command bash -c 'pnpm pkg-pr-new publish './packages/*' './packages/sdk-effects/*' --packageManager=pnpm'
95+
9296

9397
- name: build docs
94-
run: nix develop --command pnpm generate-docs
98+
run: nix develop --command bash -c 'pnpm generate-docs'
9599

96100
- name: preview-docs
97101
uses: rajyan/preview-pages@v1
@@ -117,7 +121,7 @@ jobs:
117121
- name: Calculate bundle sizes
118122
id: bundle-analysis
119123
run: |
120-
nix develop --command -- <<EOF
124+
nix develop --command bash -c '
121125
# Make script executable
122126
chmod +x ./scripts/bundle-sizes.sh
123127
# Check if baseline exists
@@ -130,7 +134,7 @@ jobs:
130134
fi
131135
# Run the bundle size calculation
132136
./scripts/bundle-sizes.sh
133-
EOF
137+
'
134138
135139
- name: Upload current stats as artifact
136140
uses: actions/upload-artifact@v4

.github/workflows/publish.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ jobs:
5252

5353
- name: Install Dependencies
5454
run: |
55-
nix develop --command -- <<EOF
55+
nix develop --command bash -c '
5656
npm install -g npm@latest
5757
pnpm install --frozen-lockfile
58-
EOF
58+
'
5959
6060
- name: Start Nx Cloud CI Run
61-
run: nix develop --command pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN"
61+
run: nix develop --command bash -c 'NX_CLOUD_DISTRIBUTED_EXECUTION=false pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN"'
6262

6363
- name: Cache Playwright browsers
6464
uses: actions/cache@v4
@@ -70,11 +70,11 @@ jobs:
7070
7171
- name: Install Browsers, Configure Pnpm, and Run Nx Affected
7272
run: |
73-
nix develop --command -- <<EOF
73+
nix develop --command bash -c '
7474
pnpm exec playwright install
7575
pnpm config set store-dir $PNPM_CACHE_FOLDER
7676
pnpm exec nx affected -t build lint test e2e-ci
77-
EOF
77+
'
7878
7979
- uses: actions/upload-artifact@v4
8080
if: ${{ !cancelled() }}
@@ -89,8 +89,8 @@ jobs:
8989
uses: changesets/action@v1
9090
id: changesets
9191
with:
92-
publish: nix develop --command pnpm ci:release
93-
version: nix develop --command pnpm ci:version
92+
publish: nix develop --command bash -c 'pnpm ci:release'
93+
version: nix develop --command bash -c 'pnpm ci:version'
9494
title: Release PR
9595
branch: main
9696
commit: 'chore: version-packages'
@@ -108,16 +108,20 @@ jobs:
108108
webhook-type: webhook-trigger
109109
payload: steps.changesets.outputs.publishedPackages
110110

111+
- name: Preview Publish
112+
if: steps.changesets.outputs.published == 'false'
113+
run: nix develop --command bash -c 'pnpm pkg-pr-new publish './packages/*' './packages/sdk-effects/*' --packageManager=pnpm'
114+
111115
- uses: codecov/codecov-action@v5
112116
with:
113117
files: ./packages/**/coverage/*.xml
114118
token: ${{ secrets.CODECOV_TOKEN }}
115119

116120
- name: Ensure builds run
117-
run: nix develop --command pnpm nx run-many -t build
121+
run: nix develop --command bash -c 'pnpm nx run-many -t build'
118122

119123
- name: Build docs
120-
run: nix develop --command pnpm generate-docs
124+
run: nix develop --command bash -c 'pnpm generate-docs'
121125

122126
- name: Publish api docs
123127
if: steps.changesets.outputs.published == 'true'
@@ -137,14 +141,14 @@ jobs:
137141

138142
- name: Calculate baseline bundle sizes
139143
run: |
140-
nix develop --command -- <<EOF
144+
nix develop --command bash -c '
141145
chmod +x ./scripts/bundle-sizes.sh
142146
rm -f previous_sizes.json
143147
echo "📊 Calculating fresh baseline bundle sizes for main branch"
144148
./scripts/bundle-sizes.sh
145149
echo "✅ Baseline bundle sizes calculated"
146150
cat previous_sizes.json
147-
EOF
151+
'
148152
149153
- name: Upload baseline bundle sizes
150154
uses: actions/upload-artifact@v4
@@ -181,11 +185,11 @@ jobs:
181185

182186
- name: Install Dependencies and Start CI Run
183187
run: |
184-
nix develop --command -- <<EOF
188+
nix develop --command bash -c '
185189
npm install -g npm@latest
186190
pnpm install --frozen-lockfile
187191
pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN"
188-
EOF
192+
'
189193
190194
- name: Cache Playwright browsers
191195
uses: actions/cache@v4
@@ -197,11 +201,11 @@ jobs:
197201
198202
- name: Install Browsers, Configure Pnpm, and Run Nx
199203
run: |
200-
nix develop --command -- <<EOF
204+
nix develop --command bash -c '
201205
pnpm exec playwright install
202206
pnpm config set store-dir $PNPM_CACHE_FOLDER
203207
pnpm exec nx run-many -t build test e2e-ci
204-
EOF
208+
'
205209
206210
- uses: actions/upload-artifact@v4
207211
if: ${{ !cancelled() }}
@@ -213,9 +217,9 @@ jobs:
213217

214218
- name: Version and Publish Packages
215219
run: |
216-
nix develop --command -- <<EOF
220+
nix develop --command bash -c '
217221
pnpm changeset version --snapshot ${{ inputs.prerelease }}
218222
pnpm publish -r --tag ${{ inputs.dist_tag }} --no-git-checks --access ${{ inputs.access }}
219-
EOF
223+
'
220224
env:
221225
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,5 @@ GEMINI.md
8787
# Nix and direnv
8888
.direnv/
8989
result*
90-
!.envrc
90+
!.envrc
91+

flake.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
];
2727

2828
shellHook = ''
29+
export SHELL=${pkgs.zsh}/bin/zsh
30+
export NX_SOCKET_DIR=/tmp/nx-tmp
2931
# This hook runs when you enter the shell
3032
echo "---"
3133
echo "Welcome to the Nix development environment for ping-javascript-sdk!"

0 commit comments

Comments
 (0)