Skip to content

Render the website #623

Render the website

Render the website #623

# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
name: test-coverage
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Install rgdal dependencies (macOS)
if: runner.os == 'macOS'
run: brew install gdal
- name: Install ADMIXTOOLS dependencies
run: sudo apt-get install libopenblas-dev libgsl-dev liblapack-dev
- name: Compile and install ADMIXTOOLS
run: |
# create a single directory for all external software
mkdir -p ~/deps
cd ~/deps
# download and unpack the ADMIXTOOLS source code
curl -LO https://github.com/DReichLab/AdmixTools/archive/v7.0.2.tar.gz
tar xf v7.0.2.tar.gz
cd AdmixTools-7.0.2
# set compiler flags (compilation on macOS was failing unable to find
# openblas library files)
export LDFLAGS="-L/usr/local/opt/openblas/lib"
export CPPFLAGS="-I/usr/local/opt/openblas/include"
# compile ADMIXTOOLS and move binaries under bin/
cd src
make clobber
make LDLIBS="-llapack" all
make install
# download testing data for unit tests
cd ../
curl -LO https://reich.hms.harvard.edu/sites/reich.hms.harvard.edu/files/inline-files/AdmixTools_Example_Data.tar_.gz
tar xf AdmixTools_Example_Data.tar_.gz
# run the Perl script with tests for the compiled binaries
cd examples
# fix unportable Perl shebang
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "1s/.*/\#\!\/usr\/bin\/env perl -w/" mklog
else
sed -i "1s/.*/\#\!\/usr\/bin\/env perl/" mklog
fi
./mklog
cd ../
# we need to do this in bash because of $OSTYPE above
shell: bash
- name: Compile and install SLiM
run: |
# download SLiM into a separate directory to avoid CRAN errors
mkdir -p ~/deps
cd ~/deps
# installation instructions copied from the SLiM manual:
wget https://github.com/MesserLab/SLiM/releases/download/v4.1/SLiM.zip
unzip SLiM.zip
cd SLiM
cmake .
make slim
- name: Populate PATH with compiled binaries
run: |
export PATH="$HOME/deps/SLiM:$HOME/deps/AdmixTools-7.0.2/bin:$PATH"
echo "PATH=$PATH" >> ~/.Renviron
- name: Set R_LIBS path on unix
run: |
mkdir ~/R_LIBS
echo "R_LIBS_USER=~/R_LIBS" >> ~/.Renviron
- name: Setup dedicated Python environment for slendr
run: |
install.packages("reticulate", repos = "http://cran.rstudio.com")
reticulate::install_miniconda()
deps <- c("msprime==1.3.1", "tskit==0.5.6", "pyslim==1.0.4")
PYTHON_ENV <- paste0("Python-3.12_", paste(gsub("==", "-", c(deps, "tspop==0.0.2")), collapse = "_"))
reticulate::conda_create(envname = PYTHON_ENV, python_version = '3.11')
reticulate::use_condaenv(PYTHON_ENV, required = TRUE)
pip <- Sys.info()["sysname"] != "Windows"
reticulate::conda_install(envname = PYTHON_ENV, packages = deps, pip = pip)
reticulate::conda_install(envname = PYTHON_ENV, packages = c("tspop==0.0.2", "pyarrow"), pip = TRUE)
shell: Rscript {0}
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage
- name: Test coverage
run: |
covr::codecov(
token = "${{secrets.CODECOV_TOKEN}}",
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package"),
type = c("tests", "vignettes"),
function_exclusions = c("print\\.", "setup_env", "init_env", "check_env", "check_dependencies", "animate_model", "ts_draw")
)
shell: Rscript {0}
- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package