-
Notifications
You must be signed in to change notification settings - Fork 7
43 lines (42 loc) · 1.61 KB
/
cf-worker-example-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Run CF Worker Example App
on:
pull_request:
branches: [main]
jobs:
build:
runs-on:
labels: ubuntu-latest-4-core
timeout-minutes: 15
strategy:
matrix:
node-version: [22.12]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Run Yarn
run: yarn --immutable
- name: Setup .dev.vars file
run: echo "DEVCYCLE_SERVER_SDK_KEY=dvc_server_token_hash" > dev-apps/js-cloud-server/cloudflare-worker/.dev.vars
- name: Run example app in background
run: |
yarn nx serve example-js-cloud-server-sdk-cf-worker &
echo "SERVER_PID=$!" >> $GITHUB_ENV
continue-on-error: true
- name: Wait for the server to be up
run: sleep 10
- name: Test server with curl
run: |
RESPONSE=$(curl -s http://localhost:8787) # Replace with your server's port
# Check the response or do something based on the result.
if [[ "$RESPONSE" != *"DevCycle Variables:"* ]]; then
echo "Server didn't return the expected 'DevCycle Variables:' response"
exit 1
fi
- name: Cleanup server
run: kill ${{ env.SERVER_PID }}