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

Adds a github action workflow. #241

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .github/scripts/build_and_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /bin/bash

cpanm -vn Net::SSLeay
cpanm -n Alien::Build
cpanm Alien::GSL
cpanm Module::Build
mkdir -p xs
perl Build.PL
./Build installdeps --cpan_client cpanm
./Build
./Build test
7 changes: 7 additions & 0 deletions .github/scripts/build_dist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/bash

export LD_LIBRARY_PATH=${GSL_DIR}/lib
./Build dist
DISTNAME=$(ls -1 Math*.tar.gz)
echo "MATH_GSL_DISTNAME=$DISTNAME" >> $GITHUB_ENV
echo "$DISTNAME" > math-gsl-dist-name.txt
16 changes: 16 additions & 0 deletions .github/scripts/install_gsl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#! /bin/bash

GSL_MIRROR=http://mirrors.kernel.org/gnu/gsl
BUILD_DIR=$GSL_DIR/build
INSTALL_DIR=$GSL_DIR
mkdir -p $BUILD_DIR
cd "$BUILD_DIR"
export PATH=$PERL_DIR/bin:$PATH
ZIP_NAME="$GSL_NAME".tar.gz
wget "$GSL_MIRROR"/"$ZIP_NAME" --retry-connrefused --timeout=900
tar zxvf "$ZIP_NAME"
cd "$GSL_NAME"
./configure --prefix "$INSTALL_DIR"
make -j$(nproc)
make install
echo "PATH=$PATH" >> $GITHUB_ENV
33 changes: 33 additions & 0 deletions .github/scripts/install_perl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /bin/bash

# NOTE: perl version 5.26.1 is already installed (on Ubuntu 20.04),
# but we would like to not mess with that, so we install a custom perl.

BUILD_DIR=$PERL_DIR/build
INSTALL_DIR=$PERL_DIR
mkdir -p $BUILD_DIR
cd "$BUILD_DIR"
ZIP_NAME=${PERL_NAME}.tar.gz
wget https://www.cpan.org/src/5.0/$ZIP_NAME
ZIP_TYPE=$(perl -pe 's/^.*\.([^.]*)$/$1/' <<<$ZIP_NAME)
TAR_NAME=$(perl -pe 's/^(.*)\.[^.]*$/$1/' <<<$ZIP_NAME)
if [[ $ZIP_TYPE == 'gz' ]] ; then
gunzip $ZIP_NAME
elif [[ $ZIP_TYPE == 'bz2' ]] ; then
bunzip2 $ZIP_NAME
else
echo "Unknown archive type: $ZIP_TYPE"
exit 1
fi
tar xvf $TAR_NAME
PERL_DIR2=$(perl -pe 's/\.tar$//' <<<$TAR_NAME)
cd $PERL_DIR2
sh Configure -des -Dprefix=$INSTALL_DIR -Dman1dir=none -Dman3dir=none
make
make install
export PATH=$INSTALL_DIR/bin:$PATH
echo "PATH=$PATH" >> $GITHUB_ENV
perl --version
cpan -v
cpan App::cpanminus

21 changes: 21 additions & 0 deletions .github/scripts/set_environment_variables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#! /bin/bash

if [[ -n $PERL_DIR ]] ; then
PERL_DIR="${PERL_DIR/#\~/$HOME}"
echo "PERL_NAME=$PERL_NAME" >> $GITHUB_ENV
echo "PERL_DIR=$PERL_DIR" >> $GITHUB_ENV
export PATH=$PERL_DIR/bin:"$PATH"
fi
if [[ -n $GSL_DIR ]] ; then
# autoconf needs an absolute prefix to install GSL, replace tilde with $HOME
GSL_DIR="${GSL_DIR/#\~/$HOME}"
echo "GSL_NAME=$GSL_NAME" >> $GITHUB_ENV
echo "GSL_DIR=$GSL_DIR" >> $GITHUB_ENV
export LD_LIBRARY_PATH=$GSL_DIR/lib
export PATH=$GSL_DIR/bin:"$PATH"
export PKG_CONFIG_PATH="$GSL_DIR"/lib/pkgconfig
fi

echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
9 changes: 9 additions & 0 deletions .github/scripts/show_perl_info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/bash

