Skip to content

Commit

Permalink
Merge pull request #81 from adamreese/spin-build-site
Browse files Browse the repository at this point in the history
Use Spin for building components
  • Loading branch information
adamreese authored Aug 25, 2023
2 parents 9f3919f + 32a2f06 commit 30883a5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build:

.PHONY: serve
serve:
./serve.sh
spin up --sqlite @highscore/migration.sql

.PHONY: test-server
test-server:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $ brew install kateinoigakukun/wasi-vfs/wasi-vfs
This will by default build all microservices per the `Makefile` in their directories:

```console
make build
spin build
```

You may also build a particular microservice by navigating into its directory
Expand All @@ -39,7 +39,7 @@ make build-session
The following command will serve the Finicky Whiskers site locally:

```console
make serve
spin up --sqlite @highscore/migration.sql
```

This will run the game at [http://127.0.0.1:3000](http://127.0.0.1:3000)
Expand Down
16 changes: 0 additions & 16 deletions serve.sh

This file was deleted.

3 changes: 2 additions & 1 deletion site/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.PHONY: build
build:
npm run build
[[ -d node_modules ]] || npm install
npm run build
5 changes: 3 additions & 2 deletions spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ files = [{ source = "site/dist", destination = "/" }]
route = "/..."
[component.build]
workdir = "site"
command = "npm run build"
command = "make"

# Redirect / to /index.html
[[component]]
Expand Down Expand Up @@ -87,4 +87,5 @@ route = "/reset"
[component.build]
workdir = "reset"
command = "make"
watch = ["src/**/*.rs", "Cargo.toml"]
watch = ["src/**/*.rs", "Cargo.toml"]

4 changes: 2 additions & 2 deletions tests/test-server.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
set -beuo pipefail

./serve.sh &
spin up --sqlite @highscore/migration.sql &

timeout ${TIMEOUT:-10s} bash -c 'until curl -q 127.0.0.1:3000/index.html &>/dev/null; do sleep 1; done'

trap 'kill -s SIGTERM $(jobs -p)' EXIT

./tally_test.sh && \
echo "Tally test success!" || \
echo "Tally test failed."
echo "Tally test failed."

0 comments on commit 30883a5

Please sign in to comment.