Skip to content

Commit

Permalink
Merge branch 'main' into ASYNC
Browse files Browse the repository at this point in the history
  • Loading branch information
lgxbslgx committed Sep 10, 2024
2 parents c348b3f + bef1052 commit 75b110c
Show file tree
Hide file tree
Showing 9 changed files with 383 additions and 111 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ jobs:
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
run: |
$version = "$env:GITHUB_SHA".Substring(0, 9)
aws s3 cp .\target\release\moon.exe "s3://${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/$(uname -s)-$(uname -m)/"
aws s3 cp .\target\release\moonrun.exe "s3://${{ secrets.AWS_BUCKET_NAME }}/bleeding-moonrun/$version/$(uname -s)-$(uname -m)/"
aws s3 cp .\target\release\moonrun.exe "s3://cli.moonbitlang.com/moon-ci/$(uname -s)-$(uname -m)/"
aws s3 cp .\target\release\moon.exe "s3://${{ secrets.AWS_BUCKET_NAME }}/bleeding-moon/$version/Windows-x86_64/"
aws s3 cp .\target\release\moonrun.exe "s3://${{ secrets.AWS_BUCKET_NAME }}/bleeding-moonrun/$version/Windows-x86_64/"
aws s3 cp .\target\release\moonrun.exe "s3://cli.moonbitlang.com/moon-ci/Windows-x86_64/"
- name: Bleeding Release (macos-latest)
if: ${{ matrix.os == 'macos-latest' }}
Expand Down
22 changes: 11 additions & 11 deletions crates/moon/tests/test_cases/cond_comp.in/moon.test
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
$ moon build --dry-run --sort-input --nostd
moonc build-package ./src/lib/all.mbt ./src/lib/not_js.mbt -o ./target/wasm-gc/release/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm-gc
moonc build-package ./src/lib/all.mbt ./src/lib/js_or_wasm.mbt ./src/lib/not_js.mbt -o ./target/wasm-gc/release/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm-gc
moonc build-package ./src/main/main.mbt -o ./target/wasm-gc/release/build/main/main.core -pkg username/hello/main -is-main -i ./target/wasm-gc/release/build/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target wasm-gc
moonc link-core ./target/wasm-gc/release/build/lib/lib.core ./target/wasm-gc/release/build/main/main.core -main username/hello/main -o ./target/wasm-gc/release/build/main/main.wasm -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target wasm-gc

$ moon build --target wasm --dry-run --sort-input --nostd
moonc build-package ./src/lib/all.mbt ./src/lib/not_js.mbt -o ./target/wasm/release/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm
moonc build-package ./src/lib/all.mbt ./src/lib/js_or_wasm.mbt ./src/lib/not_js.mbt -o ./target/wasm/release/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm
moonc build-package ./src/main/main.mbt -o ./target/wasm/release/build/main/main.core -pkg username/hello/main -is-main -i ./target/wasm/release/build/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target wasm
moonc link-core ./target/wasm/release/build/lib/lib.core ./target/wasm/release/build/main/main.core -main username/hello/main -o ./target/wasm/release/build/main/main.wasm -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target wasm

$ moon build --target wasm-gc --dry-run --sort-input --nostd
moonc build-package ./src/lib/all.mbt ./src/lib/not_js.mbt -o ./target/wasm-gc/release/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm-gc
moonc build-package ./src/lib/all.mbt ./src/lib/js_or_wasm.mbt ./src/lib/not_js.mbt -o ./target/wasm-gc/release/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm-gc
moonc build-package ./src/main/main.mbt -o ./target/wasm-gc/release/build/main/main.core -pkg username/hello/main -is-main -i ./target/wasm-gc/release/build/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target wasm-gc
moonc link-core ./target/wasm-gc/release/build/lib/lib.core ./target/wasm-gc/release/build/main/main.core -main username/hello/main -o ./target/wasm-gc/release/build/main/main.wasm -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target wasm-gc

$ moon build --dry-run --target js --sort-input --nostd
moonc build-package ./src/lib/all.mbt ./src/lib/js_and_release.mbt ./src/lib/only_js.mbt -o ./target/js/release/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target js
moonc build-package ./src/lib/all.mbt ./src/lib/js_and_release.mbt ./src/lib/js_or_wasm.mbt ./src/lib/only_js.mbt -o ./target/js/release/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target js
moonc build-package ./src/main/main.mbt -o ./target/js/release/build/main/main.core -pkg username/hello/main -is-main -i ./target/js/release/build/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target js
moonc link-core ./target/js/release/build/lib/lib.core ./target/js/release/build/main/main.core -main username/hello/main -o ./target/js/release/build/main/main.js -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target js

