diff --git a/build-and-benchmark-py-project.sh b/build-and-benchmark-py-project.sh new file mode 100644 index 0000000000000000000000000000000000000000..5997df579be9dd560bdf75c918aa524635ffd0e2 --- /dev/null +++ b/build-and-benchmark-py-project.sh @@ -0,0 +1,46 @@ +curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-py-project-within-miniconda.sh +source build-py-project-within-miniconda.sh + +pip install asv + +conda list + +PY_EXE=python + +if [[ ! -z "$PROJECT" ]]; then + echo "PROJECT env var not set" + exit 1 +fi + +mkdir -p ~/.$PROJECT/asv + +if [[ ! -z "$CI" ]]; then + if [[ "$CI_PROJECT_NAMESPACE" == "inducer" ]]; then + ln -s ~/.$PROJECT/asv .asv + else + # Copy, so that the original folder is not changed. + cp -r ~/.$PROJECT/asv .asv + fi +fi + +asv machine --yes +asv setup --verbose +master_commit=`git rev-parse master` +test_commit=`git rev-parse HEAD` + +export PYOPENCL_CTX=port + +asv run $master_commit...$master_commit~ --skip-existing --verbose +asv run $test_commit...$test_commit~ --skip-existing --verbose + +output=`asv compare $master_commit $test_commit --factor 1 -s` +echo "$output" + +if [[ "$output" = *"worse"* ]]; then + echo "Some of the benchmarks have gotten worse" + exit 1 +fi + +if [[ "$CI_PROJECT_NAMESPACE" == "inducer" ]]; then + asv publish --html-dir ~/.scicomp-benchmarks/asv/$PROJECT +fi diff --git a/build-and-test-py-project-within-miniconda.sh b/build-and-test-py-project-within-miniconda.sh index 770b64acd3a3fa52103599fc86bde706c839ba6c..0f4c0fd96539e6c46472e00475db5aec4abaa892 100644 --- a/build-and-test-py-project-within-miniconda.sh +++ b/build-and-test-py-project-within-miniconda.sh @@ -1,62 +1,14 @@ #! /bin/bash -echo "-----------------------------------------------" -echo "Current directory: $(pwd)" -echo "Conda environment file: ${CONDA_ENVIRONMENT}" -echo "Extra pip requirements: ${REQUIREMENTS_TXT}" -echo "Extra pytest options: ${PYTEST_ADDOPTS}" -echo "PYOPENCL_TEST: ${PYOPENCL_TEST}" -echo "PYTEST_ADDOPTS: ${PYTEST_ADDOPTS}" -echo "git revision: $(git rev-parse --short HEAD)" -echo "git status:" -git status -s -echo "-----------------------------------------------" - -if [ "$(uname)" = "Darwin" ]; then - PLATFORM=MacOSX -else - PLATFORM=Linux -fi - -# {{{ download and install - -MINICONDA_VERSION=3 -MINICONDA_INSTALL_DIR=.miniconda${MINICONDA_VERSION} - -MINICONDA_INSTALL_SH=Miniconda${MINICONDA_VERSION}-latest-${PLATFORM}-x86_64.sh -curl -O "https://repo.continuum.io/miniconda/$MINICONDA_INSTALL_SH" - -rm -Rf "$MINICONDA_INSTALL_DIR" - -bash "$MINICONDA_INSTALL_SH" -b -p "$MINICONDA_INSTALL_DIR" - -# }}} - -# {{{ set up testing environment - -PATH="$MINICONDA_INSTALL_DIR/bin/:$PATH" conda update conda --yes --quiet - -PATH="$MINICONDA_INSTALL_DIR/bin/:$PATH" conda update --all --yes --quiet - -PATH="$MINICONDA_INSTALL_DIR/bin:$PATH" conda env create --quiet --file "$CONDA_ENVIRONMENT" --name testing - -source "$MINICONDA_INSTALL_DIR/bin/activate" testing - -if test -f "$REQUIREMENTS_TXT"; then - conda install --quiet --yes pip - pip install -r "$REQUIREMENTS_TXT" -fi +curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-py-project-within-miniconda.sh +source build-py-project-within-miniconda.sh conda install --quiet --yes pytest -# }}} +conda list PY_EXE=python -${PY_EXE} setup.py install - -conda list - TESTABLES="" if [ -d test ]; then cd test diff --git a/build-py-project-within-miniconda.sh b/build-py-project-within-miniconda.sh new file mode 100644 index 0000000000000000000000000000000000000000..2934dcbe5c4776de2a3fbdaa3a4f1cb34874c6a1 --- /dev/null +++ b/build-py-project-within-miniconda.sh @@ -0,0 +1,56 @@ +#! /bin/bash + +echo "-----------------------------------------------" +echo "Current directory: $(pwd)" +echo "Conda environment file: ${CONDA_ENVIRONMENT}" +echo "Extra pip requirements: ${REQUIREMENTS_TXT}" +echo "Extra pytest options: ${PYTEST_ADDOPTS}" +echo "PYOPENCL_TEST: ${PYOPENCL_TEST}" +echo "PYTEST_ADDOPTS: ${PYTEST_ADDOPTS}" +echo "git revision: $(git rev-parse --short HEAD)" +echo "git status:" +git status -s +echo "-----------------------------------------------" + +if [ "$(uname)" = "Darwin" ]; then + PLATFORM=MacOSX +else + PLATFORM=Linux +fi + +# {{{ download and install + +MINICONDA_VERSION=3 +MINICONDA_INSTALL_DIR=.miniconda${MINICONDA_VERSION} + +MINICONDA_INSTALL_SH=Miniconda${MINICONDA_VERSION}-latest-${PLATFORM}-x86_64.sh +curl -O "https://repo.continuum.io/miniconda/$MINICONDA_INSTALL_SH" + +rm -Rf "$MINICONDA_INSTALL_DIR" + +bash "$MINICONDA_INSTALL_SH" -b -p "$MINICONDA_INSTALL_DIR" + +# }}} + +# {{{ set up testing environment + +PATH="$MINICONDA_INSTALL_DIR/bin/:$PATH" conda update conda --yes --quiet + +PATH="$MINICONDA_INSTALL_DIR/bin/:$PATH" conda update --all --yes --quiet + +PATH="$MINICONDA_INSTALL_DIR/bin:$PATH" conda env create --quiet --file "$CONDA_ENVIRONMENT" --name testing + +source "$MINICONDA_INSTALL_DIR/bin/activate" testing + +if test -f "$REQUIREMENTS_TXT"; then + conda install --quiet --yes pip + pip install -r "$REQUIREMENTS_TXT" +fi + +# }}} + +PY_EXE=python + +${PY_EXE} setup.py install + +conda list