Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
08c656c
Working on improving commands that use identities
jdetter Jun 21, 2023
383c2b6
Fix lints
jdetter Jun 21, 2023
1a8ce04
Reverted file that shouldn't have changed
jdetter Jun 21, 2023
af82aee
Found and fixed all other todos
jdetter Jun 21, 2023
a4cbe56
Addressed more CLI TODOs
jdetter Jun 21, 2023
fcd9256
Fixes for formatting issues
jdetter Jun 22, 2023
7650702
Set names of identities
jdetter Jun 22, 2023
8b47fa2
Set name of identities + clippy
jdetter Jun 22, 2023
50393c4
Small fix
jdetter Jun 22, 2023
4074390
Added the start of a doc comment, switching over to another PR
jdetter Jun 22, 2023
48b72d3
Fixed tests that needed to be updated
jdetter Jun 22, 2023
39db37c
Addressed more feedback and fixed several clippy issues
jdetter Jun 23, 2023
2044a74
Small fix
jdetter Jun 23, 2023
c03a510
Apply suggestions from code review
jdetter Jun 23, 2023
f42d031
Added more doc comments
jdetter Jun 23, 2023
cdcc561
Addressing more feedback
jdetter Jun 23, 2023
fe0cce3
Fixed really old bug in SpacetimeDB
jdetter Jun 23, 2023
3bbb510
Tests to verify new functionality
jdetter Jun 23, 2023
be28a8f
Fix clippy lints
jdetter Jun 23, 2023
8cbe512
Email during identity creation is optional
jdetter Jun 23, 2023
96f2302
Some work
jdetter Jun 23, 2023
b39e415
Getting smoketests working on mac
jdetter Jun 23, 2023
eb3703f
All tests are passing except known failing tests
jdetter Jun 23, 2023
dc0a103
Working on parallel smoketests
jdetter Jun 23, 2023
50cc737
Fixed some bugs in saving configs that was preventing this from working
jdetter Jun 23, 2023
125cb9d
Fixes required for parallel tests
jdetter Jun 23, 2023
d285820
Merge remote-tracking branch 'origin/master' into jdetter/parallel-sm…
jdetter Jul 1, 2023
2ac9871
Tests are working in parallel
jdetter Jul 1, 2023
17e2136
Pruned changes
jdetter Jul 1, 2023
bb8cf44
retab
jdetter Jul 1, 2023
47b83e1
re-retab
jdetter Jul 1, 2023
813f7d7
retab the lib file
jdetter Jul 1, 2023
194c9dd
Cargo profile for building more quickly
jdetter Jul 1, 2023
c703827
I have to rebase on another PR
jdetter Jul 1, 2023
2e32be1
Merge branch 'jdetter/faster-cargo-build-for-cli' into jdetter/parall…
jdetter Jul 1, 2023
4b900f3
smoketest fixes
jdetter Jul 1, 2023
b39b9b8
create_project and reset_project are now the same thing, removed
jdetter Jul 1, 2023
d15321c
More fixes
jdetter Jul 1, 2023
20f74e0
Removed print statement
jdetter Jul 1, 2023
dc27348
Small fix
jdetter Jul 3, 2023
459ca3c
Another fix
jdetter Jul 3, 2023
c99a5b4
Merge branch 'master' into jdetter/parallel-smoketests
jdetter Jul 3, 2023
b48f6fe
Tons of improvements to the smoketests
jdetter Jul 6, 2023
a849571
Have to rebase on master
jdetter Jul 6, 2023
d69583b
Merge remote-tracking branch 'origin/master' into jdetter/parallel-sm…
jdetter Jul 6, 2023
6f6ee6b
Small fixes
jdetter Jul 6, 2023
ad648ac
More progress
jdetter Jul 6, 2023
c2b61e0
Finally working correctly!
jdetter Jul 6, 2023
d4ad17a
Apparently we're missing this
jdetter Jul 6, 2023
16eda38
Enable command output
jdetter Jul 6, 2023
970e1cf
Listing installed targets
jdetter Jul 6, 2023
31d9159
Clean before building
jdetter Jul 6, 2023
8bc59eb
What is going on
jdetter Jul 6, 2023
b1b296a
Something super wonky going on
jdetter Jul 6, 2023
516c489
Another test
jdetter Jul 7, 2023
83bc2ab
Skip building containers for now
jdetter Jul 7, 2023
a093b67
Small fix
jdetter Jul 7, 2023
ce2551f
Test using cargo instead
jdetter Jul 7, 2023
3268450
Changed workflow a bit
jdetter Jul 7, 2023
1029217
CI is stuck
jdetter Jul 7, 2023
295d1dd
Small fix
jdetter Jul 7, 2023
a7d4163
Another fix
jdetter Jul 7, 2023
049b38c
Try cargo run instead of building spacetime CLI
jdetter Jul 7, 2023
c201e2d
Removed workflow step
jdetter Jul 7, 2023
54bb058
Fixing all of the tests
jdetter Jul 7, 2023
ccf434b
Identity test
jdetter Jul 7, 2023
2cff55d
Tests should finally be working
jdetter Jul 7, 2023
fef89f0
Enable debug
jdetter Jul 7, 2023
c13ed80
Remove spacetime from path
jdetter Jul 7, 2023
21d31cf
Another try
jdetter Jul 7, 2023
0237fb4
Logic fix
jdetter Jul 7, 2023
4b143a7
Another fix
jdetter Jul 7, 2023
e061fca
Another fix
jdetter Jul 7, 2023
9f1f4e7
Working now?
jdetter Jul 7, 2023
06dde9a
Another fix
jdetter Jul 7, 2023
d6c0355
Finally working again
jdetter Jul 10, 2023
d25e987
Adding github containers back in
jdetter Jul 10, 2023
8d5b3ef
Merge remote-tracking branch 'origin/master' into jdetter/parallel-sm…
jdetter Jul 10, 2023
aaa725e
CI fix
jdetter Jul 10, 2023
045c547
Use SpacetimeDB Large Runner
jdetter Jul 13, 2023
ce4c50e
Merge remote-tracking branch 'origin/jdetter/use-github-large-runner'…
jdetter Jul 13, 2023
43e24de
Updated test to get more output
jdetter Jul 13, 2023
c0a6e7a
Changed 0ms to 10ms to improve parallel test stability
jdetter Jul 13, 2023
2acb001
Removed unused logs
jdetter Jul 13, 2023
bcbfa89
Removed unnecessary reset_project
jdetter Jul 13, 2023
ff35be6
Removed reset_config where its not needed
jdetter Jul 13, 2023
54d36fd
Reset template
jdetter Jul 13, 2023
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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ name: CI
jobs:
docker_smoketests:
name: Smoketests
runs-on: ubuntu-latest
runs-on: spacetimedb-runner
steps:
- uses: actions/checkout@v3

