Skip to content

DNM: add a CI job to iterate on the Windows build #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 22 commits into from
Closed
123 changes: 123 additions & 0 deletions .github/julia/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "SCIP_PaPILO"

upstream_version = v"9.2.1"
version = VersionNumber(upstream_version.major * 100, upstream_version.minor * 100, upstream_version.patch * 100)

# Collection of sources required to complete build
sources = [
ArchiveSource(
"https://scipopt.org/download/release/scipoptsuite-$(upstream_version).tgz",
"41b71a57af773403e9a6724f78c37d8396ac4b6b270a9bbf3716d67f1af12edf"
),
ArchiveSource(
"https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.13.sdk.tar.xz",
"a3a077385205039a7c6f9e2c98ecdf2a720b2a819da715e03e0630c75782c1e4"
),
DirectorySource(joinpath(@__DIR__, "bundled"))
]

# Bash recipe for building across all platforms
script = raw"""
# This requires macOS 10.13
if [[ "${target}" == x86_64-apple-darwin* ]]; then
pushd $WORKSPACE/srcdir/MacOSX10.*.sdk
rm -rf /opt/${target}/${target}/sys-root/System
cp -ra usr/* "/opt/${target}/${target}/sys-root/usr/."
cp -ra System "/opt/${target}/${target}/sys-root/."
export MACOSX_DEPLOYMENT_TARGET=10.13
popd
fi

cd scipoptsuite*

# Enable large file support on mingw
if [[ "${target}" == *-mingw* ]]; then
export CXXFLAGS="-Wa,-mbig-obj"
fi

# Patch to fix linking with gfortran's library on mingw
# https://github.com/JuliaPackaging/Yggdrasil/pull/8224#issuecomment-2034941690
atomic_patch -p0 $WORKSPACE/srcdir/patches/papilo_cmake.patch

mkdir build
cd build/
cmake -DCMAKE_INSTALL_PREFIX=$prefix\
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN}\
-DCMAKE_BUILD_TYPE=Release\
-DZIMPL=OFF\
-DUG=0\
-DAMPL=0\
-DGCG=0\
-DBOOST=ON\
-DSYM=snauty\
-DTPI=tny\
-DIPOPT_DIR=${prefix} \
-DIPOPT_LIBRARIES=${libdir} \
-DBLISS_INCLUDE_DIR=${includedir} \
-DBLISS_LIBRARY=bliss \
-DBUILD_TESTING=OFF \
..
make -j${nproc} scip
make papilo-executable

make install
cp bin/papilo${exeext} "${bindir}/papilo${exeext}"

mkdir -p ${prefix}/share/licenses/SCIP_PaPILO
for dir in scip soplex gcg; do
cp $WORKSPACE/srcdir/scipoptsuite*/${dir}/LICENSE ${prefix}/share/licenses/SCIP_PaPILO/LICENSE_${dir}
done
cp $WORKSPACE/srcdir/scipoptsuite*/papilo/COPYING ${prefix}/share/licenses/SCIP_PaPILO/LICENSE_papilo
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_gfortran_versions(expand_cxxstring_abis(supported_platforms(; experimental=true)))

# Filter out the aarch64 FreeBSD and RISC-V architectures because oneTBB isn't available there yet.
filter!(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms)
filter!(p -> !(Sys.islinux(p) && arch(p) == "riscv64"), platforms)

filter!(platforms) do p
libgfortran_version(p) >= v"4"
end


# The products that we will ensure are always built
products = [
ExecutableProduct("papilo", :papilo),
ExecutableProduct("scip", :scip),
LibraryProduct("libscip", :libscip),
]

dependencies = [
Dependency(PackageSpec(name="bliss_jll", uuid="508c9074-7a14-5c94-9582-3d4bc1871065"), compat="=0.77.0"),
Dependency(PackageSpec(name="boost_jll", uuid="28df3c45-c428-5900-9ff8-a3135698ca75"); compat="=1.87.0"),
Dependency(PackageSpec(name="Bzip2_jll", uuid="6e34b625-4abd-537c-b88f-471c36dfa7a0"); compat="1.0.9"),
Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae")),
Dependency(PackageSpec(name="GMP_jll", uuid="781609d7-10c4-51f6-84f2-b8444358ff6d"); compat="6.2.1"),
Dependency(PackageSpec(name="Ipopt_jll", uuid="9cc047cb-c261-5740-88fc-0cf96f7bdcc7"); compat="=300.1400.1400"),
Dependency(PackageSpec(name="OpenBLAS32_jll", uuid="656ef2d0-ae68-5445-9ca0-591084a874a2"); compat="0.3.10"),
Dependency(PackageSpec(name="oneTBB_jll", uuid="1317d2d5-d96f-522e-a858-c73665f53c3e"); compat="2022.0.0"),
Dependency(PackageSpec(name="Readline_jll", uuid="05236dd9-4125-5232-aa7c-9ec0c9b2c25a")),
Dependency(PackageSpec(name="Zlib_jll", uuid="83775a58-1f1d-513f-b197-d71354ab007a")),
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(
ARGS,
name,
version,
sources,
script,
platforms,
products,
dependencies;
preferred_gcc_version=v"12",
julia_compat="1.10",
clang_use_lld=false,
)
19 changes: 19 additions & 0 deletions .github/julia/bundled/patches/papilo_cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- papilo/binaries/CMakeLists.txt 2024-12-26 02:45:23.608452403 +0000
+++ papilo/binaries/CMakeLists.txt 2024-12-26 02:45:29.320347256 +0000
@@ -76,6 +76,17 @@
set(PAPILO_HAVE_ROUNDINGSAT 0)
endif()

+# Enable the Fortran language support when the clusol target is included.
+# Even though this was done in the papilo CMake to create the target, it must be
+# done here as well, since the language support is contained to the calling directory
+# and lower, and since the papilo/binaries CMake file can be called from the top-level
+# CMake, which doesn't have Fortran language enabled, Fortran might not be enabled here yet.
+if(TARGET clusol)
+ include(CheckLanguage)
+ check_language(Fortran)
+ enable_language(Fortran)
+endif()
+
# Search again since we cannot rely on papilo/CMakeLists.txt having searched for Boost already.
find_package(Boost ${BOOST_MIN_VERSION} OPTIONAL_COMPONENTS iostreams program_options serialization)
File renamed without changes.
File renamed without changes.
File renamed without changes.
63 changes: 63 additions & 0 deletions .github/workflows/build_test_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build on Linux, Run on Windows
on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened]
# needed to allow julia-actions/cache to delete old caches that it has created
permissions:
actions: write
contents: read
jobs:
build-linux:
runs-on: ubuntu-latest
outputs:
sha1: ${{ steps.build.outputs.SHA1 }}
steps:
- uses: actions/checkout@v4
# Install Julia 1.7 for BinaryBuilder. Note that this is an old version of
# Julia, but it is required for compatibility with BinaryBuilder.
- uses: julia-actions/setup-julia@v2
with:
version: "1.7"
arch: x64
- uses: julia-actions/cache@v2
- name: build
run: |
julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")'
julia --color=yes .github/julia/build_tarballs.jl x86_64-w64-mingw32-cxx11 --verbose --deploy=local
file=/home/runner/.julia/dev/SCIP_PaPILO_jll/Artifacts.toml
sha1=$(grep '^git-tree-sha1' "$file" | cut -d '"' -f2)
echo "artifact_path=${sha1}" >> $GITHUB_ENV
echo "SHA1=${sha1}" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: artifacts
path: /home/runner/.julia/artifacts/${{ env.artifact_path }}
run-windows:
runs-on: windows-latest
needs: build-linux
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: "1"
arch: x64
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: actions/download-artifact@v4
with:
name: artifacts
path: override
- shell: julia --color=yes --project=. {0}
run: |
import SCIP_PaPILO_jll
sha = last(splitpath(SCIP_PaPILO_jll.artifact_dir))
dir = escape_string(joinpath(ENV["GITHUB_WORKSPACE"], "override"))
content = "$sha = \"$(dir)\"\n"
@show content
write(
replace(SCIP_PaPILO_jll.artifact_dir, sha => "Overrides.toml"),
content,
)
- uses: julia-actions/julia-runtest@v1
10 changes: 1 addition & 9 deletions src/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,8 @@ const depsjl_path = joinpath(@__DIR__, "..", "deps", "deps.jl")
if isfile(depsjl_path)
# User-provided SCIP library
include(depsjl_path)
elseif Sys.iswindows()
using SCIP_jll: libscip
else
# Artifact from BinaryBuilder package
import SCIP_PaPILO_jll
if SCIP_PaPILO_jll.is_available()
using SCIP_PaPILO_jll: libscip
else
using SCIP_jll: libscip
end
using SCIP_PaPILO_jll: libscip
end

function __init__()
Expand Down
10 changes: 6 additions & 4 deletions test/MOI_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ function test_runtests_cached()
with_bridge_type=Float64,
with_cache_type=Float64,
)
MOI.set(model, MOI.Silent(), true)
# MOI.set(model, MOI.Silent(), true)
MOI.Test.runtests(
model,
CONFIG;
verbose = true,
# TODO(odow): these doesn't converge. Can we fix upstream?
exclude=[
r"^test_nonlinear_expression_hs110$",
Expand All @@ -56,10 +57,11 @@ end

function test_runtests_bridged()
model = MOI.instantiate(SCIP.Optimizer; with_bridge_type=Float64)
MOI.set(model, MOI.Silent(), true)
# MOI.set(model, MOI.Silent(), true)
MOI.Test.runtests(
model,
CONFIG;
verbose = true,
# TODO(odow): these doesn't converge. Can we fix upstream?
exclude=[
r"^test_nonlinear_expression_hs110$",
Expand All @@ -71,8 +73,8 @@ end

function test_runtests_direct()
model = MOI.instantiate(SCIP.Optimizer)
MOI.set(model, MOI.Silent(), true)
MOI.Test.runtests(model, CONFIG)
# MOI.set(model, MOI.Silent(), true)
MOI.Test.runtests(model, CONFIG; verbose = true)
return
end

Expand Down
13 changes: 8 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ using SCIP
using SCIP_jll
using SCIP_PaPILO_jll

@show(@eval(SCIP, libscip) == SCIP_jll.libscip)
@show(
SCIP_PaPILO_jll.is_available() &&
@eval(SCIP, libscip) == SCIP_PaPILO_jll.libscip
)
@show SCIP_jll.artifact_dir
@show SCIP_jll.libscip

@show SCIP_PaPILO_jll.artifact_dir
@show SCIP_PaPILO_jll.libscip

@show SCIP.libscip

@show SCIP.SCIP_versionnumber()

# new type definitions in module (needs top level)
Expand Down