diff --git a/.github/workflows/bleeding-release.yml b/.github/workflows/bleeding-release.yml index 11ae5513..a27bbab8 100644 --- a/.github/workflows/bleeding-release.yml +++ b/.github/workflows/bleeding-release.yml @@ -16,7 +16,7 @@ # # For inquiries, you can contact us via e-mail at jichuruanjian@idea.edu.cn. -name: Bleeding Release Unix +name: Bleeding Release # trigger by moonc-version-dont-delete/.github/workflows/ci.yml when moonc merged PR @@ -70,8 +70,6 @@ jobs: AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} shell: pwsh run: | - $PLATFORM = "windows-x86_64" - echo "PLATFORM=$PLATFORM" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Remove-Item -Recurse -Force tmp-bins -ErrorAction SilentlyContinue New-Item -ItemType Directory -Force -Path tmp-bins Invoke-WebRequest -Uri "https://cli.moonbitlang.com/moon-ci/Windows-x86_64.zip" -OutFile moonbit.zip @@ -80,9 +78,9 @@ jobs: Copy-Item .\target\release\moon.exe .\tmp-bins Get-ChildItem .\tmp-bins Push-Location tmp-bins - Get-FileHash -Algorithm SHA256 * | ForEach-Object { $_.Hash + " " + $_.Path.Split("\")[-1] } | Out-File -FilePath ..\moonbit-$env:PLATFORM.sha256 -Encoding utf8 + Get-FileHash -Algorithm SHA256 * | ForEach-Object { $_.Hash + " " + $_.Path.Split("\")[-1] } | Out-File -FilePath ..\moonbit-windows-x86_64.sha256 -Encoding utf8 Pop-Location - Compress-Archive -Path .\tmp-bins\* -DestinationPath .\moonbit-$env:PLATFORM.zip - aws s3 cp .\moonbit-$env:PLATFORM.zip s3://cli.moonbitlang.com/binaries/bleeding/moonbit-$env:PLATFORM.zip - aws s3 cp .\moonbit-$env:PLATFORM.sha256 s3://cli.moonbitlang.com/binaries/bleeding/moonbit-$env:PLATFORM.sha256 + Compress-Archive -Path .\tmp-bins\* -DestinationPath .\moonbit-windows-x86_64.zip + aws s3 cp .\moonbit-windows-x86_64.zip s3://cli.moonbitlang.com/binaries/bleeding/moonbit-windows-x86_64.zip + aws s3 cp .\moonbit-windows-x86_64.sha256 s3://cli.moonbitlang.com/binaries/bleeding/moonbit-windows-x86_64.sha256 aws cloudfront create-invalidation --distribution-id E1KQYZEVEB0TAY --paths "/*" \ No newline at end of file diff --git a/crates/moon/src/cli.rs b/crates/moon/src/cli.rs index 90373326..2cf916b1 100644 --- a/crates/moon/src/cli.rs +++ b/crates/moon/src/cli.rs @@ -220,7 +220,7 @@ pub fn get_compiler_flags( // use "cc" to compile extra_link_opt.extend_from_slice(&[ "-cc".to_string(), - format!("cc {} -O2 -fwrapv", libmoonbitrun_path.display()), + format!("cc {} -O2 -fwrapv -lm", libmoonbitrun_path.display()), ]); } } diff --git a/crates/moon/tests/test_cases/mod.rs b/crates/moon/tests/test_cases/mod.rs index 3b6daa71..3304f0d9 100644 --- a/crates/moon/tests/test_cases/mod.rs +++ b/crates/moon/tests/test_cases/mod.rs @@ -7072,7 +7072,7 @@ fn test_use_cc_for_native_release() { expect![[r#" moonc build-package ./lib/hello.mbt -o ./target/native/release/build/lib/lib.core -pkg moonbitlang/hello/lib -std-path $MOON_HOME/lib/core/target/native/release/bundle -pkg-sources moonbitlang/hello/lib:./lib -target native moonc build-package ./main/main.mbt -o ./target/native/release/build/main/main.core -pkg moonbitlang/hello/main -is-main -std-path $MOON_HOME/lib/core/target/native/release/bundle -i ./target/native/release/build/lib/lib.mi:lib -pkg-sources moonbitlang/hello/main:./main -target native - moonc link-core $MOON_HOME/lib/core/target/native/release/bundle/core.core ./target/native/release/build/lib/lib.core ./target/native/release/build/main/main.core -main moonbitlang/hello/main -o ./target/native/release/build/main/main.exe -pkg-sources moonbitlang/hello/lib:./lib -pkg-sources moonbitlang/hello/main:./main -pkg-sources moonbitlang/core:$MOON_HOME/lib/core -target native -cc "cc $MOON_HOME/bin/libmoonbitrun.o -O2 -fwrapv" + moonc link-core $MOON_HOME/lib/core/target/native/release/bundle/core.core ./target/native/release/build/lib/lib.core ./target/native/release/build/main/main.core -main moonbitlang/hello/main -o ./target/native/release/build/main/main.exe -pkg-sources moonbitlang/hello/lib:./lib -pkg-sources moonbitlang/hello/main:./main -pkg-sources moonbitlang/core:$MOON_HOME/lib/core -target native -cc "cc $MOON_HOME/bin/libmoonbitrun.o -O2 -fwrapv -lm" "#]], ); // if --release is not specified, it should not use cc @@ -7125,7 +7125,7 @@ fn test_use_cc_for_native_release() { expect![[r#" moonc build-package ./lib/hello.mbt -o ./target/native/release/build/lib/lib.core -pkg moonbitlang/hello/lib -std-path $MOON_HOME/lib/core/target/native/release/bundle -pkg-sources moonbitlang/hello/lib:./lib -target native moonc build-package ./main/main.mbt -o ./target/native/release/build/main/main.core -pkg moonbitlang/hello/main -is-main -std-path $MOON_HOME/lib/core/target/native/release/bundle -i ./target/native/release/build/lib/lib.mi:lib -pkg-sources moonbitlang/hello/main:./main -target native - moonc link-core $MOON_HOME/lib/core/target/native/release/bundle/core.core ./target/native/release/build/lib/lib.core ./target/native/release/build/main/main.core -main moonbitlang/hello/main -o ./target/native/release/build/main/main.exe -pkg-sources moonbitlang/hello/lib:./lib -pkg-sources moonbitlang/hello/main:./main -pkg-sources moonbitlang/core:$MOON_HOME/lib/core -target native -cc "cc $MOON_HOME/bin/libmoonbitrun.o -O2 -fwrapv" + moonc link-core $MOON_HOME/lib/core/target/native/release/bundle/core.core ./target/native/release/build/lib/lib.core ./target/native/release/build/main/main.core -main moonbitlang/hello/main -o ./target/native/release/build/main/main.exe -pkg-sources moonbitlang/hello/lib:./lib -pkg-sources moonbitlang/hello/main:./main -pkg-sources moonbitlang/core:$MOON_HOME/lib/core -target native -cc "cc $MOON_HOME/bin/libmoonbitrun.o -O2 -fwrapv -lm" ./target/native/release/build/main/main.exe "#]], ); @@ -7188,10 +7188,10 @@ fn test_use_cc_for_native_release() { expect![[r#" moon generate-test-driver --source-dir . --target-dir ./target/native/release/test --package moonbitlang/hello/lib --sort-input --target native --driver-kind whitebox moonc build-package ./lib/hello.mbt ./lib/hello_wbtest.mbt ./target/native/release/test/lib/__generated_driver_for_whitebox_test.mbt -o ./target/native/release/test/lib/lib.whitebox_test.core -pkg moonbitlang/hello/lib -is-main -std-path $MOON_HOME/lib/core/target/native/release/bundle -pkg-sources moonbitlang/hello/lib:./lib -target native - moonc link-core $MOON_HOME/lib/core/target/native/release/bundle/core.core ./target/native/release/test/lib/lib.whitebox_test.core -main moonbitlang/hello/lib -o ./target/native/release/test/lib/lib.whitebox_test.exe -test-mode -pkg-sources moonbitlang/hello/lib:./lib -pkg-sources moonbitlang/core:$MOON_HOME/lib/core -exported_functions moonbit_test_driver_internal_execute -target native -cc "cc $MOON_HOME/bin/libmoonbitrun.o -O2 -fwrapv" + moonc link-core $MOON_HOME/lib/core/target/native/release/bundle/core.core ./target/native/release/test/lib/lib.whitebox_test.core -main moonbitlang/hello/lib -o ./target/native/release/test/lib/lib.whitebox_test.exe -test-mode -pkg-sources moonbitlang/hello/lib:./lib -pkg-sources moonbitlang/core:$MOON_HOME/lib/core -exported_functions moonbit_test_driver_internal_execute -target native -cc "cc $MOON_HOME/bin/libmoonbitrun.o -O2 -fwrapv -lm" moon generate-test-driver --source-dir . --target-dir ./target/native/release/test --package moonbitlang/hello/lib --sort-input --target native --driver-kind internal moonc build-package ./lib/hello.mbt ./target/native/release/test/lib/__generated_driver_for_internal_test.mbt -o ./target/native/release/test/lib/lib.internal_test.core -pkg moonbitlang/hello/lib -is-main -std-path $MOON_HOME/lib/core/target/native/release/bundle -pkg-sources moonbitlang/hello/lib:./lib -target native - moonc link-core $MOON_HOME/lib/core/target/native/release/bundle/core.core ./target/native/release/test/lib/lib.internal_test.core -main moonbitlang/hello/lib -o ./target/native/release/test/lib/lib.internal_test.exe -test-mode -pkg-sources moonbitlang/hello/lib:./lib -pkg-sources moonbitlang/core:$MOON_HOME/lib/core -exported_functions moonbit_test_driver_internal_execute -target native -cc "cc $MOON_HOME/bin/libmoonbitrun.o -O2 -fwrapv" + moonc link-core $MOON_HOME/lib/core/target/native/release/bundle/core.core ./target/native/release/test/lib/lib.internal_test.core -main moonbitlang/hello/lib -o ./target/native/release/test/lib/lib.internal_test.exe -test-mode -pkg-sources moonbitlang/hello/lib:./lib -pkg-sources moonbitlang/core:$MOON_HOME/lib/core -exported_functions moonbit_test_driver_internal_execute -target native -cc "cc $MOON_HOME/bin/libmoonbitrun.o -O2 -fwrapv -lm" "#]], ); check(