Skip to content

Test and configure unit test #38

Test and configure unit test

Test and configure unit test #38

Workflow file for this run

# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: unit-test
on: [pull_request]
env:
ENSEMBL_ROOT_DIR: repos
jobs:
ensembl_variation_utils:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: ''
MYSQL_ALLOW_EMPTY_PASSWORD: true
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v4
- name: wait for MySQL
run: |
while ! mysqladmin ping -h"127.0.0.1" -P3306 --silent; do
sleep 1
done
- name: load databases
run: |
mysql -h 127.0.0.1 -u root -e 'CREATE DATABASE ensembl_genome_metadata;'
mysql -h 127.0.0.1 -u root ensembl_genome_metadata < src/python/tests/variation_utils/data/ensembl_genome_metadata.dump
mysql -h 127.0.0.1 -u root -e 'CREATE DATABASE homo_sapiens_core_110_38;'
mysql -h 127.0.0.1 -u root homo_sapiens_core_110_38 < src/python/tests/variation_utils/data/homo_sapiens_core_110_38.dump
- name: pytest
run: |
pip install coverage
coverage run -m pytest
coverage lcov -o coverage.lcov
- name: Add coverage reports
if: ${{ github.event_name == 'pull_request' }}
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
bash .github/scripts/py_coverage_comment.sh coverage.lcov
vcf_prepper:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: nextflow/vcf_prepper
services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: ''
MYSQL_ALLOW_EMPTY_PASSWORD: true
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
repository: Ensembl/ensembl-vep
ref: main
path: 'nextflow/vcf_prepper/repos/ensembl-vep'
- uses: actions/checkout@v4
with:
repository: Ensembl/ensembl
ref: main
path: 'nextflow/vcf_prepper/repos/ensembl'
- uses: actions/checkout@v4
with:
repository: Ensembl/ensembl-variation
ref: main
path: 'nextflow/vcf_prepper/repos/ensembl-variation'
- uses: actions/checkout@v4
with:
repository: Ensembl/VEP_plugins
ref: main
path: 'nextflow/vcf_prepper/repos/VEP_plugins'
- uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- uses: nf-core/setup-nextflow@v1
with:
version: '24.04.3'
- name: wait for MySQL
run: |
while ! mysqladmin ping -h"127.0.0.1" -P3306 --silent; do
sleep 1
done
- name: load databases
run: |
mysql -h 127.0.0.1 -u root -e 'CREATE DATABASE ensembl_genome_metadata;'
mysql -h 127.0.0.1 -u root ensembl_genome_metadata < tests/testdata/ensembl_genome_metadata.dump
mysql -h 127.0.0.1 -u root -e 'CREATE DATABASE homo_sapiens_core_110_38;'
mysql -h 127.0.0.1 -u root homo_sapiens_core_110_38 < tests/testdata/homo_sapiens_core_110_38.dump
- name: setup tools
run: |
# install pre-requisites
sudo apt-get update
sudo apt-get install -y \
build-essential \
zlib1g-dev \
libbz2-dev \
liblzma-dev \
libcurl4-openssl-dev \
libssl-dev
# install htslib
HTSLIB_VERSION=1.19
wget -q https://github.com/samtools/htslib/releases/download/${HTSLIB_VERSION}/htslib-${HTSLIB_VERSION}.tar.bz2
tar -xjf htslib-${HTSLIB_VERSION}.tar.bz2
cd htslib-${HTSLIB_VERSION}
./configure --prefix=/usr/local
make -j$(nproc)
sudo make install
# install bcftools
BCFTOOLS_VERSION=1.19
wget https://github.com/samtools/bcftools/releases/download/${BCFTOOLS_VERSION}/bcftools-${BCFTOOLS_VERSION}.tar.bz2
tar -xjf bcftools-${BCFTOOLS_VERSION}.tar.bz2
cd bcftools-${BCFTOOLS_VERSION}
./configure --prefix=/usr/local
make -j$(nproc)
sudo make install
# install ucsc tools
wget https://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/bedToBigBed
chmod +x bedToBigBed
mv bedToBigBed /usr/local/bin
wget https://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/wigToBigWig
chmod +x wigToBigWig
mv wigToBigWig /usr/local/bin
# add to path
echo "PATH=/usr/local/bin:$PATH" >> $GITHUB_ENV
- name: setup nf-test
run: |
wget -qO- https://get.nf-test.com | bash
sudo mv nf-test /usr/local/bin/
- name: setup Python dependencies
run: |
python3 -m pip install ${GITHUB_WORKSPACE}/src/python
python3 -m pip install -r requirements.txt
- name: setup Perl dependencies
run: |
BIOPERL_VERSION=release-1-6-924
HTSLIB_VERSION=1.19
BIOHTS_VERSION=2.11
LIB_DIR=${GITHUB_WORKSPACE}/nextflow/vcf_prepper/repos/ensembl-vep/modules/
# add module path to PERL5LIB
for lib_path in ${GITHUB_WORKSPACE}/nextflow/vcf_prepper/repos/ensembl*/modules
do
PERL5LIB=${lib_path}:$PERL5LIB
done
export PERL5LIB
# install Module::Build - needed for Bio::DB::HTS
sudo apt-get update
sudo apt-get install -y cpanminus
cpanm Module::Build
# install Bioperl - needed for Bio::DB::HTS
wget https://github.com/bioperl/bioperl-live/archive/$BIOPERL_VERSION.zip
unzip $BIOPERL_VERSION.zip
rsync -r bioperl-live-$BIOPERL_VERSION/Bio ${LIB_DIR}/
# install Bio::DB::HTS
wget https://github.com/Ensembl/Bio-DB-HTS/archive/$BIOHTS_VERSION.zip
unzip $BIOHTS_VERSION.zip
cd Bio-DB-HTS-$BIOHTS_VERSION
perl Build.PL --htslib ${GITHUB_WORKSPACE}/nextflow/vcf_prepper/htslib-${HTSLIB_VERSION}
./Build
rsync -r lib/Bio ${LIB_DIR}/
rsync blib/arch/auto/Bio/DB/HTS/Faidx/Faidx.so ${LIB_DIR}/
# add PERL5LIB to env variable
echo "PERL5LIB=$PERL5LIB" >> $GITHUB_ENV
- name: setup Rust dependencies
run: |
cargo build --manifest-path ${GITHUB_WORKSPACE}/src/rust/ensembl/vcf_to_bed/Cargo.toml
cp ${GITHUB_WORKSPACE}/src/rust/ensembl/vcf_to_bed/target/debug/vcf_to_bed \
${GITHUB_WORKSPACE}/nextflow/vcf_prepper/bin/vcf_to_bed
cargo build --manifest-path ${GITHUB_WORKSPACE}/src/rust/ensembl/bed_to_wig/Cargo.toml
cp ${GITHUB_WORKSPACE}/src/rust/ensembl/bed_to_wig/target/debug/bed_to_wig \
${GITHUB_WORKSPACE}/nextflow/vcf_prepper/bin/bed_to_wig
- name: test
run: |
export ENSEMBL_ROOT_DIR=${GITHUB_WORKSPACE}/nextflow/vcf_prepper/repos
export FTP_NFS_DIR=${GITHUB_WORKSPACE}/nextflow/vcf_prepper/tests/testdata
export OLD_FTP_NFS_DIR=${GITHUB_WORKSPACE}/nextflow/vcf_prepper/tests/testdata
export PLUGIN_DATA_DIR=${GITHUB_WORKSPACE}/nextflow/vcf_prepper/modules/local/vep_config/plugins/tests/testdata
sed -i -e 's|\${BASE_DIR}|'"$GITHUB_WORKSPACE"'|g' ${GITHUB_WORKSPACE}/nextflow/vcf_prepper/tests/testdata/input_config.json
sed -i -e 's|\${BASE_DIR}|'"$GITHUB_WORKSPACE"'|g' ${GITHUB_WORKSPACE}/nextflow/vcf_prepper/subworkflows/local/run_vep/tests/testdata/test_vep_config.ini
nf-test test . \
--coverage \
--ci \
--profile github \
--changed-since HEAD^ | tee nf-test.txt
- name: Add coverage reports
if: ${{ github.event_name == 'pull_request' }}
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
bash .github/scripts/nftest_coverage_comment.sh nf-test.txt