Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/configure-test-env.sh
3544 views
1
# Check R environment ---
2
3
echo ">>>> Configuring R environment"
4
r_exists=$(command -v Rscript)
5
6
if [ -z $r_exists ]
7
then
8
echo "No Rscript found in PATH - Check your PATH or install R and add to PATH."
9
else
10
echo " > Restoring renv project"
11
Rscript -e 'renv::restore()'
12
echo " > Installing dev knitr and rmarkdown"
13
Rscript -e "install.packages('rmarkdown', repos = c('https://rstudio.r-universe.dev', getOption('repos')))"
14
Rscript -e "install.packages('knitr', repos = c('https://yihui.r-universe.dev', getOption('repos')))"
15
fi
16
17
18
# Check python test environment ---
19
echo ">>>> Configuring Python environment"
20
# Prefer uv is available
21
uv_exist=$(command -v uv)
22
if [ -z $uv_exist ]
23
then
24
echo "No uv found - Install uv please: https://docs.astral.sh/uv/getting-started/installation/."
25
echo "Using 'uv' is the prefered way. You can still use python and create a .venv in the project."
26
else
27
echo "Setting up python environnement with uv"
28
# create or sync the virtual env in the project
29
uv sync --frozen
30
fi
31
32
# Check Julia environment ---
33
echo ">>>> Configuring Julia environment"
34
julia_exists=$(command -v julia)
35
if [ -z $julia_exists ]
36
then
37
echo "No julia found in PATH - Check your PATH or install julia and add to PATH."
38
else
39
echo "Setting up Julia environment"
40
if [ -z $uv_exist ]
41
then
42
uv run --frozen julia --color=yes --project=. -e 'import Pkg; Pkg.instantiate(); Pkg.build("IJulia"); Pkg.precompile()'
43
else
44
julia --color=yes --project=. -e 'import Pkg; Pkg.instantiate(); Pkg.build("IJulia"); Pkg.precompile()'
45
fi
46
fi
47
48
# Update tinytex
49
echo ">>>> Configuring TinyTeX environment"
50
if [[ -z $GH_TOKEN && -n $(command -v gh) ]]
51
then
52
echo "Setting GH_TOKEN env var for Github Download."
53
export GH_TOKEN=$(gh auth token)
54
fi
55
56
if [ -n $(command -v quarto) ]
57
then
58
quarto install tinytex
59
fi
60
61
# Get npm in place
62
echo ">>>> Configuring npm for MECA testing environment"
63
npm_exists=$(command -v npm)
64
if [ -z $npm_exists ]
65
then
66
echo "No npm found - will skip any tests that require npm (e.g. JATS / MECA validation)"
67
else
68
echo "Setting up npm testing environment"
69
npm install -g meca
70
fi
71
72
# Get npm in place
73
echo ">>>> Do you have pdftotext installed (from poppler) ?"
74
pdftotext_exists=$(command -v pdftotext)
75
if [ -z $pdftotext_exists ]
76
then
77
echo "No pdftotext found - Some tests will require it, so you may want to install it."
78
fi
79