Skip to content

Commit 0f4bed8

Browse files
committed
Improve user defined sass spec runs for GitHub PRs
From now on if you have a link to a sass-spec PR well run against that PR in CI. We'll also continue to run against sass-spec master for the time being until we have confidence in this approach.
1 parent 49760f2 commit 0f4bed8

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

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

0 commit comments

Comments
 (0)