-
Notifications
You must be signed in to change notification settings - Fork 45
/
Jenkinsfile
34 lines (27 loc) · 864 Bytes
/
Jenkinsfile
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
#!/usr/bin/groovy
def hasCmd(cmd) { "command -v ${cmd} >/dev/null 2>&1" }
def shell(cmd) {
def nixInitPath = '$HOME/.nix-profile/etc/profile.d/nix.sh'
sh """
if ! ${hasCmd('nix-shell')}; then
if [ -e ${nixInitPath} ]; then
. ${nixInitPath}
else
curl https://nixos.org/nix/install | sh
. ${nixInitPath}
fi
fi
${cmd}
"""
}
def nixShell(cmd) { shell """ nix-shell --run "${cmd}" """ }
node('linux') {
stage("Prerequisites") { shell """ nix-env -iA nixpkgs.git """ }
stage("Checkout") { checkout scm }
stage("Setup") { nixShell '''
bundle install
mkdir -p /tmp/sambal-temp-path
'''
}
stage("Test") { nixShell "SAMBAL_TEMP_PATH=/tmp/sambal-temp-path bundle exec rspec" }
}