Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ jobs:
run: |
if [ -z "$NX_CLOUD_ACCESS_TOKEN" ]; then
echo "NX Cloud token missing — using local nx execution"
echo "NX_CLOUD_DISTRIBUTED_EXECUTION=false" >> $GITHUB_ENV
echo "NX_NO_CLOUD=true" >> $GITHUB_ENV
echo "NX_CLOUD_STARTED=false" >> $GITHUB_ENV
exit 0
fi

Expand All @@ -67,10 +68,21 @@ jobs:
nx_cloud_started=false

until [ "$retries" -ge "$max_retries" ]; do
if npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js"; then
output=$(npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" 2>&1)
exit_code=$?

if echo "$output" | grep -q "401\|sufficient access\|unauthorized\|Unauthorized"; then
echo "NX Cloud auth failed (401) — falling back to local nx immediately"
echo "NX_NO_CLOUD=true" >> $GITHUB_ENV
echo "NX_CLOUD_STARTED=false" >> $GITHUB_ENV
exit 0
fi

if [ "$exit_code" -eq 0 ]; then
nx_cloud_started=true
break
fi

echo "nx-cloud start failed (attempt $((retries + 1))/${max_retries}). Retrying in $((2 ** retries))s..."
sleep $((2 ** retries))
retries=$((retries + 1))
Expand All @@ -81,7 +93,7 @@ jobs:
echo "NX_CLOUD_STARTED=true" >> $GITHUB_ENV
else
echo "nx-cloud start failed after ${max_retries} attempts — falling back to local nx"
echo "NX_CLOUD_DISTRIBUTED_EXECUTION=false" >> $GITHUB_ENV
echo "NX_NO_CLOUD=true" >> $GITHUB_ENV
echo "NX_CLOUD_STARTED=false" >> $GITHUB_ENV
fi

Expand All @@ -91,9 +103,6 @@ jobs:
- name: Build packages
run: npx nx affected -t build:ci

- name: Run unit tests (test:ci)
run: pnpm --filter @tsparticles/tests run test:ci

- name: Deploy to Firebase (production)
if: env.firebaseToken != '' && github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: FirebaseExtended/action-hosting-deploy@v0
Expand Down
Loading