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
123 changes: 123 additions & 0 deletions .github/workflows/go-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Copyright 2025 The PECOS Developers
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

name: Go test

env:
TRIGGER_ON_PR_PUSH: true # Set to true to enable triggers on PR pushes
RUSTFLAGS: -C debuginfo=0
RUST_BACKTRACE: 1

on:
push:
branches: [ "master", "development", "dev" ]
pull_request:
branches: [ "master", "development", "dev" ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
go-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
go-version: ["1.21", "1.22"] # Test on recent stable versions

steps:
- uses: actions/checkout@v4

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Set up Rust
run: rustup show

- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: go/pecos-go-ffi

- name: Set up Visual Studio environment on Windows
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Build Rust FFI library (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
cd go/pecos-go-ffi
cargo build --release

- name: Build Rust FFI library (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
# On macOS, prevent Homebrew library paths from being used during linking
if [[ "${{ runner.os }}" == "macOS" ]]; then
# CRITICAL: Prevent Homebrew library paths from being used during linking
# This fixes the "@rpath/libunwind.1.dylib" runtime error on macOS
# Reference: https://github.com/rust-lang/rust/issues/135372
unset LIBRARY_PATH
unset LD_LIBRARY_PATH
unset DYLD_LIBRARY_PATH
unset DYLD_FALLBACK_LIBRARY_PATH
unset PKG_CONFIG_PATH
export LIBRARY_PATH=/usr/lib

echo "RUSTFLAGS: $RUSTFLAGS"
fi

cd go/pecos-go-ffi
cargo build --release

- name: Run Go tests (Unix)
if: runner.os != 'Windows'
run: |
cd go/pecos
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ github.workspace }}/target/release \
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:${{ github.workspace }}/target/release \
go test -v

- name: Run Go tests (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$env:PATH = "${{ github.workspace }}\target\release;$env:PATH"
cd go/pecos
go test -v

- name: Check Go formatting
run: |
cd go/pecos
if [ -n "$(gofmt -l .)" ]; then
echo "Formatting issues found:"
gofmt -l .
exit 1
fi
echo "All Go code is properly formatted."

- name: Run Go vet
run: |
cd go/pecos
go vet ./...
91 changes: 91 additions & 0 deletions .github/workflows/go-version-consistency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Copyright 2025 The PECOS Developers
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

name: Go version consistency

on:
push:
branches: [ "master", "development", "dev" ]
pull_request:
branches: [ "master", "development", "dev" ]
workflow_dispatch:

jobs:
check-go-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check Go package consistency
run: |
echo "Checking Go package consistency..."

errors=0

# Check go.mod exists
echo "=== Checking go.mod ==="
if [ ! -f "go/pecos/go.mod" ]; then
echo "ERROR: go/pecos/go.mod not found"
errors=$((errors + 1))
else
echo "go.mod found"
cat go/pecos/go.mod
fi

# Check Cargo.toml for FFI
echo ""
echo "=== Checking pecos-go-ffi Cargo.toml ==="
if [ ! -f "go/pecos-go-ffi/Cargo.toml" ]; then
echo "ERROR: go/pecos-go-ffi/Cargo.toml not found"
errors=$((errors + 1))
else
echo "Cargo.toml found"

# Check library name
lib_name=$(grep -E '^\[lib\]' -A5 go/pecos-go-ffi/Cargo.toml | grep 'name' | sed 's/.*name = "\([^"]*\)".*/\1/')
echo "Library name: $lib_name"

if [ "$lib_name" != "pecos_go" ]; then
echo "ERROR: Library name should be 'pecos_go', got '$lib_name'"
errors=$((errors + 1))
fi

# Check crate-type includes cdylib
crate_type=$(grep -E '^\[lib\]' -A5 go/pecos-go-ffi/Cargo.toml | grep 'crate-type')
echo "Crate type: $crate_type"

if [[ "$crate_type" != *"cdylib"* ]]; then
echo "ERROR: crate-type should include 'cdylib'"
errors=$((errors + 1))
fi
fi

# Check module path in go.mod matches expected
echo ""
echo "=== Checking module path ==="
module_path=$(grep '^module' go/pecos/go.mod | sed 's/module //')
echo "Module path: $module_path"

expected_path="github.com/PECOS-packages/PECOS/go/pecos"
if [ "$module_path" != "$expected_path" ]; then
echo "WARNING: Module path '$module_path' doesn't match expected '$expected_path'"
fi

# Final result
echo ""
echo "=== Summary ==="

if [ $errors -eq 0 ]; then
echo "All Go package checks passed!"
else
echo "Found $errors issues!"
exit 1
fi
8 changes: 4 additions & 4 deletions .github/workflows/julia-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ jobs:
- os: ubuntu-latest
architecture: aarch64
runner: ubuntu-latest
- os: macos-13
- os: macos-15-intel
architecture: x86_64
runner: macos-13 # Intel Mac for x86_64
runner: macos-15-intel # Intel Mac for x86_64
- os: macos-latest
architecture: aarch64
runner: macos-latest # ARM64 Mac
Expand Down Expand Up @@ -246,8 +246,8 @@ jobs:
- runner: windows-latest
os: windows-latest
architecture: x86_64
- runner: macos-13
os: macos-13
- runner: macos-15-intel
os: macos-15-intel
architecture: x86_64
- runner: macos-latest
os: macos-latest
Expand Down
68 changes: 35 additions & 33 deletions .github/workflows/julia-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,38 +51,41 @@ jobs:
- name: Set up Rust
run: rustup show

- name: Install LLVM 14.0.6 using pecos-llvm (Unix)
if: runner.os != 'Windows'
run: |
echo "Installing LLVM using pecos-llvm-utils..."
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install

echo "Setting LLVM environment variables..."
export PECOS_LLVM=$(cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>/dev/null)
export LLVM_SYS_140_PREFIX="$PECOS_LLVM"

echo "PECOS_LLVM=$PECOS_LLVM" >> $GITHUB_ENV
echo "LLVM_SYS_140_PREFIX=$LLVM_SYS_140_PREFIX" >> $GITHUB_ENV

echo "Verifying LLVM installation..."
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check

- name: Install LLVM 14.0.6 using pecos-llvm (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Write-Host "Installing LLVM using pecos-llvm-utils..."
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install

Write-Host "Setting LLVM environment variables..."
$env:PECOS_LLVM = (cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>$null)
$env:LLVM_SYS_140_PREFIX = $env:PECOS_LLVM

"PECOS_LLVM=$env:PECOS_LLVM" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"LLVM_SYS_140_PREFIX=$env:LLVM_SYS_140_PREFIX" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

Write-Host "Verifying LLVM installation..."
cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
# NOTE: LLVM is not currently needed for Julia FFI since we use pecos with default-features = false
# Keeping this commented out in case we need to re-enable LLVM features in the future.
#
# - name: Install LLVM 14.0.6 using pecos-llvm (Unix)
# if: runner.os != 'Windows'
# run: |
# echo "Installing LLVM using pecos-llvm-utils..."
# cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
#
# echo "Setting LLVM environment variables..."
# export PECOS_LLVM=$(cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>/dev/null)
# export LLVM_SYS_140_PREFIX="$PECOS_LLVM"
#
# echo "PECOS_LLVM=$PECOS_LLVM" >> $GITHUB_ENV
# echo "LLVM_SYS_140_PREFIX=$LLVM_SYS_140_PREFIX" >> $GITHUB_ENV
#
# echo "Verifying LLVM installation..."
# cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check
#
# - name: Install LLVM 14.0.6 using pecos-llvm (Windows)
# if: runner.os == 'Windows'
# shell: pwsh
# run: |
# Write-Host "Installing LLVM using pecos-llvm-utils..."
# cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- install
#
# Write-Host "Setting LLVM environment variables..."
# $env:PECOS_LLVM = (cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- find 2>$null)
# $env:LLVM_SYS_140_PREFIX = $env:PECOS_LLVM
#
# "PECOS_LLVM=$env:PECOS_LLVM" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# "LLVM_SYS_140_PREFIX=$env:LLVM_SYS_140_PREFIX" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
#
# Write-Host "Verifying LLVM installation..."
# cargo run -p pecos-llvm-utils --bin pecos-llvm --release -- check

- name: Cache Rust
uses: Swatinem/rust-cache@v2
Expand All @@ -99,7 +102,6 @@ jobs:
if: runner.os == 'Windows'
shell: pwsh
run: |
Write-Host "Building with LLVM_SYS_140_PREFIX: $env:LLVM_SYS_140_PREFIX"
cd julia/pecos-julia-ffi
cargo build --release

Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
runner: ubuntu-latest
- os: macos-14
architecture: aarch64
- os: macos-13
- os: macos-15-intel
architecture: x86_64
- os: windows-2022
architecture: x86_64
Expand Down Expand Up @@ -114,8 +114,13 @@ jobs:
curl -sSf https://sh.rustup.rs | sh -s -- -y
rustup update
cargo run --release -p pecos-llvm-utils --bin pecos-llvm -- install --force
# Create a codesign wrapper that strips DYLD_LIBRARY_PATH to prevent
# crashes on macOS 15 when bundled libc++ conflicts with system libc++
mkdir -p $HOME/.pecos/bin
printf '#!/bin/bash\nunset DYLD_LIBRARY_PATH\nexec /usr/bin/codesign "$@"\n' > $HOME/.pecos/bin/codesign
chmod +x $HOME/.pecos/bin/codesign
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
DYLD_LIBRARY_PATH=$HOME/.pecos/llvm/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
PATH=$HOME/.pecos/bin:$PATH DYLD_LIBRARY_PATH=$HOME/.pecos/llvm/lib delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} &&
pipx run abi3audit --strict --report {wheel}
# Windows configuration
CIBW_ENVIRONMENT_WINDOWS: >
Expand Down Expand Up @@ -158,8 +163,8 @@ jobs:
- runner: windows-latest
os: windows-2022
architecture: x86_64
- runner: macos-13
os: macos-13
- runner: macos-15-intel
os: macos-15-intel
architecture: x86_64
- runner: macos-14
os: macos-14
Expand Down
Loading
Loading