Skip to content

Commit 98f18c2

Browse files
committed
Run servers and tests in one CI step
Each run: step is a separate shell, so a server backgrounded in one step is gone by the time a later step runs. The password-secret step also used backslash-escaped quotes inside a YAML string, which produced invalid shell.
1 parent e6382e7 commit 98f18c2

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,28 @@ jobs:
1010
PUBLICATION_URL: http://localhost:8080
1111
INDIEKIT_URL: http://localhost:3000
1212
steps:
13-
- uses: actions/checkout@v4
14-
- uses: actions/setup-node@v4
13+
- uses: actions/checkout@v5
14+
- uses: actions/setup-node@v5
1515
with:
1616
node-version: "24"
1717
- run: npm install
18-
- name: Generate a password secret
19-
run: echo "PASSWORD_SECRET=$(node -e \"require('bcrypt').hash('ci',10).then(h=>console.log(h))\")" >> "$GITHUB_ENV"
20-
- name: Start Indiekit
21-
run: npx indiekit serve --port 3000 &
22-
- name: Start static server
18+
19+
# Servers and tests share one step: each `run:` is a separate shell, so a
20+
# server backgrounded in an earlier step is gone by the time tests run.
21+
- name: Publish, build and verify
2322
run: |
23+
export PASSWORD_SECRET="$(node -e "require('bcrypt').hash('ci',10).then(h=>console.log(h))")"
24+
25+
npx indiekit serve --port 3000 &
2426
npm run build
2527
npx http-server _site -p 8080 -s &
26-
- name: Wait for both
27-
run: |
28-
for i in $(seq 1 30); do curl -sf -o /dev/null http://localhost:3000/ && break; sleep 1; done
29-
for i in $(seq 1 30); do curl -sf -o /dev/null http://localhost:8080/ && break; sleep 1; done
30-
- run: npm run smoke
31-
- run: npm run test:types
28+
29+
for _ in $(seq 1 30); do
30+
curl -sf -o /dev/null "$INDIEKIT_URL/" && break; sleep 1
31+
done
32+
for _ in $(seq 1 30); do
33+
curl -sf -o /dev/null "$PUBLICATION_URL/" && break; sleep 1
34+
done
35+
36+
npm run smoke
37+
npm run test:types

0 commit comments

Comments
 (0)