$ moon build --dry-run --target wasm --sort-input --nostd --debug
moonc build-package ./src/lib/all.mbt ./src/lib/not_js.mbt ./src/lib/only_debug.mbt -o ./target/wasm/debug/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm -g
moonc build-package ./src/lib/all.mbt ./src/lib/js_or_wasm.mbt ./src/lib/not_js.mbt ./src/lib/only_debug.mbt -o ./target/wasm/debug/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm -g
moonc build-package ./src/main/main.mbt -o ./target/wasm/debug/build/main/main.core -pkg username/hello/main -is-main -i ./target/wasm/debug/build/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target wasm -g
moonc link-core ./target/wasm/debug/build/lib/lib.core ./target/wasm/debug/build/main/main.core -main username/hello/main -o ./target/wasm/debug/build/main/main.wasm -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target wasm -g

$ moon build --dry-run --target wasm-gc --sort-input --nostd --debug
moonc build-package ./src/lib/all.mbt ./src/lib/not_js.mbt ./src/lib/only_debug.mbt -o ./target/wasm-gc/debug/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm-gc -g -source-map
moonc build-package ./src/lib/all.mbt ./src/lib/js_or_wasm.mbt ./src/lib/not_js.mbt ./src/lib/only_debug.mbt -o ./target/wasm-gc/debug/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target wasm-gc -g -source-map
moonc build-package ./src/main/main.mbt -o ./target/wasm-gc/debug/build/main/main.core -pkg username/hello/main -is-main -i ./target/wasm-gc/debug/build/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target wasm-gc -g -source-map
moonc link-core ./target/wasm-gc/debug/build/lib/lib.core ./target/wasm-gc/debug/build/main/main.core -main username/hello/main -o ./target/wasm-gc/debug/build/main/main.wasm -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target wasm-gc -g -source-map

$ moon build --dry-run --target js --sort-input --nostd --debug
moonc build-package ./src/lib/all.mbt ./src/lib/only_debug.mbt ./src/lib/only_js.mbt -o ./target/js/debug/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target js -g -source-map
moonc build-package ./src/lib/all.mbt ./src/lib/js_or_wasm.mbt ./src/lib/only_debug.mbt ./src/lib/only_js.mbt -o ./target/js/debug/build/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target js -g -source-map
moonc build-package ./src/main/main.mbt -o ./target/js/debug/build/main/main.core -pkg username/hello/main -is-main -i ./target/js/debug/build/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target js -g -source-map
moonc link-core ./target/js/debug/build/lib/lib.core ./target/js/debug/build/main/main.core -main username/hello/main -o ./target/js/debug/build/main/main.js -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/main:./src/main -target js -g -source-map

$ moon check --dry-run --target js --sort-input --nostd
moonc check ./src/lib/all.mbt ./src/lib/js_and_release.mbt ./src/lib/only_js.mbt -o ./target/js/release/check/lib/lib.mi -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target js
moonc check ./src/lib/all.mbt ./src/lib/js_and_release.mbt ./src/lib/js_or_wasm.mbt ./src/lib/only_js.mbt -o ./target/js/release/check/lib/lib.mi -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target js
moonc check ./src/main/main.mbt -o ./target/js/release/check/main/main.mi -pkg username/hello/main -is-main -i ./target/js/release/check/lib/lib.mi:lib -pkg-sources username/hello/main:./src/main -target js
moonc check ./src/lib/hello_test.mbt ./src/lib/js_only_test.mbt -o ./target/js/release/check/lib/lib.blackbox_test.mi -pkg username/hello/lib_blackbox_test -i ./target/js/release/check/lib/lib.mi:lib -pkg-sources username/hello/lib_blackbox_test:./src/lib -target js