perl --version
export PATH=$GITHUB_WORKSPACE/perl/bin:$PATH
echo "PATH=$PATH" >> $GITHUB_ENV
perl --version
cpan -v
#uname -a
#lsb_release -d
167 changes: 167 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: linux-build-dist
on: [push, pull_request]
jobs:
build-perls:
runs-on: ubuntu-20.04
strategy:
matrix:
perl: [34, 32, 30, 28, 26]
steps:
- uses: actions/checkout@v2
- name: set environment variables
env:
PERL_NAME: perl-5.${{ matrix.perl }}.0
PERL_DIR: ~/perl/${{ runner.os }}/5.${{ matrix.perl }}
run: |
./.github/scripts/set_environment_variables.sh
- name: perl cache
env:
CACHE_KEY: ${{ runner.os }}-perl3-${{ matrix.perl }}
id: cache-perl
uses: actions/cache@v2
with:
path: ${{ env.PERL_DIR }}
key: ${{ env.CACHE_KEY }}
- name: install perl
if: steps.cache-perl.outputs.cache-hit != 'true'
run: |
./.github/scripts/install_perl.sh
build-gsl:
runs-on: ubuntu-20.04
strategy:
matrix:
gsl: [2.7, 2.6, 2.5, 2.4, 2.3]
steps:
- uses: actions/checkout@v2
- name: set environment variables
env:
GSL_NAME: gsl-${{ matrix.gsl }}
GSL_DIR: ~/gsl/${{ runner.os }}/gsl-${{ matrix.gsl }}
run: |
./.github/scripts/set_environment_variables.sh
- name: gsl cache
env:
CACHE_KEY: ${{ runner.os }}-gsl4-${{ matrix.gsl }}
id: cache-gsl
uses: actions/cache@v2
with:
path: ${{ env.GSL_DIR }}
key: ${{ env.CACHE_KEY }}
- name: install gsl
if: steps.cache-gsl.outputs.cache-hit != 'true'
run: |
./.github/scripts/install_gsl.sh
build-dist:
runs-on: ubuntu-20.04
needs: [build-gsl, build-perls]
strategy:
matrix:
gsl: [2.7]
perl: [34]
steps:
- uses: actions/checkout@v2
- name: set environment variables
env:
GSL_NAME: gsl-${{ matrix.gsl }}
GSL_DIR: ~/gsl/${{ runner.os }}/gsl-${{ matrix.gsl }}
PERL_NAME: perl-5.${{ matrix.perl }}.0
PERL_DIR: ~/perl/${{ runner.os }}/5.${{ matrix.perl }}
run: |
./.github/scripts/set_environment_variables.sh

- name: perl cache
env:
CACHE_KEY: ${{ runner.os }}-perl3-${{ matrix.perl }}
id: cache-perl
uses: actions/cache@v2
with:
path: ${{ env.PERL_DIR }}
key: ${{ env.CACHE_KEY }}
- name: gsl cache
env:
CACHE_KEY: ${{ runner.os }}-gsl4-${{ matrix.gsl }}
id: cache-gsl
uses: actions/cache@v2
with:
path: ${{ env.GSL_DIR }}
key: ${{ env.CACHE_KEY }}
- name: install packages
run: |
# NOTE: The following packages are already installed in "ubuntu-20.04" :
# build-essential curl g++ git wget libssl-dev libz-dev
# swig autoconf libtool
#sudo apt-get install swig autoconf libtool
swig -version
- name: install perl modules, build, and test
run: |
./.github/scripts/build_and_test.sh
- name: build dist
run: |
./.github/scripts/build_dist.sh
- name: Save dist as artifact
uses: actions/upload-artifact@v2
with:
name: math_gsl_dist
path: ${{ env.MATH_GSL_DISTNAME }}
- name: Save name of dist as artifact
uses: actions/upload-artifact@v2
with:
name: math_gsl_dist_name
path: math-gsl-dist-name.txt
install-dist-linux:
runs-on: ubuntu-20.04
needs: [build-dist]
strategy:
matrix:
gsl: [2.7, 2.6, 2.5, 2.4, 2.3]
perl: [34, 32, 30, 28, 26]
steps:
- uses: actions/checkout@v2
- name: set environment variables
env:
GSL_NAME: gsl-${{ matrix.gsl }}
GSL_DIR: ~/gsl/${{ runner.os }}/gsl-${{ matrix.gsl }}
PERL_NAME: perl-5.${{ matrix.perl }}.0
PERL_DIR: ~/perl/${{ runner.os }}/5.${{ matrix.perl }}
run: |
./.github/scripts/set_environment_variables.sh
- name: perl cache
env:
CACHE_KEY: ${{ runner.os }}-perl3-${{ matrix.perl }}
id: cache-perl
uses: actions/cache@v2
with:
path: ${{ env.PERL_DIR }}
key: ${{ env.CACHE_KEY }}
- name: gsl cache
env:
CACHE_KEY: ${{ runner.os }}-gsl4-${{ matrix.gsl }}
id: cache-gsl
uses: actions/cache@v2
with:
path: ${{ env.GSL_DIR }}
key: ${{ env.CACHE_KEY }}
- name: Download dist
env:
PERL_NAME: perl-5.${{ matrix.perl }}
PERL_DIR: ~/perl/${{runner.os}}/5.${{ matrix.perl }}
GSL_NAME: gsl-${{ matrix.gsl }}
GSL_DIR: ~/gsl/${{runner.os}}/gsl-${{ matrix.gsl }}
uses: actions/download-artifact@v2
with:
name: math_gsl_dist
- name: Download dist name
uses: actions/download-artifact@v2
with:
name: math_gsl_dist_name
- name: extract dist
run: |
DISTNAME=$(<math-gsl-dist-name.txt)
tar zxvf $DISTNAME
DISTDIR=$(perl -pe 's/\.tar.gz$//' <<<"$DISTNAME")
echo "DISTDIR=$DISTDIR" >> $GITHUB_ENV
- name: install perl modules and build and test
run: |
BASEDIR=$PWD
cd $DISTDIR
$BASEDIR/.github/scripts/build_and_test.sh
Loading