Skip to content

Instantly share code, notes, and snippets.

@akiellor
Last active March 1, 2018 02:46
Show Gist options
  • Save akiellor/110a2f32fb0e3312ea6dd7270434f3ce to your computer and use it in GitHub Desktop.
Save akiellor/110a2f32fb0e3312ea6dd7270434f3ce to your computer and use it in GitHub Desktop.
Flow performance degradation bisect scripts
FROM ubuntu
WORKDIR /data
RUN apt-get update -y
RUN apt-get install -y git opam m4
RUN yes | opam init --comp 4.03.0
RUN git clone https://github.com/facebook/flow.git /data
RUN yes | opam update
RUN yes | opam pin add -n flowtype .
RUN echo 'eval $(opam config env)' >> /root/.profile
ADD ./entrypoint /usr/bin/entrypoint
VOLUME /artifacts
ENTRYPOINT [ "/usr/bin/entrypoint" ]
CMD [ "bash" ]
#!/bin/bash
# Running this in the flow source directory, assumes a few things about the project we are running
# flow against.
set -e
REV="$(git rev-parse HEAD)"
echo $REV
if [ ! -f bin/flow-$REV ]; then
docker run -v "$(pwd)/bin:/artifacts" -i flowtype-dev bash -c "git checkout $REV; opam install --yes --deps-only flowtype; make; cp bin/flow /artifacts/flow-$REV"
fi
cp bin/flow-$REV ../<my-project>
pushd ../<my-project>
START_TIME=$SECONDS
docker-compose run --rm --no-deps --entrypoint bash <my-project> -c "./flow-$REV check"
ELAPSED_TIME=$(($SECONDS - $START_TIME))
popd
if [ "$ELAPSED_TIME" -gt "30" ]; then
echo "tooooooo slow: $ELAPSED_TIME"
exit 1
else
echo "ok: $ELAPSED_TIME"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment