DRY for core/basic build #4278
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: perl | |
on: | |
push: | |
branches: | |
- '*' | |
tags-ignore: | |
- '*' | |
pull_request: | |
create: | |
jobs: | |
notify: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
if: ${{ always() }} | |
steps: | |
- uses: PDLPorters/devops/github-actions/irc-notifications@master | |
with: | |
target-notifications: true | |
ci: | |
runs-on: ${{ matrix.os }} | |
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
perl-version: ['5.14.0'] | |
perl-threaded: [false] | |
include: | |
- perl-version: '5.30' | |
os: ubuntu-latest | |
release-test: true | |
coverage: true | |
- perl-version: '5.30' | |
os: ubuntu-latest | |
disttest: true | |
- perl-version: '5.14.0' | |
os: ubuntu-latest | |
perl-threaded: true | |
- perl-version: '5.30' | |
os: ubuntu-latest | |
eumm-blead: 1 | |
- perl-version: '5.30' | |
os: ubuntu-latest | |
test-installed: true # test not from blib but after installing | |
- perl-version: '5.30' | |
os: ubuntu-latest | |
disable-fortran: true # what if we don't have Fortran installed? | |
- perl-version: '5.30' | |
os: ubuntu-latest | |
use-clang: true # use `clang` instead of `gcc` default | |
- perl-version: '5.26' | |
os: windows-latest | |
- perl-version: '5.30' | |
os: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: 'ci-dist: target-setup-perl' | |
uses: PDLPorters/devops/github-actions/ci-dist@master | |
with: | |
target-setup-perl: true | |
perl-version: ${{ matrix.perl-version }} | |
perl-threaded: ${{ matrix.perl-threaded }} | |
# conditional config | |
- name: Maybe gfortran | |
if: "!matrix.disable-fortran" | |
uses: PDLPorters/devops/github-actions/install-dep-gfortran@master | |
- name: Use clang? | |
# clang is already installed in Travis-CI environment. Using PERL_MM_OPT does not work with subdirectory Makefile.PLs so we override Config.pm | |
# Also, both $Config{cc} and $Config{ld} need to be set because under ELF environments (such as Travis-CI's Ubuntu), this is what Perl's Config.pm does. | |
if: matrix.use-clang | |
run: | | |
[ -d build_aux ] || mkdir build_aux | |
echo 'package pdl_config_override; use ExtUtils::MakeMaker::Config; $Config{cc} = $Config{ld} = "clang"; 1;' > build_aux/pdl_config_override.pm | |
echo "PERL5OPT=${PERL5OPT:+${PERL5OPT} }-I$(pwd)/build_aux -Mpdl_config_override" >> $GITHUB_ENV | |
- name: EUMM blead? | |
if: matrix.eumm-blead | |
uses: PDLPorters/devops/github-actions/install-dep-eumm-blead@master | |
- name: Install PDL dependencies | |
uses: PDLPorters/devops/github-actions/install-dep-pdl-dep@master | |
- name: 'ci-dist: target-install-dist-perl-deps' | |
uses: PDLPorters/devops/github-actions/ci-dist@master | |
with: | |
target-install-dist-perl-deps: true | |
dist-perl-deps-configure: ExtUtils::MakeMaker Devel::CheckLib File::Which | |
- name: 'ci-dist: target-test-release-testing' | |
uses: PDLPorters/devops/github-actions/ci-dist@master | |
with: | |
target-test-release-testing: true | |
test-enable-release-testing: ${{ matrix.release-test }} | |
- name: 'ci-dist: target-test (no coverage)' | |
uses: PDLPorters/devops/github-actions/ci-dist@master | |
if: '!matrix.coverage && !matrix.disttest' | |
with: | |
target-test: true | |
test-enable-coverage: ${{ matrix.coverage }} | |
- name: 'disttest' | |
if: matrix.disttest | |
run: | | |
set -e | |
( [ -f Makefile ] || $MYPERL Makefile.PL ) && make disttest | |
- name: Run tests after install (no coverage) | |
if: '!matrix.coverage && matrix.test-installed' | |
run: | | |
set -e | |
[ -f Makefile ] || perl Makefile.PL | |
make install | |
make clean # clean is to ensure no blib | |
mv Basic Basic.x # ensure doesn't think is in repo! | |
cd Basic.x && prove -j4 -I ../blib/lib -I ../blib/arch t | |
- name: 'ci-dist: target-test (with coverage)' | |
uses: PDLPorters/devops/github-actions/ci-dist@master | |
if: matrix.coverage | |
with: | |
target-test: true | |
test-enable-coverage: ${{ matrix.coverage }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
cygwin: | |
env: | |
PERL5LIB: /cygdrive/c/cx/lib/perl5:/cygdrive/c/cx/lib/perl5/MSWin32-x64-multi-thread | |
PERL_LOCAL_LIB_ROOT: /cygdrive/cx | |
PERL_MB_OPT: --install_base /cygdrive/c/cx | |
PERL_MM_OPT: INSTALL_BASE=/cygdrive/c/cx | |
CYGWIN_NOWINPATH: 1 | |
runs-on: windows-latest | |
# only run on tag because cygwin is slow | |
if: ${{ github.event_name == 'create' && github.event.ref_type == 'tag' }} | |
strategy: | |
fail-fast: false | |
defaults: | |
run: | |
shell: C:\tools\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}' | |
steps: | |
- name: Set git to use LF | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
shell: powershell | |
- uses: actions/checkout@v2 | |
- name: Cache Cygwin | |
uses: actions/cache@v1 | |
with: | |
path: | | |
c:\tools\cygwin | |
!c:\tools\cygwin\home | |
key: ${{ runner.os }}-build-cygwin-tools | |
restore-keys: ${{ runner.os }}-build-cygwin-tools | |
- name: Set up Cygwin | |
uses: egor-tensin/setup-cygwin@v3 | |
with: | |
platform: x64 | |
packages: make perl gcc-core gcc-g++ pkg-config libcrypt-devel libssl-devel libnsl-devel git | |
- name: perl -V | |
run: | | |
perl -V | |
gcc --version | |
- name: Prepare for cache | |
run: | | |
perl -V > perlversion.txt | |
gcc --version >> perlversion.txt | |
ls perlversion.txt | |
- name: Cache CPAN modules | |
uses: actions/cache@v1 | |
with: | |
path: c:\cx | |
key: ${{ runner.os }}-build-cygwin-${{ hashFiles('perlversion.txt') }} | |
restore-keys: | | |
${{ runner.os }}-build-cygwin-${{ hashFiles('perlversion.txt') }} | |
- name: Install Static Dependencies | |
run: | | |
export PATH="/cygdrive/c/cx/bin:$PATH" | |
cd $( cygpath -u $GITHUB_WORKSPACE ) | |
yes | cpan App::cpanminus || true | |
- name: Install Dynamic Dependencies | |
run: | | |
export PATH="/cygdrive/c/cx/bin:$PATH" | |
cd $( cygpath -u $GITHUB_WORKSPACE ) | |
(cpanm -n Devel::CheckLib File::Which && cpanm -n --installdeps .) || ( cat ~/.cpanm/build.log && false ) | |
- name: Run tests (no coverage) | |
env: | |
HARNESS_OPTIONS: j4 | |
run: | | |
export PATH="/cygdrive/c/cx/bin:$PATH" | |
cd $( cygpath -u $GITHUB_WORKSPACE ) | |
perl Makefile.PL && make test | |
- run: | | |
export PATH="/cygdrive/c/cx/bin:$PATH" | |
cd $( cygpath -u $GITHUB_WORKSPACE ) | |
- name: CPAN log | |
if: ${{ failure() }} | |
run: | | |
cat ~/.cpanm/latest-build/build.log | |
weird-perls: | |
runs-on: "ubuntu-latest" | |
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }} | |
strategy: | |
matrix: | |
weirdness: [ 'uselongdouble', 'usequadmath' ] | |
name: Perl with ${{ matrix.weirdness }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build perl ... | |
run: | | |
curl -L https://install.perlbrew.pl | bash | |
source ~/perl5/perlbrew/etc/bashrc | |
perlbrew install --notest -D ${{ matrix.weirdness }} perl-5.32.0 --as perl-5.32.0-${{ matrix.weirdness }} | |
- name: run tests | |
env: | |
PERL_USE_UNSAFE_INC: 0 | |
HARNESS_OPTIONS: j4 | |
MAKEFLAGS: --jobs=4 | |
run: | | |
source ~/perl5/perlbrew/etc/bashrc | |
perlbrew switch perl-5.32.0-${{ matrix.weirdness }} | |
perlbrew install-cpanm | |
perl -V|grep archname | |
(cpanm -n ExtUtils::MakeMaker Devel::CheckLib File::Which && cpanm -n --installdeps .) || ( cat ~/.cpanm/build.log && false ) | |
perl Makefile.PL | |
make coretest | |
make test | |
build-status: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
if: ${{ always() }} | |
needs: [ 'ci', 'cygwin', 'weird-perls' ] # , 'ci-ubuntu-containers' | |
steps: | |
- uses: PDLPorters/devops/github-actions/irc-notifications@master | |
with: | |
target-build-status: true | |
needs: ${{ toJSON(needs) }} |