Merge pull request #242 from jmtcsngr/devel #73
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: "Unit tests" | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l -e -o pipefail {0} | |
env: | |
PERL_CACHE: ~/perl5 # Perlbrew and CPAN modules installed here, cached | |
NPG_LIB: ~/perl5npg # NPG modules installed here, not cached | |
WTSI_NPG_GITHUB_URL: https://github.com/wtsi-npg | |
WTSI_NPG_BUILD_BRANCH: ${GITHUB_HEAD_REF} | |
strategy: | |
matrix: | |
perl: ["5.26.3", "5.34.1"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Cache Perl" | |
id: cache-perl | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.PERL_CACHE }} | |
key: ${{ runner.os }}-${{ matrix.perl }}-perl | |
- name: "Install Perlbrew" | |
if: steps.cache-perl.outputs.cache-hit != 'true' | |
run: | | |
curl -sSL https://install.perlbrew.pl -o perlbrew.sh | |
sha256sum -c .github/workflows/perlbrew.sha256 | |
export PERLBREW_ROOT=${{ env.PERL_CACHE }} | |
sh perlbrew.sh | |
source ${{ env.PERL_CACHE }}/etc/bashrc | |
perlbrew available | |
perlbrew install --notest perl-${{ matrix.perl }} | |
perlbrew use perl-${{ matrix.perl }} | |
perlbrew install-cpanm | |
- name: "Initialize Perlbrew" | |
run: | | |
echo "source ${{ env.PERL_CACHE }}/etc/bashrc" >> "$HOME/.bash_profile" | |
- name: "Install Perl dependencies" | |
run: | | |
cpanm --local-lib=${{ env.PERL_CACHE }} local::lib | |
eval $(perl -I ${{ env.PERL_CACHE }}/lib/perl5/ -Mlocal::lib="$NPG_LIB") | |
eval $(perl -I ${{ env.PERL_CACHE }}/lib/perl5/ -Mlocal::lib) | |
./scripts/install_wsi_dependencies.sh "$NPG_LIB" perl-dnap-utilities | |
cpanm --installdeps --notest . | |
- name: "Log install failure" | |
if: ${{ failure() }} | |
run: | | |
find ~/.cpanm/work -cmin -1 -name '*.log' -exec tail -n20 {} \; | |
- name: "Archive CPAN logs on failure" | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cpan_log | |
path: ~/.cpanm/work/*/build.log | |
retention-days: 5 | |
- name: "Run tests" | |
run: | | |
eval $(perl -I ${{ env.PERL_CACHE }}/lib/perl5/ -Mlocal::lib) | |
eval $(perl -I ${{ env.PERL_CACHE }}/lib/perl5/ -Mlocal::lib="$NPG_LIB") | |
export TEST_AUTHOR=1 | |
perl Build.PL | |
./Build test --verbose | |
./Build install | |
- name: "Build distribution" | |
run: | | |
eval $(perl -I ${{ env.PERL_CACHE }}/lib/perl5/ -Mlocal::lib) | |
eval $(perl -I ${{ env.PERL_CACHE }}/lib/perl5/ -Mlocal::lib="$NPG_LIB") | |
./Build dist | |
export DIST_FILE=ml_warehouse-*.tar.gz | |
export MD5_FILE=$DIST_FILE.md5 | |
md5sum $DIST_FILE > $MD5_FILE | |
export SHA256_FILE=$DIST_FILE.sha256 | |
shasum -a 256 $DIST_FILE > $SHA256_FILE |