Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ name: CI
jobs:
docker_smoketests:
name: Smoketests
runs-on: spacetimedb-runner
strategy:
matrix:
include:
- { runner: spacetimedb-runner, smoketest_args: --docker }
- { runner: windows-latest, smoketest_args: --no-build-cli }
runner: [spacetimedb-runner, windows-latest]
runs-on: ${{ matrix.runner }}
steps:
- name: Find Git ref
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
PR_NUMBER="${{ github.event.inputs.pr_number || null }}"
if test -n "${PR_NUMBER}"; then
Expand All @@ -34,15 +41,25 @@ jobs:
with:
ref: ${{ env.GIT_REF }}
- uses: dsherret/rust-toolchain-file@v1
- uses: actions/setup-dotnet@v3
- uses: actions/setup-dotnet@v4
with:
global-json-file: modules/global.json
- name: Start containers
- name: Build and start database (Linux)
if: runner.os == 'Linux'
run: docker compose up -d
- name: Build and start database (Windows)
if: runner.os == 'Windows'
run: |
cargo build -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
Start-Process target/debug/spacetimedb-cli.exe start
cd modules
# the sdk-manifests on windows-latest are messed up, so we need to update them
dotnet workload config --update-mode workload-set
dotnet workload update
- name: Run smoketests
run: python -m smoketests --docker
- name: Stop containers
if: always()
run: python -m smoketests ${{ matrix.smoketest_args }}
- name: Stop containers (Linux)
if: always() && runner.os == 'Linux'
run: docker compose down

test:
Expand Down
3 changes: 1 addition & 2 deletions crates/update/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ pub(crate) fn run_cli(paths: &SpacetimePaths, argv0: Option<&OsStr>, args: Vec<O
}
#[cfg(windows)]
{
use std::os::windows::process::ExitCodeExt;
let status = cmd
.status()
.with_context(|| format!("failed to run {}", cli_path.display()))?;
Ok(ExitCode::from_raw(status.code().unwrap_or(1) as u32))
Ok(ExitCode::from(status.code().unwrap_or(1) as u8))
}
}

Expand Down
3 changes: 2 additions & 1 deletion smoketests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
# miscellaneous file paths
TEST_DIR = Path(__file__).parent
STDB_DIR = TEST_DIR.parent
SPACETIME_BIN = STDB_DIR / "target/debug/spacetime"
exe_suffix = ".exe" if sys.platform == "win32" else ""
SPACETIME_BIN = STDB_DIR / ("target/debug/spacetime" + exe_suffix)
TEMPLATE_TARGET_DIR = STDB_DIR / "target/_stdbsmoketests"
STDB_CONFIG = TEST_DIR / "config.toml"

Expand Down
16 changes: 10 additions & 6 deletions smoketests/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import re
import fnmatch
import json
from . import TEST_DIR, SPACETIME_BIN, build_template_target
from . import TEST_DIR, SPACETIME_BIN, exe_suffix, build_template_target
import smoketests
import sys
import logging

def check_docker():
Expand Down Expand Up @@ -65,13 +66,16 @@ def main():
action='append', type=_convert_select_pattern,
help='Only run tests which match the given substring')
parser.add_argument("-x", dest="exclude", nargs="*", default=[])
parser.add_argument("--no-build-cli", action="store_true", help="don't cargo build the cli")
args = parser.parse_args()

logging.info("Compiling spacetime cli...")
smoketests.run_cmd("cargo", "build", "-pspacetimedb-cli", "-pspacetimedb-update", cwd=TEST_DIR.parent, capture_stderr=False)
if not args.no_build_cli:
logging.info("Compiling spacetime cli...")
smoketests.run_cmd("cargo", "build", "-pspacetimedb-cli", "-pspacetimedb-update", cwd=TEST_DIR.parent, capture_stderr=False)

update_bin_name = "spacetimedb-update" + exe_suffix
try:
bin_is_symlink = SPACETIME_BIN.readlink() == "spacetimedb-update"
bin_is_symlink = SPACETIME_BIN.readlink() == update_bin_name
except OSError:
bin_is_symlink = False
if not bin_is_symlink:
Expand All @@ -80,10 +84,10 @@ def main():
except FileNotFoundError:
pass
try:
os.symlink("spacetimedb-update", SPACETIME_BIN)
os.symlink(update_bin_name, SPACETIME_BIN)
except OSError:
import shutil
shutil.copyfile(SPACETIME_BIN.with_name("spacetimedb-update"), SPACETIME_BIN)
shutil.copyfile(SPACETIME_BIN.with_name(update_bin_name), SPACETIME_BIN)

os.environ["SPACETIME_SKIP_CLIPPY"] = "1"

Expand Down
2 changes: 1 addition & 1 deletion smoketests/tests/csharp_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_build_csharp_module(self):
try:

run_cmd("dotnet", "nuget", "locals", "all", "--clear", cwd=bindings, capture_stderr=True)
run_cmd("dotnet", "workload", "install", "wasi-experimental", "--skip-manifest-update")
run_cmd("dotnet", "workload", "install", "wasi-experimental", "--skip-manifest-update", cwd=STDB_DIR / "modules")
run_cmd("dotnet", "pack", cwd=bindings, capture_stderr=True)

with tempfile.TemporaryDirectory() as tmpdir:
Expand Down
Loading