Skip to content

Update to include Python 3.14 #85

Update to include Python 3.14

Update to include Python 3.14 #85

Workflow file for this run

# 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: Julia 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:
julia-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
julia-version: ["1.10", "1.11", "1"] # 1 = latest stable
# Exclude some combinations to reduce CI time
exclude:
- os: windows-latest
julia-version: "1.11"
- os: macOS-latest
julia-version: "1.11"
steps:
- uses: actions/checkout@v4
- name: Set up Julia ${{ matrix.julia-version }}
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
- 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
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
workspaces: julia/pecos-julia-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: |
Write-Host "Building with LLVM_SYS_140_PREFIX: $env:LLVM_SYS_140_PREFIX"
cd julia/pecos-julia-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 julia/pecos-julia-ffi
cargo build --release
- name: Run Julia tests
run: |
cd julia/PECOS.jl
julia --project=. -e 'using Pkg; Pkg.instantiate(); include("test/runtests.jl")'
- name: Run examples
run: |
cd julia/PECOS.jl
# Run demo
julia --project=. examples/demo.jl
# Run basic usage
julia --project=. examples/basic_usage.jl
- name: Check package loadable
run: |
cd julia/PECOS.jl
julia --project=. -e 'using PECOS; println(pecos_version())'
- name: Run Julia formatter check
run: |
cd julia/PECOS.jl
julia -e '
using Pkg
Pkg.add("JuliaFormatter")
using JuliaFormatter
if !format("."; verbose=false, overwrite=false)
println("Formatting issues found. Please run JuliaFormatter.")
exit(1)
end'
- name: Run Julia linting with Aqua.jl
run: |
# Aqua needs the library to be built to load the module
cd julia/PECOS.jl
julia --project=. -e '
using Pkg
Pkg.add("Aqua")
using PECOS, Aqua
Aqua.test_all(PECOS;
ambiguities=false,
unbound_args=true,
undefined_exports=true,
project_extras=true,
stale_deps=false,
deps_compat=true,
piracies=true,
persistent_tasks=false
)'