This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
before_install.sh
70 lines (55 loc) · 2.37 KB
/
before_install.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
#!/bin/bash
# Standardize dirs
export BASE_DIR=$TRAVIS_BUILD_DIR
# Create .netrc file for GitHub authentication
echo "machine api.github.com
login RMGdev
password $GH_TOKEN" > $HOME/.netrc
# Make ok.sh executable
chmod +x ok.sh
# Parse message for travis build
# commit message of current head of RMG-tests = SHA1-ID of RMG-Py/database commit to be tested.
MESSAGE=$(git log --format=%B -n 1 HEAD)
echo "Message: "$MESSAGE
export BRANCH=$TRAVIS_BRANCH
echo "Branch: "$BRANCH
# split the message on the '-' delimiter
IFS='-' read -a msg_pieces <<< "$MESSAGE"
IFS='-' read -a branch_pieces <<< "$BRANCH"
if [ "${branch_pieces[0]}" == "rmgdb" ]; then
export RMG_TESTING_BRANCH="master"
export RMGDB_TESTING_BRANCH="${branch_pieces[1]}"
export GITHUB_STATUS_PATH="/repos/ReactionMechanismGenerator/RMG-database/statuses/${msg_pieces[1]}"
elif [ "${branch_pieces[0]}" == "rmgpy" ]; then
export RMG_TESTING_BRANCH="${branch_pieces[1]}"
export RMGDB_TESTING_BRANCH="master"
export GITHUB_STATUS_PATH="/repos/ReactionMechanismGenerator/RMG-Py/statuses/${msg_pieces[1]}"
elif [ "${branch_pieces[0]}" == "rmgpydb" ]; then
export RMG_TESTING_BRANCH="${branch_pieces[1]}"
export RMGDB_TESTING_BRANCH="${msg_pieces[2]}"
export GITHUB_STATUS_PATH="/repos/ReactionMechanismGenerator/RMG-Py/statuses/${msg_pieces[1]}"
elif [ "${branch_pieces[0]}" == "rmgdbpy" ]; then
export RMGDB_TESTING_BRANCH="${branch_pieces[1]}"
export RMG_TESTING_BRANCH="${msg_pieces[2]}"
export GITHUB_STATUS_PATH="/repos/ReactionMechanismGenerator/RMG-database/statuses/${msg_pieces[1]}"
fi
echo "RMG_TESTING_BRANCH: "$RMG_TESTING_BRANCH
echo "RMGDB_TESTING_BRANCH: "$RMGDB_TESTING_BRANCH
# Url of the Travis build page
export BUILD_URL="https://travis-ci.com/ReactionMechanismGenerator/RMG-tests/builds/$TRAVIS_BUILD_ID"
echo "GitHub URL: " $GITHUB_STATUS_PATH
echo "Build URL: " $BUILD_URL
# Update GitHub status to pending
./ok.sh _format_json \
state="pending" \
context="continuous-integration/rmg-tests" \
description="The RMG-tests build is running" \
target_url=$BUILD_URL \
| ./ok.sh _post $GITHUB_STATUS_PATH > /dev/null
# Set up anaconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash ./miniconda.sh -b -p $HOME/miniconda
source "$HOME/miniconda/etc/profile.d/conda.sh"
export PATH=$HOME/miniconda/bin:$PATH
# Update conda itself
conda update --yes conda