Skip to content

Commit 4ff8d4e

Browse files
committed
Test quickstart-chat in CI
1 parent 6ea0c6f commit 4ff8d4e

File tree

1 file changed

+65
-67
lines changed

1 file changed

+65
-67
lines changed

.github/workflows/test.yml

Lines changed: 65 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -70,71 +70,69 @@ jobs:
7070
# echo "branch=$branch" >> $GITHUB_OUTPUT
7171
# echo "Using SpacetimeDB branch from file: $branch"
7272

73-
# - name: Checkout SpacetimeDB
74-
# uses: actions/checkout@v4
75-
# with:
76-
# repository: clockworklabs/SpacetimeDB
77-
# ref: ${{ steps.extract-branch.outputs.branch }}
78-
# path: SpacetimeDB
79-
80-
# - name: Install Rust toolchain
81-
# uses: dtolnay/rust-toolchain@stable
82-
83-
# - name: Cache Rust dependencies
84-
# uses: Swatinem/rust-cache@v2
85-
# with:
86-
# workspaces: SpacetimeDB/modules/quickstart-chat
87-
# shared-key: quickstart-chat-test
88-
89-
# - name: Install SpacetimeDB CLI from the local checkout
90-
# run: |
91-
# cargo install --force --path SpacetimeDB/crates/cli --locked --message-format=short
92-
# cargo install --force --path SpacetimeDB/crates/standalone --locked --message-format=short
93-
# # Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules).
94-
# rm $HOME/.cargo/bin/spacetime || echo "haven't run on this host before"
95-
# ln -s $HOME/.cargo/bin/spacetimedb-cli $HOME/.cargo/bin/spacetime
96-
# # Clear any existing information
97-
# spacetime server clear -y
98-
# env:
99-
# # Share the target directory with our local project to avoid rebuilding same SpacetimeDB crates twice.
100-
# CARGO_TARGET_DIR: SpacetimeDB/modules/quickstart-chat/target
101-
102-
# - name: Generate client bindings
103-
# working-directory: SpacetimeDB/modules/quickstart-chat
104-
# run: |
105-
# spacetime generate --lang typescript --out-dir ../../../examples/quickstart-chat/src/module_bindings
106-
# pnpm lint --write
73+
- name: Checkout SpacetimeDB
74+
uses: actions/checkout@v4
75+
with:
76+
repository: clockworklabs/SpacetimeDB
77+
# ref: ${{ steps.extract-branch.outputs.branch }}
78+
path: SpacetimeDB
10779

108-
# - name: Check for changes
109-
# run: |
110-
# git diff --exit-code examples/quickstart-chat/src/module_bindings || {
111-
# echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch."
112-
# exit 1
113-
# - name: Start SpacetimeDB
114-
# run: |
115-
# spacetime start &
116-
# disown
117-
#
118-
# - name: Publish module to SpacetimeDB
119-
# working-directory: SpacetimeDB/modules/quickstart-chat
120-
# run: |
121-
# spacetime logout && spacetime login --server-issued-login local
122-
# spacetime publish -s local quickstart-chat -c -y
123-
#
124-
# - name: Check if SpacetimeDB process is running
125-
# run: |
126-
# echo "Currently running spacetime processes:"
127-
# pgrep -laf spacetime || echo "No spacetime process found."
128-
#
129-
# - name: Publish module to SpacetimeDB
130-
# working-directory: SpacetimeDB/modules/quickstart-chat
131-
# run: |
132-
# spacetime logs quickstart-chat
133-
#
134-
# - name: Run all tests recursively
135-
# run: pnpm test
136-
#
137-
# # Run this step always, even if the previous steps fail
138-
# - name: Print rows in the user table
139-
# if: always()
140-
# run: spacetime sql quickstart-chat "SELECT * FROM user"
80+
- name: Install Rust toolchain
81+
uses: dtolnay/rust-toolchain@stable
82+
83+
- name: Cache Rust dependencies
84+
uses: Swatinem/rust-cache@v2
85+
with:
86+
workspaces: SpacetimeDB/modules/quickstart-chat
87+
shared-key: quickstart-chat-test
88+
89+
- name: Install SpacetimeDB CLI from the local checkout
90+
run: |
91+
cargo install --force --path SpacetimeDB/crates/cli --locked --message-format=short
92+
cargo install --force --path SpacetimeDB/crates/standalone --locked --message-format=short
93+
# Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules).
94+
rm -f $HOME/.cargo/bin/spacetime
95+
ln -s $HOME/.cargo/bin/spacetimedb-cli $HOME/.cargo/bin/spacetime
96+
# Clear any existing information
97+
spacetime server clear -y
98+
env:
99+
# Share the target directory with our local project to avoid rebuilding same SpacetimeDB crates twice.
100+
CARGO_TARGET_DIR: SpacetimeDB/modules/quickstart-chat/target
101+
102+
- name: Generate client bindings
103+
working-directory: SpacetimeDB/modules/quickstart-chat
104+
run: |
105+
spacetime generate --lang typescript --out-dir ../../../examples/quickstart-chat/src/module_bindings
106+
pnpm lint --write
107+
108+
- name: Check for changes
109+
run: |
110+
if ! git diff --exit-code examples/quickstart-chat/src/module_bindings; then
111+
echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch."
112+
exit 1
113+
fi
114+
115+
- name: Start SpacetimeDB
116+
run: |
117+
spacetime start &
118+
disown
119+
120+
- name: Publish module to SpacetimeDB
121+
working-directory: SpacetimeDB/modules/quickstart-chat
122+
run: |
123+
spacetime logout && spacetime login --server-issued-login local
124+
spacetime publish -s local quickstart-chat -c -y
125+
126+
# - name: Publish module to SpacetimeDB
127+
# working-directory: SpacetimeDB/modules/quickstart-chat
128+
# run: |
129+
# spacetime logs quickstart-chat
130+
131+
- name: Run quickstart-chat tests
132+
working-directory: examples/quickstart-chat
133+
run: pnpm test
134+
135+
# Run this step always, even if the previous steps fail
136+
- name: Print rows in the user table
137+
if: always()
138+
run: spacetime sql quickstart-chat "SELECT * FROM user"

0 commit comments

Comments
 (0)