-
Notifications
You must be signed in to change notification settings - Fork 335
/
Copy pathconfigure-test-env.sh
executable file
·80 lines (72 loc) · 2.26 KB
/
configure-test-env.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Check R environment ---
echo ">>>> Configuring R environment"
r_exists=$(command -v Rscript)
if [ -z $r_exists ]
then
echo "No Rscript found in PATH - Check your PATH or install R and add to PATH."
else
echo " > Restoring renv project"
Rscript -e 'renv::restore()'
echo " > Installing dev knitr and rmarkdown"
Rscript -e "install.packages('rmarkdown', repos = c('https://rstudio.r-universe.dev'))"
Rscript -e "install.packages('knitr', repos = c('https://yihui.r-universe.dev'))"
fi
# Check python test environment ---
echo ">>>> Configuring Python environment"
python_exists=$(command -v python)
if [ -z $python_exists ]
then
python_exists=$(command -v python3)
if [ -z python_exists ]
then
echo "No python found in PATH - Check your PATH or install python add to PATH."
fi
fi
if [ -n $python_exists ]
then
pipenv_exist=$(command -v pipenv)
if [ -z $pipenv_exist ]
then
echo "No pipenv found - Installing pipenv running ``pip install pipenv``..."
$python_exists -m pip install pipenv
echo "...pipenv installed"
fi
# specific for pyenv shim
[[ -n $(command -v pyenv) ]] && pyenv rehash
echo "Setting up python environnement with pipenv"
# our default is pipenv to use its own virtualenv and be in project directory
export PIPENV_IGNORE_VIRTUALENVS=1
export PIPENV_VENV_IN_PROJECT=1
pipenv install
fi
# Check Julia environment ---
echo ">>>> Configuring Julia environment"
julia_exists=$(command -v julia)
if [ -z $julia_exists ]
then
echo "No julia found in PATH - Check your PATH or install julia and add to PATH."
else
echo "Setting up Julia environment"
julia --color=yes --project=. -e 'import Pkg; Pkg.instantiate(); Pkg.build("IJulia"); Pkg.precompile()'
fi
# Update tinytex
echo ">>>> Configuring TinyTeX environment"
if [[ -z $GH_TOKEN && -n $(command -v gh) ]]
then
echo "Setting GH_TOKEN env var for Github Download."
export GH_TOKEN=$(gh auth token)
fi
if [ -n $(command -v quarto) ]
then
quarto install tinytex
fi
# Get npm in place
echo ">>>> Configuring npm for MECA testing environment"
npm_exists=$(command -v npm)
if [ -z $npm_exists ]
then
echo "No npm found - will skip any tests that require npm (e.g. JATS / MECA validation)"
else
echo "Setting up npm testing environment"
npm install -g meca
fi