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 24 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
106 changes: 106 additions & 0 deletions .github/workflows/CI-distro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
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
- 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: 'alnuth' # `AL_EXECUTABLE, the executable for PARI/GP, has to be set`
#- gap-package: 'autodoc' # test failure
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
- 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 GAP executable in PATH`
- gap-package: 'guarana' # `AL_EXECUTABLE, the executable for PARI/GP, has to be set`
- 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' # segfaults, most likely due to child process handling
- gap-package: 'itc' # dependency `xgap` has no jll
- gap-package: 'localizeringforhomalg' # `Error, found no GAP executable in PATH`
Copy link
Member

Choose a reason for hiding this comment

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

See also issue #1105 (@ThomasBreuer that's another case where a package needs/wants a GAP executable)

- gap-package: 'normalizinterface' # Tests fail: NormalizInterface currently bundles Normaliz 3.9.3 and its test suite is tuned to that, but our JLL builds it against normaliz_jll which has 3.10.2
- gap-package: 'packagemanager' # tests need curlInterface to passe, reactivate once we have a working JLL for that
- gap-package: 'polenta' # `AL_EXECUTABLE, the executable for PARI/GP, has to be set`
- gap-package: 'polycyclic' # test suite currently broken and also disabled by GAP package distribution
- 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 GAP executable in PATH`
- gap-package: 'semigroups' # no jll
#- gap-package: 'typeset' # needs `dot2tex` executable
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
- gap-package: 'xgap' # no jll

steps:
- uses: actions/checkout@v4
- name: "Install extra dependencies"
run: sudo apt-get install --no-install-recommends texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended dot2tex
- 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:
include-matrix: false # don't create a cache per GAP package
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
cache-scratchspaces: false
- name: "Build package"
uses: julia-actions/julia-buildpkg@v1
- name: "Run GAP package tests"
run: |
julia --color=yes --project=. -e 'using GAP, Test; @test GAP.Packages.test("${{ matrix.gap-package }}")'
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- simpcomp
- singular
- zeromqinterface
- 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 @@ -15,6 +15,7 @@ GAP.Packages.update
GAP.Packages.remove
GAP.Packages.build
GAP.Packages.build_recursive
GAP.Packages.test
GAP.Packages.locate_package
```

65 changes: 64 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 @@ -453,6 +453,69 @@ function build_recursive(name::String; quiet::Bool = false,
return true
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
called_QuitGap = false
function fake_QuitGap(code)
called_QuitGap && return # only do something on the first call
called_QuitGap = true
if code != 0
error_occurred = true
end
return
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", fake_QuitGap) do
with_gap_var("FORCE_QUIT_GAP", fake_QuitGap) do
fingolfin 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`.
# Note: `result` may be `fail`, so it is not always booleany.
return !error_occurred && (called_QuitGap || result == true)
end

"""
locate_package(name::String)

Expand Down
Loading