Skip to content

Commit

Permalink
Merge pull request #755 from wtsi-npg/devel
Browse files Browse the repository at this point in the history
pull from devel to master to create release 97.0.0
  • Loading branch information
jmtcsngr authored Sep 15, 2023
2 parents 451514c + 46abf6b commit a39f38f
Show file tree
Hide file tree
Showing 12 changed files with 309 additions and 221 deletions.
1 change: 1 addition & 0 deletions .github/workflows/perlbrew.sha256
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c3996e4fae37a0ae01839cdd73752fb7b17e81bac2a8b39712463a7d518c4945 perlbrew.sh
127 changes: 127 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
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"]

services:
mysql:
image: mysql:8.0
ports:
- 3306:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD: null
MYSQL_DATABASE: npgt
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=5

steps:
- uses: actions/checkout@v3

- name: Change dbhost to 127.0.0.1
run: |
sed -i s/localhost/127.0.0.1/ ${GITHUB_WORKSPACE}/data/config.ini
- name: set timezone
run: |
sudo timedatectl set-timezone Europe/London
- name: "Install OS dependencies"
run: |
sudo apt-get update
# https://github.com/actions/runner-images/issues/2139
sudo apt-get remove -y nginx libgd3
sudo apt-get install -y libgd-dev uuid-dev libgd-text-perl
- name: "Cache Perl"
id: cache-perl
uses: actions/cache@v3
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)
cpanm --quiet --notest Module::Build
cpanm --quiet --notest Alien::Tidyp
./scripts/install_wsi_dependencies.sh "$NPG_LIB" \
perl-dnap-utilities \
ml_warehouse
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@v2
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")
export TEST_AUTHOR=1
./Build dist
export DIST_FILE=$(ls npg-tracking-*.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
95 changes: 0 additions & 95 deletions .github/workflows/testing_and_building_repos.yml

This file was deleted.

12 changes: 12 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
LIST OF CHANGES

release 97.0.0
- Change CI workflow to standard file name
- Change to Perl versions from Perlbrew
- Add Perl 5.34.1 to the test matrix
- Switched the default LIMS driver in samplesheet generation from 'xml'
to 'ml_warehouse'.
- Added 'lims_driver_type' attribute to npg::samplesheet.
- Updated the tests for samplesheet generation, which are using the xml
LIMS driver, to set the driver type explicitly.
- In samplesheet generation, dropped a special case of MiSeq instruments
without a batch; last use in production was over 5 years ago.

release 96.0.0
- Fixed a regression in the npg_move_runfolder script,
which made it unusable.
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.github/workflows/testing_and_building_repos.yml
bin/event_notifications
bin/illumina_instruments_uptime
bin/npg_daemon_control
Expand Down Expand Up @@ -1468,6 +1467,5 @@ t/useragent.pm
t/util.pm
wtsi_local/httpd.conf
wtsi_local/httpd_sfweb.conf

META.yml
META.json
60 changes: 47 additions & 13 deletions lib/npg/samplesheet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use st::api::lims;
use st::api::lims::samplesheet;
use npg_tracking::util::config qw(get_config_staging_areas);
use npg_tracking::util::abs_path qw(abs_path);
use WTSI::DNAP::Warehouse::Schema;

with 'npg_tracking::glossary::run';

Expand Down Expand Up @@ -62,12 +63,25 @@ still retained in the relevant custom fields.
my$config=get_config_staging_areas();
Readonly::Scalar my $SAMPLESHEET_PATH => $config->{'samplesheets'}||q(samplesheets/);
Readonly::Scalar my $MIN_COLUMN_NUM => 3;
Readonly::Scalar my $DEFAULT_LIMS_DRIVER_TYPE => 'xml';
Readonly::Scalar my $DEFAULT_LIMS_DRIVER_TYPE => 'ml_warehouse';

##################################################################
####################### Public attributes ########################
##################################################################

=head2 lims_driver_type
LIMs driver type to use, defaults to ml_warehouse.
=cut

has 'lims_driver_type' => (
'isa' => 'Str',
'required' => 0,
'is' => 'ro',
'default' => $DEFAULT_LIMS_DRIVER_TYPE,
);

=head2 id_run
An optional attribute
Expand Down Expand Up @@ -157,6 +171,22 @@ sub _build_npg_tracking_schema {
return $s
}

=head2 mlwh_schema
DBIx schema class for ml_warehouse access.
=cut

has 'mlwh_schema' => (
'isa' => 'WTSI::DNAP::Warehouse::Schema',
'is' => 'ro',
'required' => 0,
'lazy_build' => 1,
);
sub _build_mlwh_schema {
return WTSI::DNAP::Warehouse::Schema->connect();
}

=head2 run
An attribute, DBIx object for a row in the run table of the tracking database.
Expand All @@ -180,7 +210,6 @@ An attribute, an array of st::api::lims type objects.
This attribute should normally be provided by the caller via the
constuctor. If the attribute is not provided, it it built automatically.
XML st::api::lims driver is used to access LIMS data.
=cut

Expand All @@ -191,17 +220,20 @@ has 'lims' => (
);
sub _build_lims {
my $self=shift;
my $id = $self->run->batch_id;
if ($id=~/\A\d{13}\z/smx) {
load_class 'st::api::lims::warehouse';
return [st::api::lims->new(
position => 1,
driver => st::api::lims::warehouse->new(position=>1, tube_ean13_barcode=>$id)
)];

my $ref = {driver_type => $self->lims_driver_type};
my $batch_id = $self->run->batch_id;
if ($self->lims_driver_type eq $DEFAULT_LIMS_DRIVER_TYPE) {
$ref->{'id_flowcell_lims'} = $batch_id;
$ref->{'mlwh_schema'} = $self->mlwh_schema;
} elsif ($self->lims_driver_type eq 'xml') {
$ref->{'batch_id'} = $batch_id;
} else {
croak sprintf 'Lazy-build for driver type %s is not inplemented',
$self->lims_driver_type;
}
return [st::api::lims->new(
batch_id => $id,
driver_type => $DEFAULT_LIMS_DRIVER_TYPE)->children];

return [st::api::lims->new($ref)->children];
};

=head2 output
Expand Down Expand Up @@ -592,6 +624,8 @@ __END__
=item open
=item WTSI::DNAP::Warehouse::Schema
=back
=head1 INCOMPATIBILITIES
Expand All @@ -604,7 +638,7 @@ David K. Jackson E<lt>[email protected]<gt>
=head1 LICENSE AND COPYRIGHT
Copyright (C) 2019,2020 Genome Research Ltd.
Copyright (C) 2019,2020, 2023 Genome Research Ltd.
This file is part of NPG.
Expand Down
Loading

0 comments on commit a39f38f

Please sign in to comment.