diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69ae495..f13fc61 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,7 @@ jobs: os: ubuntu-24.04-arm rust_target: aarch64-unknown-linux-gnu - target: darwin-x86_64 - os: macos-13 + os: macos-15 rust_target: x86_64-apple-darwin - target: darwin-aarch64 os: macos-14 @@ -68,8 +68,8 @@ jobs: rust_target: x86_64-pc-windows-msvc runs-on: ${{ matrix.os }} - # Windows MLIR builds can be flaky — don't block the release - continue-on-error: ${{ startsWith(matrix.target, 'windows') }} + # Windows and macOS x86_64 MLIR builds can be flaky — don't block the release + continue-on-error: ${{ startsWith(matrix.target, 'windows') || matrix.target == 'darwin-x86_64' }} timeout-minutes: 120 steps: @@ -320,6 +320,7 @@ jobs: # ───────────────────────────────────────────────────────────────────────── linux-packages: needs: build + if: ${{ !cancelled() && needs.build.result != 'failure' }} strategy: fail-fast: false matrix: @@ -371,12 +372,14 @@ jobs: release: needs: [build, linux-packages] runs-on: ubuntu-24.04 - # Don't skip release if linux-packages fails — tarballs are the primary artifacts - if: ${{ !cancelled() && needs.build.result == 'success' }} + # Run as long as build didn't hard-fail — linux-packages and continue-on-error + # targets (Windows, macOS x86_64) are allowed to fail without blocking release + if: ${{ !cancelled() && needs.build.result != 'failure' }} steps: - name: Download all artifacts uses: actions/download-artifact@v4 with: + pattern: "hew-v*" path: artifacts merge-multiple: true @@ -410,6 +413,7 @@ jobs: docker: needs: build runs-on: ubuntu-24.04 + if: ${{ !cancelled() && needs.build.result != 'failure' }} timeout-minutes: 30 steps: diff --git a/Cargo.toml b/Cargo.toml index 622042c..3351970 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ exclude = ["hew-parser/fuzz"] resolver = "2" [workspace.package] -version = "0.1.0" +version = "0.1.2" edition = "2021" license = "MIT OR Apache-2.0" authors = ["Stephen Olesen "] diff --git a/hew-cli/src/compile.rs b/hew-cli/src/compile.rs index 1bb8dd2..337765a 100644 --- a/hew-cli/src/compile.rs +++ b/hew-cli/src/compile.rs @@ -392,12 +392,11 @@ pub fn compile( .to_string(); // Windows executables need .exe when compiling for native host #[cfg(target_os = "windows")] - let default_output = - if options.target.is_none() && !default_output.ends_with(".exe") { - format!("{default_output}.exe") - } else { - default_output - }; + let default_output = if options.target.is_none() && !default_output.ends_with(".exe") { + format!("{default_output}.exe") + } else { + default_output + }; let output_path = output.unwrap_or(&default_output); super::link::link_executable( &obj_path, @@ -438,7 +437,9 @@ fn find_codegen_binary() -> Result { exe_dir.join(codegen_name), exe_dir.join(format!("../lib/{codegen_name}")), exe_dir.join(format!("../../hew-codegen/build/src/{codegen_name}")), - exe_dir.join(format!("../../hew-codegen/build-sanitizer/src/{codegen_name}")), + exe_dir.join(format!( + "../../hew-codegen/build-sanitizer/src/{codegen_name}" + )), ]; for c in &candidates { diff --git a/hew-cli/src/eval/repl.rs b/hew-cli/src/eval/repl.rs index c2409ce..c89d053 100644 --- a/hew-cli/src/eval/repl.rs +++ b/hew-cli/src/eval/repl.rs @@ -313,8 +313,8 @@ fn find_hew_binary() -> Result { "hew" }; let candidates = [ - exe_dir.join(format!("../{hew_name}")), // target/debug/deps/../hew - exe_dir.join(hew_name), // same dir + exe_dir.join(format!("../{hew_name}")), // target/debug/deps/../hew + exe_dir.join(hew_name), // same dir exe_dir.join(format!("../../debug/{hew_name}")), // fallback ]; diff --git a/hew-cli/src/main.rs b/hew-cli/src/main.rs index 30aff11..509153f 100644 --- a/hew-cli/src/main.rs +++ b/hew-cli/src/main.rs @@ -118,7 +118,11 @@ fn cmd_run(args: &[String]) { } // Compile to a temporary binary - let exe_suffix = if cfg!(target_os = "windows") { ".exe" } else { "" }; + let exe_suffix = if cfg!(target_os = "windows") { + ".exe" + } else { + "" + }; let tmp_path = tempfile::Builder::new() .prefix("hew_run_") .suffix(exe_suffix) diff --git a/hew-cli/src/test_runner/runner.rs b/hew-cli/src/test_runner/runner.rs index 161b0fa..ad201ee 100644 --- a/hew-cli/src/test_runner/runner.rs +++ b/hew-cli/src/test_runner/runner.rs @@ -137,8 +137,8 @@ fn find_hew_binary() -> Result { "hew" }; let candidates = [ - exe_dir.join(format!("../{hew_name}")), // target/debug/deps/../hew - exe_dir.join(hew_name), // same dir + exe_dir.join(format!("../{hew_name}")), // target/debug/deps/../hew + exe_dir.join(hew_name), // same dir exe_dir.join(format!("../../debug/{hew_name}")), // fallback ]; @@ -185,7 +185,11 @@ fn compile_test( std::fs::write(tmp_source.path(), &synthetic) .map_err(|e| format!("cannot write temp file: {e}"))?; - let exe_suffix = if cfg!(target_os = "windows") { ".exe" } else { "" }; + let exe_suffix = if cfg!(target_os = "windows") { + ".exe" + } else { + "" + }; let tmp_binary = tempfile::Builder::new() .prefix("hew_test_bin_") .suffix(exe_suffix) diff --git a/hew-cli/src/watch.rs b/hew-cli/src/watch.rs index 54cc3a2..e05e0e1 100644 --- a/hew-cli/src/watch.rs +++ b/hew-cli/src/watch.rs @@ -272,7 +272,11 @@ fn do_check( if run { // Compile to a temp binary and execute it. - let exe_suffix = if cfg!(target_os = "windows") { ".exe" } else { "" }; + let exe_suffix = if cfg!(target_os = "windows") { + ".exe" + } else { + "" + }; let tmp_path = match tempfile::Builder::new() .prefix("hew_watch_") .suffix(exe_suffix) diff --git a/hew-runtime/src/arena.rs b/hew-runtime/src/arena.rs index 69bd7b2..7873f43 100644 --- a/hew-runtime/src/arena.rs +++ b/hew-runtime/src/arena.rs @@ -13,12 +13,7 @@ use std::ptr; #[cfg(windows)] #[link(name = "kernel32")] unsafe extern "system" { - fn VirtualAlloc( - addr: *mut c_void, - size: usize, - alloc_type: u32, - protect: u32, - ) -> *mut c_void; + fn VirtualAlloc(addr: *mut c_void, size: usize, alloc_type: u32, protect: u32) -> *mut c_void; fn VirtualFree(addr: *mut c_void, size: usize, free_type: u32) -> i32; } diff --git a/hew-runtime/src/coro.rs b/hew-runtime/src/coro.rs index c84720b..9062c62 100644 --- a/hew-runtime/src/coro.rs +++ b/hew-runtime/src/coro.rs @@ -118,8 +118,7 @@ impl CoroStack { // Set the guard page at the bottom to PAGE_NOACCESS. let mut old_protect: u32 = 0; - let ret = - unsafe { VirtualProtect(base, GUARD_SIZE, PAGE_NOACCESS, &mut old_protect) }; + let ret = unsafe { VirtualProtect(base, GUARD_SIZE, PAGE_NOACCESS, &mut old_protect) }; if ret == 0 { unsafe { VirtualFree(base, 0, MEM_RELEASE) }; return None; diff --git a/hew-runtime/src/scope.rs b/hew-runtime/src/scope.rs index b93fb08..0b01f37 100644 --- a/hew-runtime/src/scope.rs +++ b/hew-runtime/src/scope.rs @@ -41,28 +41,40 @@ unsafe extern "system" { unsafe fn mutex_init(m: *mut PlatformMutex) { #[cfg(unix)] - unsafe { libc::pthread_mutex_init(m, std::ptr::null()) }; + unsafe { + libc::pthread_mutex_init(m, std::ptr::null()) + }; #[cfg(windows)] let _ = m; } unsafe fn mutex_lock(m: *mut PlatformMutex) { #[cfg(unix)] - unsafe { libc::pthread_mutex_lock(m) }; + unsafe { + libc::pthread_mutex_lock(m) + }; #[cfg(windows)] - unsafe { AcquireSRWLockExclusive(m) }; + unsafe { + AcquireSRWLockExclusive(m) + }; } unsafe fn mutex_unlock(m: *mut PlatformMutex) { #[cfg(unix)] - unsafe { libc::pthread_mutex_unlock(m) }; + unsafe { + libc::pthread_mutex_unlock(m) + }; #[cfg(windows)] - unsafe { ReleaseSRWLockExclusive(m) }; + unsafe { + ReleaseSRWLockExclusive(m) + }; } unsafe fn mutex_destroy(m: *mut PlatformMutex) { #[cfg(unix)] - unsafe { libc::pthread_mutex_destroy(m) }; + unsafe { + libc::pthread_mutex_destroy(m) + }; #[cfg(windows)] let _ = m; } diff --git a/hew-runtime/src/string.rs b/hew-runtime/src/string.rs index e91db68..dbfccee 100644 --- a/hew-runtime/src/string.rs +++ b/hew-runtime/src/string.rs @@ -221,7 +221,14 @@ pub unsafe extern "C" fn hew_float_to_string(f: f64) -> *mut c_char { let mut buf = [0u8; 64]; // SAFETY: buf is large enough for any %g output. snprintf is available // on all platforms (MSVC CRT, glibc, musl). - let len = unsafe { snprintf(buf.as_mut_ptr().cast::(), buf.len(), c"%g".as_ptr(), f) }; + let len = unsafe { + snprintf( + buf.as_mut_ptr().cast::(), + buf.len(), + c"%g".as_ptr(), + f, + ) + }; if len < 0 { return std::ptr::null_mut(); } diff --git a/hew-runtime/src/timer.rs b/hew-runtime/src/timer.rs index d426b3b..a984e6a 100644 --- a/hew-runtime/src/timer.rs +++ b/hew-runtime/src/timer.rs @@ -35,28 +35,40 @@ unsafe extern "system" { unsafe fn mutex_init(m: *mut PlatformMutex) { #[cfg(unix)] - unsafe { libc::pthread_mutex_init(m, std::ptr::null()) }; + unsafe { + libc::pthread_mutex_init(m, std::ptr::null()) + }; #[cfg(windows)] let _ = m; } unsafe fn mutex_lock(m: *mut PlatformMutex) { #[cfg(unix)] - unsafe { libc::pthread_mutex_lock(m) }; + unsafe { + libc::pthread_mutex_lock(m) + }; #[cfg(windows)] - unsafe { AcquireSRWLockExclusive(m) }; + unsafe { + AcquireSRWLockExclusive(m) + }; } unsafe fn mutex_unlock(m: *mut PlatformMutex) { #[cfg(unix)] - unsafe { libc::pthread_mutex_unlock(m) }; + unsafe { + libc::pthread_mutex_unlock(m) + }; #[cfg(windows)] - unsafe { ReleaseSRWLockExclusive(m) }; + unsafe { + ReleaseSRWLockExclusive(m) + }; } unsafe fn mutex_destroy(m: *mut PlatformMutex) { #[cfg(unix)] - unsafe { libc::pthread_mutex_destroy(m) }; + unsafe { + libc::pthread_mutex_destroy(m) + }; #[cfg(windows)] let _ = m; } diff --git a/installers/build-packages.sh b/installers/build-packages.sh index 171a2f8..d05cd8b 100755 --- a/installers/build-packages.sh +++ b/installers/build-packages.sh @@ -255,7 +255,7 @@ build_debian() { _docker_rm "${ctx}" mkdir -p "${ctx}/hew-${VERSION}/debian/source" - # Copy debian packaging files + # Copy debian packaging files and patch version cp "${SCRIPT_DIR}/debian/control" \ "${SCRIPT_DIR}/debian/copyright" \ "${SCRIPT_DIR}/debian/changelog" \ @@ -265,6 +265,8 @@ build_debian() { [[ -f "${SCRIPT_DIR}/debian/source/format" ]] && cp "${SCRIPT_DIR}/debian/source/format" "${ctx}/hew-${VERSION}/debian/source/" chmod +x "${ctx}/hew-${VERSION}/debian/rules" + echo "${VERSION}" >"${ctx}/hew-${VERSION}/debian/hew-version" + sed -i "1s/^hew ([^)]*)/hew (${VERSION}-1)/" "${ctx}/hew-${VERSION}/debian/changelog" # Pre-place the tarball so debian/rules skips the download cp "${TARBALL_PATH}" "${ctx}/hew-${VERSION}/" @@ -316,6 +318,7 @@ build_rpm() { cp "${TARBALL_PATH}" "${ctx}/" cp "${SCRIPT_DIR}/rpm/hew.spec" "${ctx}/" + sed -i "s/^Version:.*/Version: ${VERSION}/" "${ctx}/hew.spec" info "docker" "fedora:41 -> hew-${VERSION}-1.*.${TARGET_ARCH}.rpm" if docker run --rm \ @@ -367,6 +370,7 @@ build_arch() { mkdir -p "${ctx}" cp "${SCRIPT_DIR}/arch/PKGBUILD" "${ctx}/" + sed -i "s/^pkgver=.*/pkgver=${VERSION}/" "${ctx}/PKGBUILD" # Place tarball where makepkg expects it (same dir as PKGBUILD) cp "${TARBALL_PATH}" "${ctx}/" @@ -420,6 +424,7 @@ build_alpine() { mkdir -p "${ctx}" cp "${SCRIPT_DIR}/alpine/APKBUILD" "${ctx}/" + sed -i "s/^pkgver=.*/pkgver=${VERSION}/" "${ctx}/APKBUILD" # Place tarball where abuild expects it (same dir as APKBUILD) cp "${TARBALL_PATH}" "${ctx}/"