Skip to content
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

Add GAP distro tests #1067

Merged
merged 31 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1b56a12
Add GAP distro tests
lgoettgens Nov 21, 2024
ad118ab
Try with matrix
lgoettgens Nov 21, 2024
4d2e091
Fix retrieval of GAP packages list
lgoettgens Dec 13, 2024
8aefe07
Add `GAP.Packages.test`
lgoettgens Nov 21, 2024
c43cdf9
Remove dependency on `Test`
lgoettgens Dec 18, 2024
2e50af0
Add exclude list
lgoettgens Dec 18, 2024
65dbc88
Add to changelog
lgoettgens Dec 18, 2024
c33e175
Extend exclusion list
lgoettgens Dec 18, 2024
b0b10c2
Reduce number of CI action caches
lgoettgens Dec 18, 2024
648890e
debugging
fingolfin Dec 18, 2024
123a3a7
hack
fingolfin Dec 18, 2024
82d282d
WIP
fingolfin Dec 18, 2024
c1c91df
Update .github/workflows/CI-distro.yml
lgoettgens Dec 18, 2024
78573e3
Fix typo
lgoettgens Dec 19, 2024
1274be5
Merge branch 'master' into lg/CI-distro
lgoettgens Dec 19, 2024
62a0868
Update .github/workflows/CI-distro.yml
lgoettgens Dec 19, 2024
70171cd
Merge branch 'master' into lg/CI-distro
fingolfin Dec 20, 2024
91c9597
tweak
fingolfin Dec 20, 2024
0ed4d36
Update exclusion list
lgoettgens Dec 20, 2024
5587398
Apply suggestions from code review
lgoettgens Dec 20, 2024
e81846a
Merge branch 'master' into lg/CI-distro
fingolfin Dec 20, 2024
e16e5c9
tweak
fingolfin Dec 20, 2024
3c30ef1
Work around packages calling `QuitGap` multiple times
lgoettgens Dec 21, 2024
e7f7acf
Apply suggestions from code review
lgoettgens Dec 21, 2024
4e448e9
Apply suggestions from code review
lgoettgens Dec 23, 2024
e3e5907
Apply suggestions from code review
lgoettgens Dec 23, 2024
eed4903
Disable `help` tests
lgoettgens Jan 6, 2025
8f489e1
Disable `atlasrep` tests
lgoettgens Jan 6, 2025
b92955a
Apply suggestions from code review
fingolfin Jan 6, 2025
b38232f
Apply suggestions from code review
fingolfin Jan 6, 2025
29c4f28
Merge branch 'master' into lg/CI-distro
fingolfin Jan 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/CI-distro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Test GAP package distro

on:
push:
branches:
- 'master'
- 'release-*'
tags: '*'
pull_request:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pull_request:

IMO this shouldn't run on every commit in every PR, as it produces >150 jobs. But I have kept it here for now such that in this PR, we can already see it running.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are >150 jobs but apparently they take less than 15 minutes to run? So perhaps we keep them on for now and see what happens?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me

schedule:
# Every Monday at 3:08 AM UTC
- cron: '8 3 * * 1'
workflow_dispatch:

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:
generate-matrix:
runs-on: ubuntu-latest
outputs:
gap-packages: ${{ steps.set-matrix.outputs.gap-packages }}
steps:
- uses: actions/checkout@v4
- name: "Set up Julia"
uses: julia-actions/setup-julia@v2
with:
version: '1'
- name: "Cache artifacts"
uses: julia-actions/cache@v2
with:
include-matrix: false # don't create a cache per GAP package
- name: "Build package"
uses: julia-actions/julia-buildpkg@v1
- name: Get list of GAP packages
id: set-matrix
run: julia --project=. -e '
using Artifacts, TOML;
output = sprint(print, "gap-packages=", map(name -> name[9:end], sort!(collect(filter(startswith("GAP_pkg_"), keys(TOML.parsefile(find_artifacts_toml(Base.active_project()))))))));
println(output);
open(ENV["GITHUB_OUTPUT"], "a") do io;
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
println(io, output);
end;'

