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
14 changes: 9 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -320,6 +320,7 @@ jobs:
# ─────────────────────────────────────────────────────────────────────────
linux-packages:
needs: build
if: ${{ !cancelled() && needs.build.result != 'failure' }}
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -410,6 +413,7 @@ jobs:
docker:
needs: build
runs-on: ubuntu-24.04
if: ${{ !cancelled() && needs.build.result != 'failure' }}
timeout-minutes: 30

steps:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <slepp@slepp.ca>"]
Expand Down
15 changes: 8 additions & 7 deletions hew-cli/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -438,7 +437,9 @@ fn find_codegen_binary() -> Result<String, String> {
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 {
Expand Down
4 changes: 2 additions & 2 deletions hew-cli/src/eval/repl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ fn find_hew_binary() -> Result<PathBuf, String> {
"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
];

Expand Down
6 changes: 5 additions & 1 deletion hew-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 7 additions & 3 deletions hew-cli/src/test_runner/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ fn find_hew_binary() -> Result<PathBuf, String> {
"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
];

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion hew-cli/src/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 1 addition & 6 deletions hew-runtime/src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
3 changes: 1 addition & 2 deletions hew-runtime/src/coro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
24 changes: 18 additions & 6 deletions hew-runtime/src/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 8 additions & 1 deletion hew-runtime/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<c_char>(), buf.len(), c"%g".as_ptr(), f) };
let len = unsafe {
snprintf(
buf.as_mut_ptr().cast::<c_char>(),
buf.len(),
c"%g".as_ptr(),
f,
)
};
if len < 0 {
return std::ptr::null_mut();
}
Expand Down
24 changes: 18 additions & 6 deletions hew-runtime/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
7 changes: 6 additions & 1 deletion installers/build-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand All @@ -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}/"
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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}/"

Expand Down Expand Up @@ -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}/"

Expand Down
Loading