Skip to content

Commit cbd82bf

Browse files
committed
Merge pull request #1302 from xzyfer/fix/custom-sass-spec
Better configurable sass-spec environment for CI
2 parents 321b874 + 0f4bed8 commit cbd82bf

File tree

4 files changed

+51
-26
lines changed

4 files changed

+51
-26
lines changed

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ env:
2323
- AUTOTOOLS=no COVERAGE=yes BUILD=static
2424
- AUTOTOOLS=yes COVERAGE=no BUILD=shared
2525

26-
global:
27-
- SASS_SPEC_REPO=https://github.com/sass/sass-spec.git
28-
- SASS_SPEC_REPO_GITLOC=master
29-
3026
# currenty there are various issues when
3127
# built with coverage, clang and autotools
3228
# - AUTOTOOLS=yes COVERAGE=yes BUILD=shared

script/bootstrap

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
script/branding
44

55
if [ ! -d "sass-spec" ]; then
6-
if [ -z "$SASS_SPEC_REPO" ]; then
7-
SASS_SPEC_REPO=https://github.com/sass/sass-spec.git
8-
fi
9-
git clone $SASS_SPEC_REPO
6+
git clone https://github.com/sass/sass-spec.git
107
fi
118
if [ ! -d "sassc" ]; then
129
git clone https://github.com/sass/sassc.git

script/ci-build-libsass

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,55 @@ echo successfully compiled libsass
7474
echo AUTOTOOLS=$AUTOTOOLS COVERAGE=$COVERAGE BUILD=$BUILD
7575

7676
if [ "x$PREFIX" == "x" ]; then
77-
if [ "x$TRAVIS_BUILD_DIR" == "x" ]; then
78-
PREFIX=/usr/local
79-
else
80-
PREFIX=$TRAVIS_BUILD_DIR
81-
fi
77+
if [ "x$TRAVIS_BUILD_DIR" == "x" ]; then
78+
PREFIX=/usr/local
79+
else
80+
PREFIX=$TRAVIS_BUILD_DIR
81+
fi
8282
fi
8383

84-
LD_LIBRARY_PATH="$PREFIX/lib/" script/spec
84+
if [ "$CONTINUOUS_INTEGRATION" == "true" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_OS_NAME" == "linux" ];
85+
then
86+
echo "Downloading jq"
87+
88+
curl http://stedolan.github.io/jq/download/linux64/jq > jq
89+
chmod +x jq
90+
91+
echo "Fetching PR $TRAVIS_PULL_REQUEST"
92+
93+
JSON=$(curl -u xzyfer:882aeec2a5b847b7d67c61d7788c2721f011e2ea -sS https://api.github.com/repos/sass/libsass/pulls/$TRAVIS_PULL_REQUEST)
94+
95+
SPEC_PR=$(echo $JSON | jq -r .body)
96+
97+
BLAH="sass\/sass-spec(#|\/pull\/)([0-9]+)"
98+
99+
if [[ $SPEC_PR =~ $BLAH ]];
100+
then
101+
SPEC_PR="${BASH_REMATCH[2]}"
102+
103+
echo "Fetching Sass Spec PR $SPEC_PR"
104+
105+
JSON=$(curl -u xzyfer:882aeec2a5b847b7d67c61d7788c2721f011e2ea -sS https://api.github.com/repos/sass/sass-spec/pulls/$SPEC_PR)
106+
107+
SPEC_REMOTE=$(echo $JSON | jq -r .head.repo.clone_url)
108+
SPEC_SHA=$(echo $JSON | jq -r .head.sha)
109+
110+
echo "Cloning $SPEC_REMOTE"
111+
112+
git clone $SPEC_REMOTE sass-spec-pr
113+
114+
echo "Checking out $SPEC_SHA"
115+
116+
cd sass-spec-pr
117+
git checkout $SPEC_SHA
118+
119+
echo "Re-running Sass Spec"
120+
121+
cd ..
122+
SASS_SPEC_PATH="sass-spec-pr" LD_LIBRARY_PATH="$PREFIX/lib/" make $MAKE_OPTS test_build
123+
else
124+
LD_LIBRARY_PATH="$PREFIX/lib/" script/spec
125+
fi
126+
else
127+
LD_LIBRARY_PATH="$PREFIX/lib/" script/spec
128+
fi

script/spec

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,4 @@
22

33
script/bootstrap
44

5-
SASS_SPEC_REPO_GITLOC ?= master
6-
7-
if [ -z "$SASS_SPEC_REPO_GITLOC" ]; then
8-
SASS_SPEC_REPO_GITLOC=master
9-
fi
10-
11-
echo "======================================================================"
12-
echo "Checking out sass-spec @ $SASS_SPEC_REPO_GITLOC"
13-
echo "======================================================================"
14-
15-
(cd $SASS_SPEC_PATH; git checkout $SASS_SPEC_REPO_GITLOC)
16-
175
make $MAKE_OPTS test_build

0 commit comments

Comments
 (0)