From 3212f3041e072e9e1d39a1cbe3bb68ed882d9d3b Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Mon, 28 Oct 2024 20:53:53 -0500 Subject: [PATCH 1/9] [CI] Run the tests of AmplNLWriter.jl --- .github/workflows/julia-tests-ubuntu.yml | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/julia-tests-ubuntu.yml diff --git a/.github/workflows/julia-tests-ubuntu.yml b/.github/workflows/julia-tests-ubuntu.yml new file mode 100644 index 00000000..4065a5c5 --- /dev/null +++ b/.github/workflows/julia-tests-ubuntu.yml @@ -0,0 +1,45 @@ +name: CI +on: + push: + branches: [main] + 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: + test: + name: Julia - ${{ github.event_name }} + runs-on: ubuntu-latest + steps: + - name: Checkout Uno + uses: actions/checkout@v4 + - name: Install Julia 1.7 + uses: julia-actions/setup-julia@v2 + with: + version: "1.7" + arch: x64 + - name: Set the environment variables BINARYBUILDER_AUTOMATIC_APPLE, UNO_RELEASE, UNO_COMMIT + shell: bash + run: | + echo "BINARYBUILDER_AUTOMATIC_APPLE=true" >> $GITHUB_ENV + echo "UNO_RELEASE=1.1.1" >> $GITHUB_ENV + echo "UNO_COMMIT=${{ github.sha }}" >> $GITHUB_ENV + - name: Generate Uno_jll.jl + run: | + julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' + julia --color=yes .github/julia/build_tarballs.jl x86_64-linux-gnu-libgfortran5 --verbose --local + rm -r ~/.julia + - name: Install Julia LTS + uses: julia-actions/setup-julia@v2 + with: + version: "1.10" + arch: x64 + + - name: Test AmplNLWriter.jl + shell: bash + run: | + git clone https://github.com/jump-dev/AmplNLWriter.jl + cd AmplNLWriter.jl/test/MINLPTests/ + julia --project --color=yes -e 'using Pkg; Pkg.develop(path="~/home/.julia/dev/Uno_jll.jl"); include("run_minlptests.jl")' From 68bd0966411193076d8812a56d1e60ec5badb84e Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Mon, 28 Oct 2024 20:56:28 -0500 Subject: [PATCH 2/9] [CI] Run the tests of AmplNLWriter.jl --- .github/workflows/julia-tests-ubuntu.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/julia-tests-ubuntu.yml b/.github/workflows/julia-tests-ubuntu.yml index 4065a5c5..45bd5e92 100644 --- a/.github/workflows/julia-tests-ubuntu.yml +++ b/.github/workflows/julia-tests-ubuntu.yml @@ -29,8 +29,7 @@ jobs: - name: Generate Uno_jll.jl run: | julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' - julia --color=yes .github/julia/build_tarballs.jl x86_64-linux-gnu-libgfortran5 --verbose --local - rm -r ~/.julia + julia --color=yes .github/julia/build_tarballs.jl x86_64-linux-gnu-libgfortran5 --verbose --deploy="local" - name: Install Julia LTS uses: julia-actions/setup-julia@v2 with: From 7838c66a3a46e003615911cb276eca56bddab194 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Mon, 28 Oct 2024 20:59:45 -0500 Subject: [PATCH 3/9] Add a file --- .github/julia/build_tarballs_yggdrasil.jl | 104 ++++++++++++++++++++++ .github/workflows/julia-tests-ubuntu.yml | 2 +- 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 .github/julia/build_tarballs_yggdrasil.jl diff --git a/.github/julia/build_tarballs_yggdrasil.jl b/.github/julia/build_tarballs_yggdrasil.jl new file mode 100644 index 00000000..2d39b816 --- /dev/null +++ b/.github/julia/build_tarballs_yggdrasil.jl @@ -0,0 +1,104 @@ +# 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 + +haskey(ENV, "UNO_RELEASE") || error("The environment variable UNO_RELEASE is not defined.") +haskey(ENV, "UNO_COMMIT") || error("The environment variable UNO_COMMIT is not defined.") + +name = "Uno" +version = VersionNumber(ENV["UNO_RELEASE"]) + +# Collection of sources required to complete build +sources = [ + GitSource("https://github.com/cvanaret/Uno.git", + ENV["UNO_COMMIT"]) +] + +script = raw""" +cd $WORKSPACE/srcdir/Uno +mkdir -p build +cd build + +if [[ "${target}" == *mingw* ]]; then + LBT=blastrampoline-5 +else + LBT=blastrampoline +fi + +if [[ "${target}" == *apple* ]] || [[ "${target}" == *freebsd* ]]; then + OMP=omp +else + OMP=gomp +fi + +# FortranCInterface_VERIFY fails on macOS, but it's not actually needed for the current build +sed -i 's/FortranCInterface_VERIFY(CXX)/# FortranCInterface_VERIFY(CXX)/g' ../CMakeLists.txt + +cmake \ + -DCMAKE_INSTALL_PREFIX=${prefix} \ + -DCMAKE_PREFIX_PATH=${libdir} \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + -DCMAKE_BUILD_TYPE=Release \ + -DAMPLSOLVER=${libdir}/libasl.${dlext} \ + -DHSL=${libdir}/libhsl.${dlext} \ + -DBLA_VENDOR="libblastrampoline" \ + -DMUMPS_INCLUDE_DIR=${includedir} \ + -DMETIS_INCLUDE_DIR=${includedir} \ + -DMUMPS_LIBRARY="${libdir}/libdmumps.${dlext}" \ + -DMUMPS_COMMON_LIBRARY="${libdir}/libmumps_common.${dlext}" \ + -DMUMPS_PORD_LIBRARY="${libdir}/libpord.${dlext}" \ + -DMUMPS_MPISEQ_LIBRARY="${libdir}/libmpiseq.${dlext}" \ + -DBLAS_LIBRARIES="${libdir}/lib${LBT}.${dlext}" \ + -DLAPACK_LIBRARIES="${libdir}/lib${LBT}.${dlext}" \ + .. + +make -j${nproc} + +# Uno does not support `make install`. Manually copy for now. +install -v -m 755 "uno_ampl${exeext}" -t "${bindir}" + +# Currently, Uno does not provide a shared library. This may be useful in the future once it has a C API. +# We just check that we can generate it, but we don't include it in the tarballs. +${CXX} -shared $(flagon -Wl,--whole-archive) libuno.a $(flagon -Wl,--no-whole-archive) -o libuno.${dlext} -L${libdir} -l${OMP} -l${LBT} -ldmumps -lmetis -lhsl +# cp libuno.${dlext} "${libdir}/libuno.${dlext} +""" + +platforms = supported_platforms() +filter!(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms) +platforms = expand_cxxstring_abis(platforms) + +products = [ + # This LibraryProduct may be useful once Uno provides a C API. We omit it for now. + # LibraryProduct("libuno", :libuno), + # We call this amplexe to match the convention of other JLL packages (like Ipopt_jll) that provide AMPL wrappers + ExecutableProduct("uno_ampl", :amplexe), +] + +dependencies = [ + Dependency(PackageSpec(name="HSL_jll", uuid="017b0a0e-03f4-516a-9b91-836bbd1904dd")), + Dependency(PackageSpec(name="METIS_jll", uuid="d00139f3-1899-568f-a2f0-47f597d42d70")), + Dependency(PackageSpec(name="ASL_jll", uuid="ae81ac8f-d209-56e5-92de-9978fef736f9"), compat="0.1.3"), + Dependency(PackageSpec(name="MUMPS_seq_jll", uuid="d7ed1dd3-d0ae-5e8e-bfb4-87a502085b8d")), + Dependency(PackageSpec(name="libblastrampoline_jll", uuid="8e850b90-86db-534c-a0d3-1478176c7d93"), compat="5.4.0"), + # For OpenMP we use libomp from `LLVMOpenMP_jll` where we use LLVM as compiler (BSD systems), + # and libgomp from `CompilerSupportLibraries_jll` everywhere else. + Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); platforms=filter(!Sys.isbsd, platforms)), + Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); platforms=filter(Sys.isbsd, platforms)), + + # We need at least 3.29 (Ygg version), or 3.30 upstream version for LBT support, + # so always pull the most recent CMake version. + HostBuildDependency(PackageSpec(name="CMake_jll", uuid="3f4e10e2-61f2-5801-8945-23b9d642d0e6")), +] + +build_tarballs( + ARGS, + name, + version, + sources, + script, + platforms, + products, + dependencies; + julia_compat = "1.9", + preferred_gcc_version = v"10.2.0", +) diff --git a/.github/workflows/julia-tests-ubuntu.yml b/.github/workflows/julia-tests-ubuntu.yml index 45bd5e92..662de4cf 100644 --- a/.github/workflows/julia-tests-ubuntu.yml +++ b/.github/workflows/julia-tests-ubuntu.yml @@ -29,7 +29,7 @@ jobs: - name: Generate Uno_jll.jl run: | julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' - julia --color=yes .github/julia/build_tarballs.jl x86_64-linux-gnu-libgfortran5 --verbose --deploy="local" + julia --color=yes .github/julia/build_tarballs_yggdrasil.jl x86_64-linux-gnu-libgfortran5 --verbose --deploy="local" - name: Install Julia LTS uses: julia-actions/setup-julia@v2 with: From 4eb974737aabb9862ba7178ba5a2cbe4d2f70189 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Mon, 28 Oct 2024 21:09:07 -0500 Subject: [PATCH 4/9] Add a file --- .github/julia/build_tarballs_yggdrasil.jl | 4 ++-- .github/workflows/julia-tests-ubuntu.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/julia/build_tarballs_yggdrasil.jl b/.github/julia/build_tarballs_yggdrasil.jl index 2d39b816..13176dce 100644 --- a/.github/julia/build_tarballs_yggdrasil.jl +++ b/.github/julia/build_tarballs_yggdrasil.jl @@ -4,14 +4,14 @@ using BinaryBuilder, Pkg haskey(ENV, "UNO_RELEASE") || error("The environment variable UNO_RELEASE is not defined.") haskey(ENV, "UNO_COMMIT") || error("The environment variable UNO_COMMIT is not defined.") +haskey(ENV, "UNO_URL") || error("The environment variable UNO_URL is not defined.") name = "Uno" version = VersionNumber(ENV["UNO_RELEASE"]) # Collection of sources required to complete build sources = [ - GitSource("https://github.com/cvanaret/Uno.git", - ENV["UNO_COMMIT"]) + GitSource(ENV["UNO_URL"], ENV["UNO_COMMIT"]) ] script = raw""" diff --git a/.github/workflows/julia-tests-ubuntu.yml b/.github/workflows/julia-tests-ubuntu.yml index 662de4cf..cef66123 100644 --- a/.github/workflows/julia-tests-ubuntu.yml +++ b/.github/workflows/julia-tests-ubuntu.yml @@ -26,6 +26,7 @@ jobs: echo "BINARYBUILDER_AUTOMATIC_APPLE=true" >> $GITHUB_ENV echo "UNO_RELEASE=1.1.1" >> $GITHUB_ENV echo "UNO_COMMIT=${{ github.sha }}" >> $GITHUB_ENV + echo "UNO_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV - name: Generate Uno_jll.jl run: | julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' From 7f9f0f4c834b8530b042455218fe3262797c3982 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Mon, 28 Oct 2024 21:14:58 -0500 Subject: [PATCH 5/9] wip --- .github/workflows/julia-tests-ubuntu.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/julia-tests-ubuntu.yml b/.github/workflows/julia-tests-ubuntu.yml index cef66123..6ec476c5 100644 --- a/.github/workflows/julia-tests-ubuntu.yml +++ b/.github/workflows/julia-tests-ubuntu.yml @@ -26,7 +26,11 @@ jobs: echo "BINARYBUILDER_AUTOMATIC_APPLE=true" >> $GITHUB_ENV echo "UNO_RELEASE=1.1.1" >> $GITHUB_ENV echo "UNO_COMMIT=${{ github.sha }}" >> $GITHUB_ENV - echo "UNO_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV + if [ "${{ github.event_name }}" = "pull_request" ]; then + echo "UNO_URL=${{ github.event.pull_request.head.repo.clone_url }}" >> $GITHUB_ENV + else + echo "UNO_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV + fi - name: Generate Uno_jll.jl run: | julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")' From 7c08ab627bc528cb0755385c111dfac670cd3792 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Mon, 28 Oct 2024 21:18:39 -0500 Subject: [PATCH 6/9] wip --- .github/workflows/julia-tests-ubuntu.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/julia-tests-ubuntu.yml b/.github/workflows/julia-tests-ubuntu.yml index 6ec476c5..37de0a22 100644 --- a/.github/workflows/julia-tests-ubuntu.yml +++ b/.github/workflows/julia-tests-ubuntu.yml @@ -25,10 +25,11 @@ jobs: run: | echo "BINARYBUILDER_AUTOMATIC_APPLE=true" >> $GITHUB_ENV echo "UNO_RELEASE=1.1.1" >> $GITHUB_ENV - echo "UNO_COMMIT=${{ github.sha }}" >> $GITHUB_ENV if [ "${{ github.event_name }}" = "pull_request" ]; then + echo "UNO_COMMIT=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV echo "UNO_URL=${{ github.event.pull_request.head.repo.clone_url }}" >> $GITHUB_ENV else + echo "UNO_COMMIT=${{ github.sha }}" >> $GITHUB_ENV echo "UNO_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV fi - name: Generate Uno_jll.jl From 77faa52c2e090a889ad4fb43edf9dbd0388ab5fb Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Mon, 28 Oct 2024 21:26:18 -0500 Subject: [PATCH 7/9] Fix the path of Uno_jll.jl --- .github/workflows/julia-tests-ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/julia-tests-ubuntu.yml b/.github/workflows/julia-tests-ubuntu.yml index 37de0a22..83e194ab 100644 --- a/.github/workflows/julia-tests-ubuntu.yml +++ b/.github/workflows/julia-tests-ubuntu.yml @@ -47,4 +47,4 @@ jobs: run: | git clone https://github.com/jump-dev/AmplNLWriter.jl cd AmplNLWriter.jl/test/MINLPTests/ - julia --project --color=yes -e 'using Pkg; Pkg.develop(path="~/home/.julia/dev/Uno_jll.jl"); include("run_minlptests.jl")' + julia --project --color=yes -e 'using Pkg; Pkg.develop(path="/home/runner/.julia/dev/Uno_jll"); include("run_minlptests.jl")' From faf8361899081584b0b624645056afbbf7943e97 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Mon, 28 Oct 2024 21:45:54 -0500 Subject: [PATCH 8/9] Fix the path of Uno_jll.jl --- .github/workflows/julia-tests-ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/julia-tests-ubuntu.yml b/.github/workflows/julia-tests-ubuntu.yml index 83e194ab..ee2f4497 100644 --- a/.github/workflows/julia-tests-ubuntu.yml +++ b/.github/workflows/julia-tests-ubuntu.yml @@ -47,4 +47,4 @@ jobs: run: | git clone https://github.com/jump-dev/AmplNLWriter.jl cd AmplNLWriter.jl/test/MINLPTests/ - julia --project --color=yes -e 'using Pkg; Pkg.develop(path="/home/runner/.julia/dev/Uno_jll"); include("run_minlptests.jl")' + julia --project --color=yes -e 'using Pkg; Pkg.develop(path="/home/runner/.julia/dev/Uno_jll"); Pkg.instantiate(); include("run_minlptests.jl")' From 29a0edafbc2461b2fa9eafb43e9f1a85416404c2 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Mon, 28 Oct 2024 22:16:55 -0500 Subject: [PATCH 9/9] Fix the path of Uno_jll.jl --- .github/workflows/julia-tests-ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/julia-tests-ubuntu.yml b/.github/workflows/julia-tests-ubuntu.yml index ee2f4497..70490882 100644 --- a/.github/workflows/julia-tests-ubuntu.yml +++ b/.github/workflows/julia-tests-ubuntu.yml @@ -47,4 +47,4 @@ jobs: run: | git clone https://github.com/jump-dev/AmplNLWriter.jl cd AmplNLWriter.jl/test/MINLPTests/ - julia --project --color=yes -e 'using Pkg; Pkg.develop(path="/home/runner/.julia/dev/Uno_jll"); Pkg.instantiate(); include("run_minlptests.jl")' + julia --project --color=yes -e 'using Pkg; Pkg.develop(path="/home/runner/.julia/dev/Uno_jll"); Pkg.develop(path="../.."); Pkg.instantiate(); include("run_minlptests.jl")'