- name: Checkout sources
uses: actions/checkout@v3
- name: Start containers
run: docker compose up -d
- name: Run smoketests
run: test/run-smoke-tests.sh -x bitcraftmini-pretest
run: test/run-smoke-tests.sh --parallel -x bitcraftmini-pretest
- name: Stop containers
if: always()
run: docker compose down

test:
name: Test Suite
runs-on: ubuntu-latest
runs-on: spacetimedb-runner
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand All @@ -40,7 +40,7 @@ jobs:

lints:
name: Lints
runs-on: ubuntu-latest
runs-on: spacetimedb-runner
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand All @@ -56,7 +56,7 @@ jobs:

wasm_bindings:
name: Build and test wasm bindings
runs-on: ubuntu-latest
runs-on: spacetimedb-runner
steps:
- uses: actions/checkout@v3

Expand Down
31 changes: 19 additions & 12 deletions crates/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ impl Config {
config_filename
}

fn load_raw(config_dir: PathBuf) -> RawConfig {
if let Some(config_path) = std::env::var_os("SPACETIME_CONFIG_FILE") {
return Self::load_from_file(config_path.as_ref());
fn load_raw(config_dir: PathBuf, is_project: bool) -> RawConfig {
// If a config file overload has been specified, use that instead
if !is_project {
if let Some(config_path) = std::env::var_os("SPACETIME_CONFIG_FILE") {
return Self::load_from_file(config_path.as_ref());
}
}
if !config_dir.exists() {
fs::create_dir_all(&config_dir).unwrap();
Expand Down Expand Up @@ -174,7 +177,7 @@ impl Config {

pub fn load() -> Self {
let home_dir = dirs::home_dir().unwrap();
let mut home_config = Self::load_raw(home_dir.join(HOME_CONFIG_DIR));
let mut home_config = Self::load_raw(home_dir.join(HOME_CONFIG_DIR), false);

// Ensure there is always an identity config. Simplifies other code.
home_config.identity_configs.get_or_insert(vec![]);
Expand All @@ -184,7 +187,7 @@ impl Config {
// search parent directories above the current directory to find
// spacetime.toml files like a .gitignore file
let cur_dir = std::env::current_dir().expect("No current working directory!");
let cur_config = Self::load_raw(cur_dir);
let cur_config = Self::load_raw(cur_dir, true);

Self {
home: home_config,
Expand All @@ -193,15 +196,19 @@ impl Config {
}

pub fn save(&self) {
let home_dir = dirs::home_dir().unwrap();
let config_dir = home_dir.join(HOME_CONFIG_DIR);
if !config_dir.exists() {
fs::create_dir_all(&config_dir).unwrap();
}
let config_path = if let Some(config_path) = std::env::var_os("SPACETIME_CONFIG_FILE") {
PathBuf::from(&config_path)
} else {
let home_dir = dirs::home_dir().unwrap();
let config_dir = home_dir.join(HOME_CONFIG_DIR);
if !config_dir.exists() {
fs::create_dir_all(&config_dir).unwrap();
}

let config_filename = Self::find_config_filename(&config_dir).unwrap_or(CONFIG_FILENAME);
let config_filename = Self::find_config_filename(&config_dir).unwrap_or(CONFIG_FILENAME);
config_dir.join(config_filename)
};

let config_path = config_dir.join(config_filename);
let mut file = fs::OpenOptions::new()
.create(true)
.write(true)
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub struct InitDefaultResult {

pub async fn init_default(config: &mut Config, nickname: Option<String>) -> Result<InitDefaultResult, anyhow::Error> {
if config.name_exists(nickname.as_ref().unwrap_or(&"".to_string())) {
return Err(anyhow::anyhow!("An identity with that name already exists."));
return Err(anyhow::anyhow!("A default identity already exists."));
}

let client = reqwest::Client::new();
Expand Down
14 changes: 0 additions & 14 deletions docker-compose-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,5 @@ services:
core:
soft: -1
hard: -1

prometheus:
build:
context: ./packages/prometheus
ports:
- "9090:9090"
volumes:
- ./packages/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml

grafana:
build:
context: ./packages/grafana
ports:
- "3001:3000"
volumes:
key_files:
53 changes: 21 additions & 32 deletions test/lib.include
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

# Runs a test with the assumption that it will return a zero result code
run_test() {
set +e
"$@" > "$TEST_OUT" 2>&1
Expand All @@ -9,6 +10,7 @@ run_test() {
return "$RESULT"
}

# Runs a test with the assumption that it will return a non-zero result code
run_fail_test() {
if "$@" > "$TEST_OUT" 2>&1 ; then
cat "$TEST_OUT"
Expand All @@ -18,39 +20,19 @@ run_fail_test() {
return 0
}

# This resets the spacetime config for a new test run
reset_config() {
RETURN_DIR=$PWD
cd "$SPACETIME_HOME" || exit 1
cp "./test/config.toml" "$HOME/.spacetime/config.toml"
cd "$RETURN_DIR" || exit 1
SPACETIME_CONFIG_FILE="$(mktemp)"
export SPACETIME_CONFIG_FILE
cp "$RESET_SPACETIME_CONFIG" "$SPACETIME_CONFIG_FILE"
}

# This deletes the project from the previous test run
reset_project() {
RETURN_DIR=$PWD
if [ -d "$PROJECT_PATH" ] ; then
rm -rf "$PROJECT_PATH"
fi

cd "$RETURN_DIR" || exit 1
}

# This creates a new spacetime project that is completely dependent on the local repository.
create_project() {
reset_project
run_test cargo run init --lang=rust "$PROJECT_PATH"
# We have to force using the local spacetimedb_bindings otherwise we will download them from crates.io
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s@.*spacetimedb.*=.*@spacetimedb = { path = \"${SPACETIME_DIR}/crates/bindings\" }@g" "${PROJECT_PATH}/Cargo.toml"
elif [[ "$OSTYPE" == "msys"* ]]; then
# Running in git bash; do horrible path conversion; yes we do need all of those
WINPATH="$(cygpath -w "${SPACETIME_DIR}/crates/bindings" | sed 's/\\/\\\\\\\\/g')"
sed -i "s@.*spacetimedb.*=.*@spacetimedb = { path = \"${WINPATH}\" }@g" "${PROJECT_PATH}/Cargo.toml"
else
sed -i "s@.*spacetimedb.*=.*@spacetimedb = { path = \"${SPACETIME_DIR}/crates/bindings\" }@g" "${PROJECT_PATH}/Cargo.toml"
fi


PROJECT_PATH="$(mktemp -d)"
rmdir "$PROJECT_PATH"
cp -rp "$RESET_PROJECT_PATH" "$PROJECT_PATH"
export PROJECT_PATH
}

random_string() {
Expand All @@ -65,7 +47,7 @@ spacetime_publish() {
RETURN_DIR=$PWD
cd "$SPACETIME_DIR"
set +e
run_test cargo run publish "$@"
run_test spacetime publish "$@"
RESULT_CODE=$?
cd "$RETURN_DIR" || exit 1
set -e
Expand All @@ -74,10 +56,17 @@ spacetime_publish() {

fsed() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i.sed_bak "$@"
rm -f rm *.sed_bak
sed -i.sed_bak "$@"
rm -f rm *.sed_bak
else
sed -i "$@"
sed -i "$@"
fi
}

restart_docker() {
docker-compose stop node
docker-compose start node
sleep 10
}

# vim: noexpandtab tabstop=4 shiftwidth=4
Loading