diff --git a/README.md b/README.md index 07764df..0a2796b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,24 @@ All of the following inputs are optional. - `coverage`: - Boolean that determines whether code coverage is turned on by adding `--coverage` to `CFLAGS`, `CXXFLAGS` and `LDFLAGS`. - default: `'true'` +- `CONFIGFLAGS`: + - Additional arguments to be passed to configure. + - default: `''` +- `build-needed-pkgs`: + - Build packages needed by this package. Options are: true, false, recursive. + - default: `'recursive'` +- `build-suggested-pkgs`: + - Build packages suggested by this package. Options are: true, false, recursive. + - default: `'true'` +- `build-extensions`: + - Build packages needed for extensions by this package. Options are: true, false, recursive. + - default: `'true'` + +### What's new in v3 + +- The inputs `build-needed-pkgs`, `build-suggested-pkgs` and `build-extensions` were + added. Setting these to `true` will also compile the relevant dependencies, and setting + them to `recursive` will also compile the dependencies' dependencies, etc. ### What's new in v2 @@ -43,9 +61,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: gap-actions/setup-gap@v2 - - uses: gap-actions/build-pkg@v1 + - uses: actions/checkout@v6 + - uses: gap-actions/setup-gap@v3 + - uses: gap-actions/build-pkg@v3 ``` ## Contact diff --git a/action.yml b/action.yml index 9ccb617..f5b8fd6 100644 --- a/action.yml +++ b/action.yml @@ -32,115 +32,141 @@ env: runs: using: "composite" steps: + - name: "Validate input" + shell: bash + run: | + validate_boolean() { + local input=$1 + local option_name=$2 + if ! [[ "$input" =~ ^(true|false)$ ]]; then + echo "::error::Invalid value for option $option_name. Expected 'true' or 'false', but found '$input'" + exit 1; + fi + } + + validate_opts() { + local input=$1 + local option_name=$2 + if ! [[ "$input" =~ ^(true|false|recursive)$ ]]; then + echo "::error::Invalid value for option $option_name. Expected 'true', 'false' or 'recursive' but found '$input'" + exit 1; + fi + } + + validate_boolean "${{ inputs.coverage }}" coverage + validate_opts "${{ inputs.build-needed-pkgs }}" build-needed-pkgs + validate_opts "${{ inputs.build-suggested-pkgs }}" build-suggested-pkgs + validate_opts "${{ inputs.build-extensions }}" build-extensions + - name: "Build the package itself" shell: bash run: | - set -ex - - GAPROOT=${GAPROOT-$HOME/gap} - - # ensure coverage is turned on - if [[ "${{ inputs.coverage }}" = "true" ]]; then - export CFLAGS="$CFLAGS --coverage" - export CXXFLAGS="$CXXFLAGS --coverage" - export LDFLAGS="$LDFLAGS --coverage" - fi - - # adjust build flags for 32bit builds - if [[ "${{ inputs.ABI }}" = 32 ]]; then - export CFLAGS="$CFLAGS -m32" - export CXXFLAGS="$CXXFLAGS -m32" - export LDFLAGS="$LDFLAGS -m32" - fi - - # build this package, if necessary - if [[ -x prerequisites.sh ]]; then - ./prerequisites.sh $GAPROOT - fi - if [[ -x autogen.sh ]]; then - ./autogen.sh - fi - if grep Autoconf ./configure > /dev/null - then - ./configure --with-gaproot=$GAPROOT ${{ inputs.CONFIGFLAGS }} - make -j4 V=1 - elif [[ -x configure ]]; then - ./configure ${{ inputs.CONFIGFLAGS }} $GAPROOT - make -j4 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" - fi + set -ex + + GAPROOT=${GAPROOT-$HOME/gap} + + # ensure coverage is turned on + if [[ "${{ inputs.coverage }}" = "true" ]]; then + export CFLAGS="$CFLAGS --coverage" + export CXXFLAGS="$CXXFLAGS --coverage" + export LDFLAGS="$LDFLAGS --coverage" + fi + + # adjust build flags for 32bit builds + if [[ "${{ inputs.ABI }}" = 32 ]]; then + export CFLAGS="$CFLAGS -m32" + export CXXFLAGS="$CXXFLAGS -m32" + export LDFLAGS="$LDFLAGS -m32" + fi + + # build this package, if necessary + if [[ -x prerequisites.sh ]]; then + ./prerequisites.sh $GAPROOT + fi + if [[ -x autogen.sh ]]; then + ./autogen.sh + fi + if grep Autoconf ./configure > /dev/null + then + ./configure --with-gaproot=$GAPROOT ${{ inputs.CONFIGFLAGS }} + make -j4 V=1 + elif [[ -x configure ]]; then + ./configure ${{ inputs.CONFIGFLAGS }} $GAPROOT + make -j4 CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" + fi - name: "Determine the package's dependencies" shell: bash run: | $GAP -A -q <