Skip to content

Commit b8c4d68

Browse files
authored
Merge pull request #2288 from ERGO-Code/od/julia-ci
Add julia-tests-ubuntu.yml as a CI job
2 parents a47bd2f + 9f8d397 commit b8c4d68

File tree

2 files changed

+140
-0
lines changed

2 files changed

+140
-0
lines changed

.github/julia/build_tarballs.jl

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# !!! note
2+
# This file is a version of the file we use to package HiGHS for the Julia
3+
# ecosystem. If you make changes to this file during the development of
4+
# HiGHS, please tag `@odow` so we can make the correponding changes to:
5+
# https://github.com/JuliaPackaging/Yggdrasil/blob/master/H/HiGHS
6+
7+
using BinaryBuilder, Pkg
8+
9+
name = "HiGHS"
10+
version = VersionNumber(ENV["HIGHS_RELEASE"])
11+
12+
sources = [GitSource(ENV["HIGHS_URL"], ENV["HIGHS_COMMIT"])]
13+
14+
script = raw"""
15+
export BUILD_SHARED="ON"
16+
export BUILD_STATIC="OFF"
17+
18+
cd $WORKSPACE/srcdir/HiGHS
19+
20+
# Remove system CMake to use the jll version
21+
apk del cmake
22+
23+
mkdir -p build
24+
cd build
25+
26+
# Do fully static build only on Windows
27+
if [[ "${BUILD_SHARED}" == "OFF" ]] && [[ "${target}" == *-mingw* ]]; then
28+
export CXXFLAGS="-static"
29+
fi
30+
31+
cmake -DCMAKE_INSTALL_PREFIX=${prefix} \
32+
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
33+
-DCMAKE_BUILD_TYPE=Release \
34+
-DBUILD_SHARED_LIBS=${BUILD_SHARED} \
35+
-DZLIB_USE_STATIC_LIBS=${BUILD_STATIC} \
36+
-DFAST_BUILD=ON ..
37+
38+
if [[ "${target}" == *-linux-* ]]; then
39+
make -j ${nproc}
40+
else
41+
if [[ "${target}" == *-mingw* ]]; then
42+
cmake --build . --config Release
43+
else
44+
cmake --build . --config Release --parallel
45+
fi
46+
fi
47+
make install
48+
49+
install_license ../LICENSE.txt
50+
"""
51+
52+
products = [
53+
LibraryProduct("libhighs", :libhighs),
54+
ExecutableProduct("highs", :highs),
55+
]
56+
57+
platforms = supported_platforms()
58+
platforms = expand_cxxstring_abis(platforms)
59+
60+
dependencies = [
61+
Dependency("CompilerSupportLibraries_jll"),
62+
Dependency("Zlib_jll"),
63+
HostBuildDependency(PackageSpec(; name="CMake_jll")),
64+
]
65+
66+
build_tarballs(
67+
ARGS,
68+
name,
69+
version,
70+
sources,
71+
script,
72+
platforms,
73+
products,
74+
dependencies;
75+
preferred_gcc_version = v"6",
76+
julia_compat = "1.6",
77+
)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: JuliaCompileAndTest
2+
on:
3+
push:
4+
branches: [master, latest]
5+
pull_request:
6+
types: [opened, synchronize, ready_for_review, reopened]
7+
# needed to allow julia-actions/cache to delete old caches that it has created
8+
permissions:
9+
actions: write
10+
contents: read
11+
jobs:
12+
test:
13+
name: Julia - ${{ github.event_name }}
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
# Install Julia 1.7 for BinaryBuilder. Note that this is an old version of
18+
# Julia, but it is required for compatibility with BinaryBuilder.
19+
- uses: julia-actions/setup-julia@v2
20+
with:
21+
version: "1.7"
22+
arch: x64
23+
- uses: julia-actions/cache@v2
24+
# Set the environment variables required by BinaryBuilder.
25+
- run: |
26+
git fetch --tags
27+
echo "HIGHS_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1) | sed 's/^v//')" >> $GITHUB_ENV
28+
if [ "${{ github.event_name }}" = "pull_request" ]; then
29+
echo "HIGHS_COMMIT=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
30+
echo "HIGHS_URL=${{ github.event.pull_request.head.repo.clone_url }}" >> $GITHUB_ENV
31+
else
32+
echo "HIGHS_COMMIT=${{ github.sha }}" >> $GITHUB_ENV
33+
echo "HIGHS_URL=https://github.com/${{ github.repository }}.git" >> $GITHUB_ENV
34+
fi
35+
- run: |
36+
julia --color=yes -e 'using Pkg; Pkg.add("BinaryBuilder")'
37+
julia --color=yes .github/julia/build_tarballs.jl x86_64-linux-gnu-cxx11 --verbose --deploy="local"
38+
# Now install a newer version of Julia to actually test HiGHS_jll. We
39+
# choose v1.10 because it is the current Long-Term Support (LTS).
40+
- uses: julia-actions/setup-julia@v2
41+
with:
42+
version: "1.10"
43+
arch: x64
44+
# We want to install the latest version of HiGHS.jl, but we also want it
45+
# to be compatible with our newly compiled HiGHS_jll. To do so, we
46+
# manually edit HiGHS.jl's Project.toml file to allow any v1.X.Y version
47+
# of HiGHS_jll
48+
- shell: julia --color=yes {0}
49+
run: |
50+
using Pkg
51+
Pkg.develop("HiGHS")
52+
project_filename = "/home/runner/.julia/dev/HiGHS/Project.toml"
53+
project = read(project_filename, String)
54+
write(
55+
project_filename,
56+
replace(project, r"HiGHS_jll = \"=.+?\"" => "HiGHS_jll = \"1\""),
57+
)
58+
# Now we can add HiGHS_jll and run the tests for HiGHS.
59+
- shell: julia --color=yes {0}
60+
run: |
61+
using Pkg
62+
Pkg.develop(; path="/home/runner/.julia/dev/HiGHS_jll")
63+
Pkg.test("HiGHS")

0 commit comments

Comments
 (0)