summaryrefslogtreecommitdiff
path: root/Tools/CI-linux-environment.sh
blob: 3655108be024fa32216b8848f6b2b124ad892e40 (plain)
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
#!/bin/bash
# Expected to be called from elsewhere with same variables set as CI-linux-install.sh
# e.g. RETRY=travis-retry SWIGLANG=python
# Sets up environment for using various target languages
# For Github Actions where the environment is not preserved between steps
set -e # exit on failure (same as -o errexit)

case "$SWIGLANG" in
	"go")
		if [[ "$VER" ]]; then
		  eval "$($HOME/bin/gimme ${VER}.x)"
		  $HOME/bin/gimme --list
		fi
		;;
	"javascript")
		case "$ENGINE" in
			"node")
				export NVM_DIR="$HOME/.nvm"
				[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
				nvm use ${VER}
				;;
			*)      ;;
		esac
		;;
	"ruby")
		if ! command -v rvm; then
			set +x
			if [ -f /etc/profile.d/rvm.sh ] ; then
				source /etc/profile.d/rvm.sh
			elif [ -f $HOME/.rvm/scripts/rvm ] ; then
				source $HOME/.rvm/scripts/rvm
			fi
			set -x
		fi
		;;
	*)	;;
esac