Skip to content

Merge pull request #898 from jmtcsngr/devel #213

Merge pull request #898 from jmtcsngr/devel

Merge pull request #898 from jmtcsngr/devel #213

Workflow file for this run

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: $HOME/perl5 # Perlbrew and CPAN modules installed here, cached
NPG_LIB: $HOME/perl5npg # NPG modules installed here, not cached
WSI_CONDA_CHANNEL: https://dnap.cog.sanger.ac.uk/npg/conda/devel/generic
CONDA_TEST_ENV: test-environment
CONDA_HOME: $HOME/conda
NPM_CONFIG_PREFIX: $HOME/.npm-global
WTSI_NPG_GITHUB_URL: https://github.com/wtsi-npg
WTSI_NPG_BUILD_BRANCH: ${{ github.base_ref || github.ref }}
strategy:
fail-fast: false
matrix:
perl: ["5.26.3", "5.34.1"]
node: ['14.8.0']
steps:
- uses: actions/checkout@v4
- name: "Install OS dependencies"
run: |
sudo apt-get update
# https://github.com/actions/runner-images/issues/2139
sudo apt-get remove -y nginx libgd3
# libdevel-patchperl-perl is needed for perlbrew
sudo apt-get install -y libgd-dev uuid-dev libgd-text-perl libdevel-patchperl-perl
- name: "Install Miniforge"
run: |
CONDA_HOME=${{ env.CONDA_HOME }} ./scripts/install_miniforge.sh
echo 'source "${{ env.CONDA_HOME }}/etc/profile.d/conda.sh"' >> "$HOME/.bash_profile"
- name: "Cache Conda"
id: miniforgeCache
uses: actions/cache@v4
with:
path: |
${{ env.CONDA_HOME }}/pkgs
${{ env.CONDA_HOME }}/envs
key: ${{ runner.os }}-build-miniforge
- name: "Install Conda packages"
env:
CONDA_TEST_ENV: test-environment
run: |
conda config --prepend pkgs_dirs ${{ env.CONDA_HOME }}/pkgs
conda config --prepend envs_dirs ${{ env.CONDA_HOME }}/envs
conda config --set auto_update_conda False
conda config --prepend channels "${{ env.WSI_CONDA_CHANNEL }}"
conda info
conda create -y -n "${{ env.CONDA_TEST_ENV }}"
conda install -y -n "${{ env.CONDA_TEST_ENV }}" nodejs=="${{ matrix.node }}"
conda install -y -n "${{ env.CONDA_TEST_ENV }}" npg_qc_utils
conda install -y -n "${{ env.CONDA_TEST_ENV }}" baton
- 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: "NPM"
run: |
mkdir -p "${{ env.NPM_CONFIG_PREFIX }}"
- name: "Install Perl dependencies"
run: |
cpanm --local-lib=${{ env.PERL_CACHE }} local::lib
eval $(perl -I ${{ env.PERL_CACHE }}/lib/perl5/ -Mlocal::lib="${{ env.NPG_LIB }}")
eval $(perl -I ${{ env.PERL_CACHE }}/lib/perl5/ -Mlocal::lib)
cpanm --quiet --notest LWP::Protocol::https
cpanm --quiet --notest https://github.com/chapmanb/vcftools-cpan/archive/v0.953.tar.gz
./scripts/install_wsi_dependencies.sh "${{ env.NPG_LIB }}" \
perl-dnap-utilities \
ml_warehouse \
npg_tracking \
npg_seq_common \
perl-irods-wrap
cpanm --installdeps --notest .
pushd npg_qc_viewer
export PERL5LIB="$PERL5LIB:../lib"
cpanm --notest --installdeps .
- name: "Log install failure"
if: ${{ failure() }}
run: |
find $HOME/.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: $HOME/.cpanm/work/*/build.log
retention-days: 5
- name: "Run tests"
run: |
conda activate "$CONDA_TEST_ENV"
conda info --envs
eval $(perl -I ${{ env.PERL_CACHE }}/lib/perl5/ -Mlocal::lib)
eval $(perl -I ${{ env.PERL_CACHE }}/lib/perl5/ -Mlocal::lib="${{ env.NPG_LIB }}")
export PATH=$HOME/.nvm/versions/node/v${{ matrix.node }}/bin:$PATH
export TEST_AUTHOR=1
export WTSI_NPG_iRODS_Test_Resource=testResc
export WTSI_NPG_iRODS_Test_IRODS_ENVIRONMENT_FILE=$HOME/.irods/irods_environment.json
perl Build.PL
./Build test --verbose
./Build install
pushd npg_qc_viewer
export PERL5LIB="$PERL5LIB:../lib"
perl Build.PL --installjsdeps
./Build
./Build test --verbose
$(npm bin)/grunt -v