test:
name: ${{ matrix.gap-package }}
needs: generate-matrix
runs-on: ${{ matrix.os }}
timeout-minutes: 20
continue-on-error: ${{ matrix.julia-version == 'nightly' }}
strategy:
fail-fast: false
matrix:
julia-version:
- '1'
julia-arch:
- x64
os:
- ubuntu-latest
gap-package: ${{fromJSON(needs.generate-matrix.outputs.gap-packages)}}
exclude:
- gap-package: '4ti2interface' # ???
- gap-package: 'alnuth' # `AL_EXECUTABLE, the executable for PARI/GP, has to be set`
- gap-package: 'autodoc' # test failure
- gap-package: 'caratinterface' # `Carat program Bravais_inclusions failed with error code 1`
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
- gap-package: 'curlinterface' # no jll
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
- gap-package: 'example' # no jll
- gap-package: 'examplesforhomalg' # `Error, found no Singular executable in PATH while searching the following list`
- gap-package: 'gapdoc' # test failure
- gap-package: 'gradedmodules' # `Error, found no Singular executable in PATH while searching the following list`
- gap-package: 'gradedringforhomalg' # `Error, found no Singular executable in PATH while searching the following list`
- gap-package: 'guarana' # `AL_EXECUTABLE, the executable for PARI/GP, has to be set`
#- gap-package: 'guava' # test failure
- gap-package: 'hap' # `polymake command not found. Please set POLYMAKE_COMMAND by hand`
- gap-package: 'hapcryst' # `polymake command not found. Please set POLYMAKE_COMMAND by hand`
#- gap-package: 'io' # test failure
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
- gap-package: 'itc' # dependency `xgap` has no jll
- gap-package: 'jupyterkernel' # no jll
- gap-package: 'localizeringforhomalg' # `Error, found no Singular executable in PATH while searching the following list`'
- gap-package: 'modulepresentationsforcap' # `Error, found no Singular executable in PATH while searching the following list`'
- gap-package: 'normalizinterface' # `Error, Some error in the normaliz input data detected: Cone Property in last line not allowed for lattice ideals`
#- gap-package: 'packagemanager' # test failure
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
- gap-package: 'polenta' # `AL_EXECUTABLE, the executable for PARI/GP, has to be set`
- gap-package: 'polycyclic' # ???
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
- gap-package: 'polymaking' # `polymake command not found. Please set POLYMAKE_COMMAND by hand`
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
- gap-package: 'profiling' # segfaults during testing
- gap-package: 'radiroot' # `AL_EXECUTABLE, the executable for PARI/GP, has to be set`
- gap-package: 'ringsforhomalg' # `Error, found no Singular executable in PATH while searching the following list`'
- gap-package: 'semigroups' # no jll
- gap-package: 'singular' # `Error, Singular executable file not found!`
- gap-package: 'toricvarieties' # `Error, found no Singular executable in PATH while searching the following list`'
#- gap-package: 'typeset' # `ReadPackage could not read <digraphs>/gap/doc.g`
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
#- gap-package: 'wpe' # ???
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
- gap-package: 'xgap' # no jll

steps:
- uses: actions/checkout@v4
- name: "Set up Julia"
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
arch: ${{ matrix.julia-arch }}
- name: "Cache artifacts"
uses: julia-actions/cache@v2
with:
cache-scratchspaces: false
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
- name: "Build package"
uses: julia-actions/julia-buildpkg@v1
- name: "Run GAP package tests"
run: |
JULIA_DEBUG=GAP julia --color=yes --project=. -e 'using GAP' # ensure initialization
ls -l /home/runner/.julia/scratchspaces/*/binarywrappers_v1.11/bin
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
JULIA_DEBUG=GAP julia --color=yes --project=. -e 'using GAP, Test; @test GAP.Packages.test("${{ matrix.gap-package }}")'
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
- orb
- profiling
- simpcomp
- Add `GAP.Packages.test(name)`

## Version 0.12.1 (released 2024-12-09)

Expand Down
1 change: 1 addition & 0 deletions docs/src/packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GAP.Packages.install
GAP.Packages.update
GAP.Packages.remove
GAP.Packages.build
GAP.Packages.test
GAP.Packages.locate_package
```

62 changes: 61 additions & 1 deletion src/packages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Packages

import Downloads
import Pidfile
import ...GAP: Globals, GapObj, replace_global!, RNamObj, sysinfo, Wrappers
import ...GAP: disable_error_handler, Globals, GapObj, replace_global!, RNamObj, sysinfo, Wrappers

const DEFAULT_PKGDIR = Ref{String}()
const DOWNLOAD_HELPER = Ref{Downloads.Downloader}()
Expand Down Expand Up @@ -408,6 +408,66 @@ function build(name::String; quiet::Bool = false,
return res
end

"""
test(name::String)

Return a boolean indicating if the GAP package with name `name` succeeds
in running its tests.
fingolfin marked this conversation as resolved.
Show resolved Hide resolved

It is inteded to be used with the `@test` macro from the `Test` package.
fingolfin marked this conversation as resolved.
Show resolved Hide resolved

The function uses [the function `TestPackage`](GAP_ref(ref:TestPackage)).
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
"""
function test(name::String)
global disable_error_handler

function with_gap_var(f, name::String, val)
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
gname = GapObj(name)
old_value = Globals.ValueGlobal(gname)
Globals.MakeReadWriteGlobal(gname)
Globals.UnbindGlobal(gname)
Globals.BindGlobal(gname, val)
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
try
f()
finally
Globals.MakeReadWriteGlobal(gname);
Globals.UnbindGlobal(gname);
Globals.BindGlobal(gname, old_value);
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
end
end

error_occurred = false
ended_using_QuitGap = false
function fake_QuitGap(code)
if code != 0
error_occurred = true
end
ended_using_QuitGap = true
end

disable_error_handler[] = true
result = false
try
with_gap_var("ERROR_OUTPUT", Globals._JULIAINTERFACE_ORIGINAL_ERROR_OUTPUT) do
with_gap_var("QuitGap", fake_QuitGap) do
with_gap_var("QUIT_GAP", fake_QuitGap) do
with_gap_var("ForceQuitGap", identity) do
with_gap_var("FORCE_QUIT_GAP", identity) do
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
result = Globals.TestPackage(GapObj(name))
end
end
end
end
end
finally
disable_error_handler[] = false
end

# Due to the hack above, we run into an error in TestPackage that is usually unreachable.
# In the case of a `QuitGap` call, we thus don't check for `result == true`.
return !error_occurred && (ended_using_QuitGap || result == true)
end

"""
locate_package(name::String)

Expand Down
Loading