Skip to content

Commit

Permalink
Refactor CI (#641)
Browse files Browse the repository at this point in the history
* Add valgrind workflow

* Create core

* Change matrix structure

* Add valgrind job

* Edit 4.10 job

* Consistent indents

* Add os

* Add config-options

* Make bliss and planarity a matrix

* os -> OS

* Remove old workflow files

* kernel: fix compilation in debug mode

* config-options -> Config-options

* Remove --enable-code-coverage test

* Add NO_COVERAGE

* Valgrind only on release

* Output g++ version

* Add macOS into name of mac-only step

* Add graphviz

* consistent use of NautyTracesInterface

* remove tests for GAP 4.10

* Use stable-4.13 as default

* Warning is error when testing warnings

* Make names consistent

---------

Co-authored-by: James D. Mitchell <[email protected]>
  • Loading branch information
Joseph-Edwards and james-d-mitchell authored May 13, 2024
1 parent 3b42ed7 commit c9b186a
Show file tree
Hide file tree
Showing 15 changed files with 430 additions and 570 deletions.
88 changes: 88 additions & 0 deletions .github/actions/test_with_valgrind/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Run package tests
description: Run package tests
inputs:
NO_COVERAGE:
description: set to a non-empty string to suppress gathering coverage
required: false
type: string
default: ""
GAP_TESTFILE:
description: Name of the GAP file to be read for executing the package tests (overrides TestFile in PackageInfo.g)
required: false
type: string
default: ""
only-needed:
description: If set to true then only needed dependencies of the package being tested are loaded
required: false
type: boolean
default: false
pre-gap:
description: Commands to be prepended to gap
required: false
type: string
default: ""

env:
CHERE_INVOKING: 1

runs:
using: composite
steps:
- name: Run tests
run: |
set -ex
GAPROOT=${GAPROOT-$HOME/gap}
# set up a custom GAP root containing only this package, so that
# we can force GAP to load the correct version of this package
# (we already did that in build_pkg.sh, but we do it again here,
# to allow the occasional instance where a package wants to also
# run the tests of others packages, by invoking this script multiple
# times in different directories)
mkdir -p /tmp/gaproot/pkg/
ln -f -s $PWD /tmp/gaproot/pkg/
# start GAP with custom GAP root, to ensure correct package version is loaded
GAP="${{ inputs.pre-gap }} $GAPROOT/gap -l /tmp/gaproot; --quitonbreak"
if ${{ inputs.only-needed }} = 'true' ; then
GAP="$GAP -A"
fi
# Unless explicitly turned off by setting the NO_COVERAGE environment variable,
# we collect coverage data
if [[ -z "${{ inputs.NO_COVERAGE }}" ]]; then
mkdir -p ${COVDIR-coverage}
GAP="$GAP --cover ${COVDIR-coverage}/$(mktemp XXXXXX).coverage"
fi
cat > __TEST_RUNNNER__.g <<EOF
GAP_TESTFILE:="${{ inputs.GAP_TESTFILE }}";
Read("PackageInfo.g");
info := GAPInfo.PackageInfoCurrent;
if IsEmpty(GAP_TESTFILE) or not IsExistingFile(GAP_TESTFILE) then
GAP_TESTFILE := info.TestFile;
fi;
# Load the package with debug info
SetInfoLevel(InfoPackageLoading, PACKAGE_DEBUG);
SetPackagePath(info.PackageName, "/tmp/gaproot/pkg/$(basename $PWD)");
if ${{ inputs.only-needed }} = true then
LoadPackage(info.PackageName : OnlyNeeded);
else
LoadPackage(info.PackageName);
fi;
SetInfoLevel(InfoPackageLoading, PACKAGE_ERROR);
Print("Now running tests from ", GAP_TESTFILE, "\n");
if EndsWith(GAP_TESTFILE, ".tst") then
QUIT_GAP(Test(GAP_TESTFILE, rec(compareFunction := "uptowhitespace")));
else
Read(GAP_TESTFILE);
Error("Package TestFile did not exit gap");
fi;
EOF
$GAP __TEST_RUNNNER__.g
shell: bash
6 changes: 3 additions & 3 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: codespell
name: Codespell
on:
workflow_dispatch:
pull_request:
Expand All @@ -10,5 +10,5 @@ jobs:
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
100 changes: 100 additions & 0 deletions .github/workflows/config_options.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Config-options
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- stable-*.*
schedule:
# Every day at 3:30 AM UTC
- cron: 30 3 * * *
env:
NO_COVERAGE: true

jobs:
with-external-planarity-bliss:
name: ${{ matrix.bliss }} ${{ matrix.planarity }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
planarity:
- --with-external-planarity
- ""
bliss:
- --with-external-bliss
- ""
exclude:
- planarity: ""
bliss: ""
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Output g++ version . . .
run: g++ --version
- name: Install micromamba environment from environment.yml . . .
uses: mamba-org/setup-micromamba@v1
with:
environment-name: digraphs
cache-environment: true
create-args: ${{ matrix.bliss && 'bliss' || '' }} ${{ matrix.planarity && 'planarity' || ''}}
- name: Set environment variables . . .
run: |
echo "PKG_CONFIG_PATH=$MAMBA_ROOT_PREFIX/envs/digraphs/lib/pkgconfig:$MAMBA_ROOT_PREFIX/envs/digraphs/share/pkgconfig" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$MAMBA_ROOT_PREFIX/envs/digraphs/lib" >> $GITHUB_ENV
echo "CFLAGS=-I$MAMBA_ROOT_PREFIX/envs/digraphs/include" >> $GITHUB_ENV
echo "LDFLAGS=-L$MAMBA_ROOT_PREFIX/envs/digraphs/lib" >> $GITHUB_ENV
- name: Install GAP and clone/compile necessary packages . . .
uses: gap-actions/setup-gap@v2
with:
GAP_PKGS_TO_CLONE: NautyTracesInterface digraphs/graphviz
GAP_PKGS_TO_BUILD: io orb datastructures grape NautyTracesInterface
GAPBRANCH: stable-4.13
- name: Build Digraphs . . .
uses: gap-actions/build-pkg@v1
with:
CONFIGFLAGS: ${{ matrix.bliss }} ${{ matrix.planarity }}
- name: Run Digraphs package's tst/teststandard.g . . .
uses: gap-actions/run-pkg-tests@v2
with:
NO_COVERAGE: true

all-options:
name: ${{ matrix.debug }} ${{ matrix.warnings }} ${{ matrix.without-intrinsics }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
warnings:
- "--enable-compile-warnings"
- ""
debug:
- "--enable-debug"
- ""
without-intrinsics:
- "--without-intrinsics"
- ""
exclude:
- warnings: ""
debug: ""
without-intrinsics: ""

steps:
- uses: actions/checkout@v4
- name: Output g++ version . . .
run: g++ --version
- name: Install GAP and clone/compile necessary packages . . .
uses: gap-actions/setup-gap@v2
with:
GAP_PKGS_TO_CLONE: NautyTracesInterface digraphs/graphviz
GAP_PKGS_TO_BUILD: io orb datastructures grape NautyTracesInterface
GAPBRANCH: stable-4.13
- name: Build Digraphs . . .
uses: gap-actions/build-pkg@v1
with:
CONFIGFLAGS: ${{ matrix.debug }} ${{ matrix.without-intrinsics }} ${{ matrix.warnings && '--enable-compile-warnings WARNING_CXXFLAGS="-Werror" WARNING_CFLAGS="-Werror"' || '' }}
- name: Run Digraphs package's tst/teststandard.g . . .
uses: gap-actions/run-pkg-tests@v2
143 changes: 0 additions & 143 deletions .github/workflows/gap.yml

This file was deleted.

23 changes: 11 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Lint"
name: Lint
on:
workflow_dispatch:
pull_request:
Expand All @@ -8,11 +8,11 @@ on:
- stable-*.*
schedule:
# Every day at 3:30 AM UTC
- cron: '30 3 * * *'
- cron: 30 3 * * *

jobs:
lint:
name: "${{ matrix.linter }}"
name: ${{ matrix.linter }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -21,12 +21,11 @@ jobs:
- gaplint
- cpplint
steps:
- name: "Check out the repository"
uses: actions/checkout@v4
- name: "Set up Python"
uses: actions/setup-python@v5
- name: "Install ${{ matrix.linter }} with pip"
run: pip install ${{ matrix.linter }}
- name: "Run ${{ matrix.linter }} on the Digraphs package"
run: bash etc/${{ matrix.linter }}.sh

- name: Check out the repository . . .
uses: actions/checkout@v4
- name: Set up Python . . .
uses: actions/setup-python@v5
- name: Install ${{ matrix.linter }} with pip . . .
run: pip install ${{ matrix.linter }}
- name: Run ${{ matrix.linter }} on the Digraphs package . . .
run: bash etc/${{ matrix.linter }}.sh
Loading

0 comments on commit c9b186a

Please sign in to comment.