$ moon test --dry-run --target js --sort-input --nostd
moon generate-test-driver --source-dir . --target-dir ./target/js/debug/test --package username/hello/lib --sort-input --target js --driver-kind blackbox
moonc build-package ./src/lib/all.mbt ./src/lib/only_debug.mbt ./src/lib/only_js.mbt -o ./target/js/debug/test/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target js -g
moonc build-package ./src/lib/all.mbt ./src/lib/js_or_wasm.mbt ./src/lib/only_debug.mbt ./src/lib/only_js.mbt -o ./target/js/debug/test/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./src/lib -target js -g
moonc build-package ./src/lib/hello_test.mbt ./src/lib/js_only_test.mbt ./target/js/debug/test/lib/__generated_driver_for_blackbox_test.mbt -o ./target/js/debug/test/lib/lib.blackbox_test.core -pkg username/hello/lib_blackbox_test -is-main -i ./target/js/debug/test/lib/lib.mi:lib -pkg-sources username/hello/lib_blackbox_test:./src/lib -target js -g
moonc link-core ./target/js/debug/test/lib/lib.core ./target/js/debug/test/lib/lib.blackbox_test.core -main username/hello/lib_blackbox_test -o ./target/js/debug/test/lib/lib.blackbox_test.js -test-mode -pkg-sources username/hello/lib:./src/lib -pkg-sources username/hello/lib_blackbox_test:./src/lib -exported_functions execute -js-format cjs -target js -g
moon generate-test-driver --source-dir . --target-dir ./target/js/debug/test --package username/hello/lib --sort-input --target js --driver-kind internal
moonc build-package ./src/lib/all.mbt ./src/lib/only_debug.mbt ./src/lib/only_js.mbt ./target/js/debug/test/lib/__generated_driver_for_internal_test.mbt -o ./target/js/debug/test/lib/lib.internal_test.core -pkg username/hello/lib -is-main -pkg-sources username/hello/lib:./src/lib -target js -g
moonc build-package ./src/lib/all.mbt ./src/lib/js_or_wasm.mbt ./src/lib/only_debug.mbt ./src/lib/only_js.mbt ./target/js/debug/test/lib/__generated_driver_for_internal_test.mbt -o ./target/js/debug/test/lib/lib.internal_test.core -pkg username/hello/lib -is-main -pkg-sources username/hello/lib:./src/lib -target js -g
moonc link-core ./target/js/debug/test/lib/lib.internal_test.core -main username/hello/lib -o ./target/js/debug/test/lib/lib.internal_test.js -test-mode -pkg-sources username/hello/lib:./src/lib -exported_functions execute -js-format cjs -target js -g

$ moon bundle --dry-run --target js --sort-input --nostd
moonc build-package ./src/lib/all.mbt ./src/lib/js_and_release.mbt ./src/lib/only_js.mbt -o ./target/js/release/bundle/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./lib -target js
moonc build-package ./src/lib/all.mbt ./src/lib/js_and_release.mbt ./src/lib/js_or_wasm.mbt ./src/lib/only_js.mbt -o ./target/js/release/bundle/lib/lib.core -pkg username/hello/lib -pkg-sources username/hello/lib:./lib -target js
moonc build-package ./src/main/main.mbt -o ./target/js/release/bundle/main/main.core -pkg username/hello/main -is-main -i ./target/js/release/bundle/lib/lib.mi:lib -pkg-sources username/hello/main:./main -target js
moonc bundle-core ./target/js/release/bundle/lib/lib.core ./target/js/release/bundle/main/main.core -o ./target/js/release/bundle/hello.core

Empty file.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"targets": {
"only_js.mbt": ["and", "js"],
"only_js.mbt": ["js"],
"not_js.mbt": ["not", "js"],
"only_debug.mbt": ["and", "debug"],
"js_and_release.mbt": ["and", ["or", "js"], ["or", "release"]],
"js_only_test.mbt": ["and", "js"]
"only_debug.mbt": ["debug"],
"js_and_release.mbt": ["and", ["js"], ["release"]],
"js_only_test.mbt": ["js"],
"js_and_wasm.mbt": ["js", "wasm"]
}
}
54 changes: 54 additions & 0 deletions crates/moon/tests/test_cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6215,3 +6215,57 @@ fn test_failed_to_fill_whole_buffer() {
"#]],
);
}

#[test]
fn test_moon_update_failed() {
if std::env::var("CI").is_err() {
return;
}
let tmp = tempfile::tempdir().unwrap();
let dir = tmp.path();
let moon_home = dir;
let out = std::process::Command::new(moon_bin())
.current_dir(dir)
.env("MOON_HOME", moon_home)
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped())
.args(["update"])
.output()
.unwrap();
let out = String::from_utf8(out.stderr).unwrap();
check(
&out,
expect![[r#"
Registry index cloned successfully
"#]],
);

let _ = std::process::Command::new("git")
.args([
"-C",
dir.join("registry").join("index").to_str().unwrap(),
"remote",
"set-url",
"origin",
"whatever",
])
.output()
.unwrap();

let out = std::process::Command::new(moon_bin())
.current_dir(dir)
.env("MOON_HOME", moon_home)
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped())
.args(["update"])
.output()
.unwrap();
let out = String::from_utf8(out.stderr).unwrap();
check(
&out,
expect![[r#"
Registry index is not cloned from the same URL, re-cloning
Registry index re-cloned successfully
"#]],
);
}
4 changes: 2 additions & 2 deletions crates/moonbuild/src/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ fn common(
) -> anyhow::Result<i32> {
std::fs::create_dir_all(target_dir).context("failed to create target directory")?;

if !is_in_git_repo(target_dir) {
git_init_repo(target_dir);
if !is_in_git_repo(target_dir)? {
git_init_repo(target_dir)?;
}

{
Expand Down
Loading

0 comments on commit 75b110c

Please sign in to comment.