Skip to content

Commit 0f41a57

Browse files
committed
chore: fix-ci
1 parent 3f28087 commit 0f41a57

File tree

5 files changed

+46
-32
lines changed

5 files changed

+46
-32
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: 14 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,12 +88,15 @@ 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'
9295

9396
- run: pnpm pkg-pr-new publish './packages/*' './packages/sdk-effects/*' --packageManager=pnpm
9497

9598
- name: build docs
96-
run: nix develop --command pnpm generate-docs
99+
run: nix develop --command bash -c 'pnpm generate-docs'
97100

98101
- name: preview-docs
99102
uses: rajyan/preview-pages@v1
@@ -119,7 +122,7 @@ jobs:
119122
- name: Calculate bundle sizes
120123
id: bundle-analysis
121124
run: |
122-
nix develop --command -- <<EOF
125+
nix develop --command bash -c '
123126
# Make script executable
124127
chmod +x ./scripts/bundle-sizes.sh
125128
# Check if baseline exists
@@ -132,7 +135,7 @@ jobs:
132135
fi
133136
# Run the bundle size calculation
134137
./scripts/bundle-sizes.sh
135-
EOF
138+
'
136139
137140
- name: Upload current stats as artifact
138141
uses: actions/upload-artifact@v4

.github/workflows/publish.yml

Lines changed: 21 additions & 20 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'
@@ -99,9 +99,6 @@ jobs:
9999
HOME: ${{ github.workspace }}
100100
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
101101

102-
- run: pnpm pkg-pr-new publish './packages/*' './packages/sdk-effects/*' --packageManager=pnpm --comment=off
103-
if: steps.changesets.outputs.published == 'false'
104-
105102
- name: Send GitHub Action data to a Slack workflow
106103
if: steps.changesets.outputs.published == 'true'
107104
uses: slackapi/[email protected]
@@ -111,16 +108,20 @@ jobs:
111108
webhook-type: webhook-trigger
112109
payload: steps.changesets.outputs.publishedPackages
113110

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+
114115
- uses: codecov/codecov-action@v5
115116
with:
116117
files: ./packages/**/coverage/*.xml
117118
token: ${{ secrets.CODECOV_TOKEN }}
118119

119120
- name: Ensure builds run
120-
run: nix develop --command pnpm nx run-many -t build
121+
run: nix develop --command bash -c 'pnpm nx run-many -t build'
121122

122123
- name: Build docs
123-
run: nix develop --command pnpm generate-docs
124+
run: nix develop --command bash -c 'pnpm generate-docs'
124125

125126
- name: Publish api docs
126127
if: steps.changesets.outputs.published == 'true'
@@ -140,14 +141,14 @@ jobs:
140141

141142
- name: Calculate baseline bundle sizes
142143
run: |
143-
nix develop --command -- <<EOF
144+
nix develop --command bash -c '
144145
chmod +x ./scripts/bundle-sizes.sh
145146
rm -f previous_sizes.json
146147
echo "📊 Calculating fresh baseline bundle sizes for main branch"
147148
./scripts/bundle-sizes.sh
148149
echo "✅ Baseline bundle sizes calculated"
149150
cat previous_sizes.json
150-
EOF
151+
'
151152
152153
- name: Upload baseline bundle sizes
153154
uses: actions/upload-artifact@v4
@@ -184,11 +185,11 @@ jobs:
184185

185186
- name: Install Dependencies and Start CI Run
186187
run: |
187-
nix develop --command -- <<EOF
188+
nix develop --command bash -c '
188189
npm install -g npm@latest
189190
pnpm install --frozen-lockfile
190191
pnpm dlx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yml" --stop-agents-after="e2e-ci" --with-env-vars="CODECOV_TOKEN"
191-
EOF
192+
'
192193
193194
- name: Cache Playwright browsers
194195
uses: actions/cache@v4
@@ -200,11 +201,11 @@ jobs:
200201
201202
- name: Install Browsers, Configure Pnpm, and Run Nx
202203
run: |
203-
nix develop --command -- <<EOF
204+
nix develop --command bash -c '
204205
pnpm exec playwright install
205206
pnpm config set store-dir $PNPM_CACHE_FOLDER
206207
pnpm exec nx run-many -t build test e2e-ci
207-
EOF
208+
'
208209
209210
- uses: actions/upload-artifact@v4
210211
if: ${{ !cancelled() }}
@@ -216,9 +217,9 @@ jobs:
216217

217218
- name: Version and Publish Packages
218219
run: |
219-
nix develop --command -- <<EOF
220+
nix develop --command bash -c '
220221
pnpm changeset version --snapshot ${{ inputs.prerelease }}
221222
pnpm publish -r --tag ${{ inputs.dist_tag }} --no-git-checks --access ${{ inputs.access }}
222-
EOF
223+
'
223224
env:
224225
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)