Skip to content

Commit

Permalink
Stop the server after test
Browse files Browse the repository at this point in the history
  • Loading branch information
Wentao-Kuang committed May 5, 2024
1 parent bda7026 commit 5fd2c3a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ jobs:
env:
DOCKER_AWS_ENV: -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_REGION -e AWS_DEFAULT_REGION
CONFIG_PATH: ${{ needs.build.outputs.config_path }}
BASEMAPS_HOST: http://localhost:5001
BASEMAPS_HOST: http://localhost:5000
steps:
- uses: actions/checkout@v4

Expand All @@ -207,14 +207,17 @@ jobs:

- name: (Smoke) Start Local Server
run: |
./scripts/bmc.sh ./index.cjs serve --config ${CONFIG_PATH} --port 5001 &
./scripts/bmc.sh ./index.cjs serve --config ${CONFIG_PATH} &
# Wait for the server to start
timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:5001/v1/version)" != "200" ]]; do sleep 0.5; done' || false
timeout 30 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:5000/v1/version)" != "200" ]]; do sleep 0.5; done' || false
- name: (Smoke) Run Smoke test
run: ./scripts/bmc.sh --test ./node_modules/@basemaps/smoke/build/

- name: (Smoke) Stop Server
run: docker stop bmc

screenshot:
permissions:
id-token: write
Expand Down Expand Up @@ -253,6 +256,9 @@ jobs:
save-only: true
snapshot-path: .artifacts/visual-snapshots

- name: (Screenshot) Stop Server
run: docker stop bmc

visual-diff:
permissions:
id-token: write
Expand Down
1 change: 1 addition & 0 deletions scripts/bmc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Run the basemaps/cli as a docker container with all the extra environment vars and args passed in
docker run \
--entrypoint node \
--name bmc \
-v ${PWD}:${PWD} \
-p 5000:5000 \
-e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -e AWS_REGION -e AWS_DEFAULT_REGION -e BASEMAPS_HOST \
Expand Down

0 comments on commit 5fd2c3a

Please sign in to comment.