Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Aug 29, 2024
1 parent 4b45c7f commit c1f8a7b
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 5 deletions.
8 changes: 4 additions & 4 deletions bin/create_sys_image
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -eu
#!/bin/bash
update=false
if [[ $# -gt 0 ]]; then
if [[ $1 != "--update" ]]; then
Expand Down Expand Up @@ -64,9 +64,9 @@ if [[ $update == true ]]; then
if test -f "Manifest.toml"; then
mv Manifest.toml Manifest.toml.bak
fi
julia --startup-file=no --pkgimages=no --project -e "using Pkg; Pkg.instantiate(); Pkg.add(\"PyCall\"); Pkg.build(\"PyCall\")"
julia --startup-file=no --pkgimages=no --project -e "using TestEnv; TestEnv.activate(); using ControlPlots"
julia --startup-file=no --pkgimages=no --project -e "using Pkg; Pkg.update()"
julia --startup-file=no --pkgimages=no --project -e "using Pkg; Pkg.instantiate(); Pkg.add(\"PyCall\"); Pkg.build(\"PyCall\")" || true
julia --startup-file=no --pkgimages=no --project -e "using TestEnv; TestEnv.activate(); Pkg.add(\"Conda\"); using Conda; Conda.add(\"matplotlib\"); using ControlPlots" || true
julia --startup-file=no --pkgimages=no --project -e "using Pkg; Pkg.update()" || true
julia --startup-file=no --pkgimages=no --project -e "include(\"./test/update_packages.jl\");"
else
if [[ $julia_major == "1.9" ]]; then
Expand Down
69 changes: 69 additions & 0 deletions bin/create_sys_image_
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
update=false
if [[ $# -gt 0 ]]; then
if [[ $1 != "--update" ]]; then
echo "Invalid parameter! Use:"
echo "./create_sys_image"
echo "or"
echo "./create_sys_image --update"
exit 1
else
update=true
fi
fi

if [[ $(basename $(pwd)) == "bin" ]]; then
cd ..
fi

PYTHON_PATH=$(which python3)
if [ -x "$PYTHON_PATH" ]; then
echo "Python is found at $PYTHON_PATH"
if $PYTHON_PATH -c "import matplotlib" &> /dev/null; then
echo "Matplotlib found. Using existing installation."
export PYTHON=$PYTHON_PATH
else
echo "Matplotlib is not found."
read -p "Do you want to install matplotlib with Conda? (y/n): " choice
case "$choice" in
y|Y )
export PYTHON=""
;;
n|N )
echo "Exiting without installing matplotlib."
exit 1
;;
* )
echo "Invalid choice. Exiting."
exit 1
;;
esac
fi
else
echo "Python is not found."
exit 1
fi

julia_version=$(julia --version | awk '{print($3)}')
julia_major=${julia_version:0:3}
if [[ $julia_major == "1.1" ]]; then
julia_major=${julia_version:0:4}
fi
if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1 ; then
branch=$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g')
else
branch=""
fi
if test -f "kps-image-${julia_major}-${branch}.so"; then
mv bin/kps-image-${julia_major}-${branch}.so kps-image-${julia_major}-${branch}.so.bak
fi
julia --startup-file=no -e "using Pkg; Pkg.add(\"TestEnv\")"

echo "Updating packages..."
if test -f "Manifest.toml"; then
mv Manifest.toml Manifest.toml.bak
fi
julia --startup-file=no --pkgimages=no --project -e "using Pkg; Pkg.instantiate(); Pkg.add(\"PyCall\"); Pkg.build(\"PyCall\")" || true
julia --startup-file=no --pkgimages=no --project -e "using TestEnv; TestEnv.activate(); Pkg.add(\"Conda\"); using Conda; Conda.add(\"matplotlib\"); using ControlPlots" || true
julia --startup-file=no --pkgimages=no --project -e "using Pkg; Pkg.update()" || true
julia --startup-file=no --pkgimages=no --project -e "include(\"./test/create_sys_image.jl\");"
2 changes: 1 addition & 1 deletion test/test_installation
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ cd /tmp/test
export JULIA_DEPOT_PATH=/tmp/testdepot
git clone https://github.com/ufechner7/KiteModels.jl.git
cd KiteModels.jl/bin
./create_sys_image --update
./create_sys_image_ --update

0 comments on commit c1f8a7b

Please sign in to comment.