From fed22f929e93ce0955eee81f50f290f8d3bb517d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 31 May 2024 03:37:00 +0200 Subject: [PATCH] Add CI job against GAP master and stable-4.13 (#995) --- .github/workflows/gap.yml | 74 +++++++++++++++++++++++++++++++++++++++ etc/run_with_override.jl | 20 +++++++---- etc/setup_override_dir.jl | 2 +- src/setup.jl | 1 + 4 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/gap.yml diff --git a/.github/workflows/gap.yml b/.github/workflows/gap.yml new file mode 100644 index 000000000..6af77c352 --- /dev/null +++ b/.github/workflows/gap.yml @@ -0,0 +1,74 @@ +name: CI with GAP + +on: + push: + branches: + - 'master' + - 'release-*' + tags: '*' + pull_request: + +concurrency: + # group by workflow and ref; the last slightly strange component ensures that for pull + # requests, we limit to 1 concurrent job, but for the default repository branch we don't + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref_name != github.event.repository.default_branch || github.run_number }} + # Cancel intermediate builds, but only if it is a pull request build. + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +jobs: + test: + name: Julia ${{ matrix.julia-version }} - GAP ${{ matrix.gap-version }} - ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: 20 + continue-on-error: ${{ matrix.julia-version == 'nightly' }} + strategy: + fail-fast: false + matrix: + gap-version: + - 'master' + - 'stable-4.13' + julia-version: + - '1.6' + - '1' # latest stable release + - 'nightly' + os: + - ubuntu-latest + include: + # Add a few macOS jobs (the number we can run in parallel is limited) + - gap-version: 'master' + julia-version: '1' + os: macOS-latest + - gap-version: 'stable-4.13' + julia-version: '1' + os: macOS-latest + + steps: + - uses: actions/checkout@v4 + - name: "Set up Julia" + uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.julia-version }} + - name: Checkout GAP + uses: actions/checkout@v4 + with: + repository: 'gap-system/gap' + ref: ${{ matrix.gap-version }} + path: 'GAPROOT' + - name: "Install dependencies (for macOS)" + if: runner.os == 'macOS' + run: | + brew install autoconf zlib # gmp pkg-config + - name: "Build GAP" + run: | + mv GAPROOT /tmp/GAPROOT + cd /tmp/GAPROOT + ./autogen.sh + ./configure + make -j`nproc` + - name: "Override bundled GAP" + run: | + julia --proj=override etc/setup_override_dir.jl /tmp/GAPROOT /tmp/gap_jll_override + - name: "Run tests" + run: | + julia --proj=override etc/run_with_override.jl /tmp/gap_jll_override --depwarn=error -e "using Pkg; Pkg.test(\"GAP\")" + diff --git a/etc/run_with_override.jl b/etc/run_with_override.jl index 502270ecd..5593c089d 100644 --- a/etc/run_with_override.jl +++ b/etc/run_with_override.jl @@ -12,21 +12,24 @@ gapoverride = abspath(gapoverride) # @info "Install needed packages" using Pkg -Pkg.add(["GAP_jll"]) -Pkg.add(["GAP_lib_jll"]) Pkg.develop(path=dirname(dirname(@__FILE__))) +Pkg.add(["GAP_jll", "GAP_lib_jll"]) Pkg.instantiate() +import GAP_lib_jll + # # # -function add_jll_override(depot, pkgname, newdir) +function add_jll_override(depot, pkgname, pkguuid, newdir) pkgid = Base.identify_package("$(pkgname)_jll") - uuid = string(pkgid.uuid) + # does not work with julia 1.12-dev, see https://github.com/JuliaLang/julia/issues/54599 + # TODO: remove pkguuid argument again once that bug is fixed + # pkguuid = string(pkgid.uuid) mkpath(joinpath(depot, "artifacts")) open(joinpath(depot, "artifacts", "Overrides.toml"), "a") do f write(f, """ - [$(uuid)] + [$(pkguuid)] $(pkgname) = "$(newdir)" """) end @@ -40,8 +43,11 @@ tmpdepot = mktempdir(; cleanup=true) @info "Created temporary depot at $(tmpdepot)" # create override file for GAP_jll -add_jll_override(tmpdepot, "GAP", gapoverride) -add_jll_override(tmpdepot, "GAP_lib", gapoverride) +add_jll_override(tmpdepot, "GAP", "5cd7a574-2c56-5be2-91dc-c8bc375b9ddf", gapoverride) +add_jll_override(tmpdepot, "GAP_lib", "de1ad85e-c930-5cd4-919d-ccd3fcafd1a3", gapoverride) + +# HACK: use the documentation from GAP_lib_jll instead of rebuilding it +run(`ln -sf $(abspath(GAP_lib_jll.find_artifact_dir(), "share", "gap", "doc")) $(abspath(gapoverride, "share", "gap", "doc"))`) # prepend our temporary depot to the depot list... withenv("JULIA_DEPOT_PATH"=>tmpdepot*":", "FORCE_JULIAINTERFACE_COMPILATION" => "true") do diff --git a/etc/setup_override_dir.jl b/etc/setup_override_dir.jl index bc0293dd1..8ace04f5b 100644 --- a/etc/setup_override_dir.jl +++ b/etc/setup_override_dir.jl @@ -50,7 +50,7 @@ function gmp_artifact_dir() hash = Base.SHA1(meta["git-tree-sha1"]) if !artifact_exists(hash) dl_info = first(meta["download"]) - download_artifact(hash, dl_info["url"], dl_info["sha256"]) + Pkg.Artifacts.download_artifact(hash, dl_info["url"], dl_info["sha256"]) end return artifact_path(hash) end diff --git a/src/setup.jl b/src/setup.jl index 6166cedd4..18d3c6972 100644 --- a/src/setup.jl +++ b/src/setup.jl @@ -118,6 +118,7 @@ function regenerate_gaproot() # add the necessary flags to link against libgap gap_lib = joinpath(gap_prefix, "lib") sysinfo["GAP_LDFLAGS"] = "-L$(gap_lib) -lgap" + Sys.isapple() && (sysinfo["GAC_LDFLAGS"] = " -bundle") # Remove this line once the GAP_jll build recipe is fixed GAP_VERSION = VersionNumber(sysinfo["GAP_VERSION"]) gaproot_packages = joinpath(Base.DEPOT_PATH[1], "gaproot", "v$(GAP_VERSION.major).$(GAP_VERSION.minor)")