From 49db73ed779fc7737669b56d86c6408e16a1e014 Mon Sep 17 00:00:00 2001 From: KDr2 Date: Tue, 18 Jun 2019 09:51:31 +0800 Subject: [PATCH 01/11] run benchmark on Travis --- .travis.yml | 199 +++++++++++++++++++------------------ scripts/benchmark-on-ci.sh | 54 ++++++++++ 2 files changed, 157 insertions(+), 96 deletions(-) create mode 100755 scripts/benchmark-on-ci.sh diff --git a/.travis.yml b/.travis.yml index 9afc7549cc..3ac5ae93a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,106 +8,113 @@ jobs: - env: STAGE=numerical - env: STAGE=stan - env: STAGE=dynamichmc + - env: STAGE=benchmark include: - - stage: test - os: linux - julia: 1.0 - env: STAGE=test - script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'using Pkg; - Pkg.test("Turing"; coverage=true)' - - stage: test - os: linux - julia: 1.1 - env: STAGE=test - script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'using Pkg; - Pkg.test("Turing"; coverage=true)' - - stage: numerical - allow_failures: true - julia: 1.0 - os: linux - env: STAGE=numerical - script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'using Pkg; - Pkg.test("Turing"; coverage=true)' - - stage: numerical - allow_failures: true - julia: 1.1 - os: linux - env: STAGE=numerical - script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'using Pkg; - Pkg.test("Turing"; coverage=true)' - - stage: test - julia: 1.0 - if: branch = master - os: osx - env: STAGE=test - script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'using Pkg; - Pkg.test("Turing"; coverage=true)' - - stage: test - julia: 1.1 - if: branch = master - os: osx - env: STAGE=test - script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'using Pkg; - Pkg.test("Turing"; coverage=true)' - - stage: stan - allow_failures: true - os: linux - julia: 1.0 - env: STAGE=stan - script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'using Pkg; - Pkg.test("Turing"; coverage=true)' - - stage: stan - allow_failures: true - os: linux - julia: 1.1 - env: STAGE=stan - script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'using Pkg; - Pkg.test("Turing"; coverage=true)' - - stage: dynamichmc - allow_failures: true - os: linux - julia: 1.0 - env: STAGE=dynamichmc - script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'using Pkg; - Pkg.test("Turing"; coverage=true)' - - stage: dynamichmc - allow_failures: true - os: linux - julia: 1.1 - env: STAGE=dynamichmc - script: - - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'using Pkg; - Pkg.test("Turing"; coverage=true)' - - stage: documentation +# - stage: test +# os: linux +# julia: 1.0 +# env: STAGE=test +# script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'using Pkg; +# Pkg.test("Turing"; coverage=true)' +# - stage: test +# os: linux +# julia: 1.1 +# env: STAGE=test +# script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'using Pkg; +# Pkg.test("Turing"; coverage=true)' +# - stage: numerical +# allow_failures: true +# julia: 1.0 +# os: linux +# env: STAGE=numerical +# script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'using Pkg; +# Pkg.test("Turing"; coverage=true)' +# - stage: numerical +# allow_failures: true +# julia: 1.1 +# os: linux +# env: STAGE=numerical +# script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'using Pkg; +# Pkg.test("Turing"; coverage=true)' +# - stage: test +# julia: 1.0 +# if: branch = master +# os: osx +# env: STAGE=test +# script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'using Pkg; +# Pkg.test("Turing"; coverage=true)' +# - stage: test +# julia: 1.1 +# if: branch = master +# os: osx +# env: STAGE=test +# script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'using Pkg; +# Pkg.test("Turing"; coverage=true)' +# - stage: stan +# allow_failures: true +# os: linux +# julia: 1.0 +# env: STAGE=stan +# script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'using Pkg; +# Pkg.test("Turing"; coverage=true)' +# - stage: stan +# allow_failures: true +# os: linux +# julia: 1.1 +# env: STAGE=stan +# script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'using Pkg; +# Pkg.test("Turing"; coverage=true)' +# - stage: dynamichmc +# allow_failures: true +# os: linux +# julia: 1.0 +# env: STAGE=dynamichmc +# script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'using Pkg; +# Pkg.test("Turing"; coverage=true)' +# - stage: dynamichmc +# allow_failures: true +# os: linux +# julia: 1.1 +# env: STAGE=dynamichmc +# script: +# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi +# - julia --check-bounds=yes -e 'using Pkg; +# Pkg.test("Turing"; coverage=true)' +# - stage: documentation +# julia: 1.1 +# os: linux +# if: branch = master +# env: STAGE=documentation +# script: +# - julia -e 'using Pkg; Pkg.update();' +# - julia -e 'using Pkg; Pkg.add("Documenter"), Pkg.add("DocumenterMarkdown"), Pkg.add("DynamicHMC")' +# - julia -e 'using Pkg, Turing; +# cd(joinpath(dirname(pathof(Turing)), "..")); +# include(joinpath("docs", "make.jl"))' + - stage: benchmark julia: 1.1 os: linux - if: branch = master - env: STAGE=documentation + env: STAGE=benchmark script: - - julia -e 'using Pkg; Pkg.update();' - - julia -e 'using Pkg; Pkg.add("Documenter"), Pkg.add("DocumenterMarkdown"), Pkg.add("DynamicHMC")' - - julia -e 'using Pkg, Turing; - cd(joinpath(dirname(pathof(Turing)), "..")); - include(joinpath("docs", "make.jl"))' + - ./scripts/benchmark-on-ci.sh after_success: - julia -e 'if get(ENV, "STAGE", "") == "test" using Pkg; cd(Pkg.dir("Turing")); Pkg.add("Coverage"); diff --git a/scripts/benchmark-on-ci.sh b/scripts/benchmark-on-ci.sh new file mode 100755 index 0000000000..aadd7acf0d --- /dev/null +++ b/scripts/benchmark-on-ci.sh @@ -0,0 +1,54 @@ +#!/bin/bash +set -v + +BASE_BRANCH=master + +if [[ $TRAVIS == true ]]; then + if [[ $TRAVIS_PULL_REQUEST == true ]]; then + CURRENT_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH + else + CURRENT_BRANCH=$TRAVIS_BRANCH + fi +else + CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +fi + +COMMIT_MSG=$(git show -s --format="%s") + +if [[ $COMMIT_MSG != *"[bm]"* ]]; then + echo "skipping the benchmark jobs." + # exit 0 +fi + +git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' +git fetch --all --unshallow + +git clone https://github.com/TuringLang/TuringBenchmarks.git ../TuringBenchmarks +git -C ../TuringBenchmarks checkout -b travis-ci origin/travis-ci + +unset JULIA_PROJECT +cat > pre.jl < run.jl < Date: Thu, 20 Jun 2019 11:00:40 +0800 Subject: [PATCH 02/11] send bm report from Travis --- scripts/benchmark-on-ci.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/benchmark-on-ci.sh b/scripts/benchmark-on-ci.sh index aadd7acf0d..02af61cb9b 100755 --- a/scripts/benchmark-on-ci.sh +++ b/scripts/benchmark-on-ci.sh @@ -15,6 +15,10 @@ fi COMMIT_MSG=$(git show -s --format="%s") +SANTI_BR_NAME=$(echo $CURRENT_BRANCH | sed 's/\W/_/g') +COMMIT_SHA=$(git rev-parse HEAD) +BM_JOB_NAME="BMCI-${SANTI_BR_NAME}-${COMMIT_SHA:0:7}" + if [[ $COMMIT_MSG != *"[bm]"* ]]; then echo "skipping the benchmark jobs." # exit 0 @@ -44,10 +48,7 @@ julia pre.jl cat > run.jl < Date: Thu, 20 Jun 2019 15:07:17 +0800 Subject: [PATCH 03/11] append date string to job name --- scripts/benchmark-on-ci.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/benchmark-on-ci.sh b/scripts/benchmark-on-ci.sh index 02af61cb9b..812bc6f044 100755 --- a/scripts/benchmark-on-ci.sh +++ b/scripts/benchmark-on-ci.sh @@ -6,6 +6,7 @@ BASE_BRANCH=master if [[ $TRAVIS == true ]]; then if [[ $TRAVIS_PULL_REQUEST == true ]]; then CURRENT_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH + exit 0 # avoid double run on commit and PR else CURRENT_BRANCH=$TRAVIS_BRANCH fi @@ -17,7 +18,8 @@ COMMIT_MSG=$(git show -s --format="%s") SANTI_BR_NAME=$(echo $CURRENT_BRANCH | sed 's/\W/_/g') COMMIT_SHA=$(git rev-parse HEAD) -BM_JOB_NAME="BMCI-${SANTI_BR_NAME}-${COMMIT_SHA:0:7}" +TIME=$(date +%Y%m%d%H%M%S) +BM_JOB_NAME="BMCI-${SANTI_BR_NAME}-${COMMIT_SHA:0:7}-${TIME}" if [[ $COMMIT_MSG != *"[bm]"* ]]; then echo "skipping the benchmark jobs." @@ -28,6 +30,7 @@ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' git fetch --all --unshallow git clone https://github.com/TuringLang/TuringBenchmarks.git ../TuringBenchmarks +# TEMP: use travis-ci branch of TuringBenchmarks git -C ../TuringBenchmarks checkout -b travis-ci origin/travis-ci unset JULIA_PROJECT From 77f34f74db716d35447726bf0c2e8f840818bf8b Mon Sep 17 00:00:00 2001 From: KDr2 Date: Thu, 20 Jun 2019 15:27:48 +0800 Subject: [PATCH 04/11] recover ci jobs --- .travis.yml | 198 ++++++++++++++++++++++++++-------------------------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3ac5ae93a8..041f5f3e35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,105 +10,105 @@ jobs: - env: STAGE=dynamichmc - env: STAGE=benchmark include: -# - stage: test -# os: linux -# julia: 1.0 -# env: STAGE=test -# script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia --check-bounds=yes -e 'using Pkg; -# Pkg.test("Turing"; coverage=true)' -# - stage: test -# os: linux -# julia: 1.1 -# env: STAGE=test -# script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia --check-bounds=yes -e 'using Pkg; -# Pkg.test("Turing"; coverage=true)' -# - stage: numerical -# allow_failures: true -# julia: 1.0 -# os: linux -# env: STAGE=numerical -# script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia --check-bounds=yes -e 'using Pkg; -# Pkg.test("Turing"; coverage=true)' -# - stage: numerical -# allow_failures: true -# julia: 1.1 -# os: linux -# env: STAGE=numerical -# script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia --check-bounds=yes -e 'using Pkg; -# Pkg.test("Turing"; coverage=true)' -# - stage: test -# julia: 1.0 -# if: branch = master -# os: osx -# env: STAGE=test -# script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia --check-bounds=yes -e 'using Pkg; -# Pkg.test("Turing"; coverage=true)' -# - stage: test -# julia: 1.1 -# if: branch = master -# os: osx -# env: STAGE=test -# script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia --check-bounds=yes -e 'using Pkg; -# Pkg.test("Turing"; coverage=true)' -# - stage: stan -# allow_failures: true -# os: linux -# julia: 1.0 -# env: STAGE=stan -# script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia --check-bounds=yes -e 'using Pkg; -# Pkg.test("Turing"; coverage=true)' -# - stage: stan -# allow_failures: true -# os: linux -# julia: 1.1 -# env: STAGE=stan -# script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia --check-bounds=yes -e 'using Pkg; -# Pkg.test("Turing"; coverage=true)' -# - stage: dynamichmc -# allow_failures: true -# os: linux -# julia: 1.0 -# env: STAGE=dynamichmc -# script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia --check-bounds=yes -e 'using Pkg; -# Pkg.test("Turing"; coverage=true)' -# - stage: dynamichmc -# allow_failures: true -# os: linux -# julia: 1.1 -# env: STAGE=dynamichmc -# script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia --check-bounds=yes -e 'using Pkg; -# Pkg.test("Turing"; coverage=true)' -# - stage: documentation -# julia: 1.1 -# os: linux -# if: branch = master -# env: STAGE=documentation -# script: -# - julia -e 'using Pkg; Pkg.update();' -# - julia -e 'using Pkg; Pkg.add("Documenter"), Pkg.add("DocumenterMarkdown"), Pkg.add("DynamicHMC")' -# - julia -e 'using Pkg, Turing; -# cd(joinpath(dirname(pathof(Turing)), "..")); -# include(joinpath("docs", "make.jl"))' + - stage: test + os: linux + julia: 1.0 + env: STAGE=test + script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - julia --check-bounds=yes -e 'using Pkg; + Pkg.test("Turing"; coverage=true)' + - stage: test + os: linux + julia: 1.1 + env: STAGE=test + script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - julia --check-bounds=yes -e 'using Pkg; + Pkg.test("Turing"; coverage=true)' + - stage: numerical + allow_failures: true + julia: 1.0 + os: linux + env: STAGE=numerical + script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - julia --check-bounds=yes -e 'using Pkg; + Pkg.test("Turing"; coverage=true)' + - stage: numerical + allow_failures: true + julia: 1.1 + os: linux + env: STAGE=numerical + script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - julia --check-bounds=yes -e 'using Pkg; + Pkg.test("Turing"; coverage=true)' + - stage: test + julia: 1.0 + if: branch = master + os: osx + env: STAGE=test + script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - julia --check-bounds=yes -e 'using Pkg; + Pkg.test("Turing"; coverage=true)' + - stage: test + julia: 1.1 + if: branch = master + os: osx + env: STAGE=test + script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - julia --check-bounds=yes -e 'using Pkg; + Pkg.test("Turing"; coverage=true)' + - stage: stan + allow_failures: true + os: linux + julia: 1.0 + env: STAGE=stan + script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - julia --check-bounds=yes -e 'using Pkg; + Pkg.test("Turing"; coverage=true)' + - stage: stan + allow_failures: true + os: linux + julia: 1.1 + env: STAGE=stan + script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - julia --check-bounds=yes -e 'using Pkg; + Pkg.test("Turing"; coverage=true)' + - stage: dynamichmc + allow_failures: true + os: linux + julia: 1.0 + env: STAGE=dynamichmc + script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - julia --check-bounds=yes -e 'using Pkg; + Pkg.test("Turing"; coverage=true)' + - stage: dynamichmc + allow_failures: true + os: linux + julia: 1.1 + env: STAGE=dynamichmc + script: + - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi + - julia --check-bounds=yes -e 'using Pkg; + Pkg.test("Turing"; coverage=true)' + - stage: documentation + julia: 1.1 + os: linux + if: branch = master + env: STAGE=documentation + script: + - julia -e 'using Pkg; Pkg.update();' + - julia -e 'using Pkg; Pkg.add("Documenter"), Pkg.add("DocumenterMarkdown"), Pkg.add("DynamicHMC")' + - julia -e 'using Pkg, Turing; + cd(joinpath(dirname(pathof(Turing)), "..")); + include(joinpath("docs", "make.jl"))' - stage: benchmark julia: 1.1 os: linux From 0824f07ae66d8466a076f33bb08b54a49a46eb3b Mon Sep 17 00:00:00 2001 From: KDr2 Date: Fri, 21 Jun 2019 06:29:07 +0800 Subject: [PATCH 05/11] rename script --- .travis.yml | 2 +- scripts/{benchmark-on-ci.sh => run-benchmarks-on-travis.sh} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename scripts/{benchmark-on-ci.sh => run-benchmarks-on-travis.sh} (100%) diff --git a/.travis.yml b/.travis.yml index 041f5f3e35..ef50e5249c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -114,7 +114,7 @@ jobs: os: linux env: STAGE=benchmark script: - - ./scripts/benchmark-on-ci.sh + - ./scripts/run-benchmarks-on-travis.sh after_success: - julia -e 'if get(ENV, "STAGE", "") == "test" using Pkg; cd(Pkg.dir("Turing")); Pkg.add("Coverage"); diff --git a/scripts/benchmark-on-ci.sh b/scripts/run-benchmarks-on-travis.sh similarity index 100% rename from scripts/benchmark-on-ci.sh rename to scripts/run-benchmarks-on-travis.sh From 3ea402d86ab78f389cf425d0f50dd3cb1deddaf5 Mon Sep 17 00:00:00 2001 From: KDr2 Date: Mon, 24 Jun 2019 09:22:57 +0800 Subject: [PATCH 06/11] [bm] use master branch of TuringBenchmarks --- scripts/run-benchmarks-on-travis.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/run-benchmarks-on-travis.sh b/scripts/run-benchmarks-on-travis.sh index 812bc6f044..22ab33b035 100755 --- a/scripts/run-benchmarks-on-travis.sh +++ b/scripts/run-benchmarks-on-travis.sh @@ -23,15 +23,15 @@ BM_JOB_NAME="BMCI-${SANTI_BR_NAME}-${COMMIT_SHA:0:7}-${TIME}" if [[ $COMMIT_MSG != *"[bm]"* ]]; then echo "skipping the benchmark jobs." - # exit 0 + exit 0 fi git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' git fetch --all --unshallow git clone https://github.com/TuringLang/TuringBenchmarks.git ../TuringBenchmarks -# TEMP: use travis-ci branch of TuringBenchmarks -git -C ../TuringBenchmarks checkout -b travis-ci origin/travis-ci +# Notice: uncomment the following line to use travis-ci branch of TuringBenchmarks +# git -C ../TuringBenchmarks checkout -b travis-ci origin/travis-ci unset JULIA_PROJECT cat > pre.jl < Date: Mon, 24 Jun 2019 14:58:14 +0800 Subject: [PATCH 07/11] translate bash script to jl code --- .travis.yml | 2 +- scripts/run-benchmarks-on-travis.jl | 45 +++++++++++++++++++++++++++++ scripts/run-benchmarks-on-travis.sh | 15 +++++----- 3 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 scripts/run-benchmarks-on-travis.jl diff --git a/.travis.yml b/.travis.yml index ef50e5249c..26f620ff25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -114,7 +114,7 @@ jobs: os: linux env: STAGE=benchmark script: - - ./scripts/run-benchmarks-on-travis.sh + - julia ./scripts/run-benchmarks-on-travis.jl after_success: - julia -e 'if get(ENV, "STAGE", "") == "test" using Pkg; cd(Pkg.dir("Turing")); Pkg.add("Coverage"); diff --git a/scripts/run-benchmarks-on-travis.jl b/scripts/run-benchmarks-on-travis.jl new file mode 100644 index 0000000000..0febe413e3 --- /dev/null +++ b/scripts/run-benchmarks-on-travis.jl @@ -0,0 +1,45 @@ +using Dates + +BASE_BRANCH = "master" +CURRENT_BRANCH = strip(read(`git rev-parse --abbrev-ref HEAD`, String)) + +if get(ENV, "TRAVIS", "false") == "true" + if get(ENV, "TRAVIS_PULL_REQUEST", "false") == "true" + CURRENT_BRANCH = get(ENV, "TRAVIS_PULL_REQUEST_BRANCH") + exit(0) + else + CURRENT_BRANCH = get(ENV, "TRAVIS_BRANCH", "master") + end +end + +SANTI_BR_NAME = 0 +COMMIT_SHA = strip(read(`git rev-parse HEAD`, String)) +COMMIT_SHA_7 = COMMIT_SHA[1:7] +TIME = Dates.format(now(), "YYYYmmddHHMM") +BM_JOB_NAME="BMCI-$(SANTI_BR_NAME)-$(COMMIT_SHA_7)-$(TIME)" + +run(`git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'`) +run(`git fetch --all --unshallow`) + +run(`git clone https://github.com/TuringLang/TuringBenchmarks.git ../TuringBenchmarks`) + +delete!(ENV, "JULIA_PROJECT") + +code_pre = """using Pkg +# Pkg.instantiate() +try pkg"develop ." catch end +try pkg"develop ." catch end +try pkg"build Turing" catch end +using Turing +try pkg"develop ../TuringBenchmarks" catch end +try pkg"develop ../TuringBenchmarks" catch end +pkg"add SpecialFunctions" +using TuringBenchmarks +""" + +code_run = """using TuringBenchmarks.Runner +Runner.run_bm_on_travis("$BM_JOB_NAME", ("master", "$CURRENT_BRANCH"), "$COMMIT_SHA") +""" + +run(`julia -e $code_pre`) +run(`julia -e $code_run`) diff --git a/scripts/run-benchmarks-on-travis.sh b/scripts/run-benchmarks-on-travis.sh index 22ab33b035..69d55a03d1 100755 --- a/scripts/run-benchmarks-on-travis.sh +++ b/scripts/run-benchmarks-on-travis.sh @@ -13,23 +13,24 @@ if [[ $TRAVIS == true ]]; then else CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) fi - -COMMIT_MSG=$(git show -s --format="%s") SANTI_BR_NAME=$(echo $CURRENT_BRANCH | sed 's/\W/_/g') -COMMIT_SHA=$(git rev-parse HEAD) +COMMIT_SHA=$(git rev-parse HEAD) TIME=$(date +%Y%m%d%H%M%S) BM_JOB_NAME="BMCI-${SANTI_BR_NAME}-${COMMIT_SHA:0:7}-${TIME}" -if [[ $COMMIT_MSG != *"[bm]"* ]]; then - echo "skipping the benchmark jobs." - exit 0 -fi +# Run benchmarks by default, so the following lines are commented out +# COMMIT_MSG=$(git show -s --format="%s") +# if [[ $COMMIT_MSG != *"[bm]"* ]]; then +# echo "skipping the benchmark jobs." +# exit 0 +# fi git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' git fetch --all --unshallow git clone https://github.com/TuringLang/TuringBenchmarks.git ../TuringBenchmarks + # Notice: uncomment the following line to use travis-ci branch of TuringBenchmarks # git -C ../TuringBenchmarks checkout -b travis-ci origin/travis-ci From 5e0598bb17c18d57e0de32eb2c187e60b29d9937 Mon Sep 17 00:00:00 2001 From: Hong Ge Date: Mon, 24 Jun 2019 12:10:43 +0100 Subject: [PATCH 08/11] Delete run-benchmarks-on-travis.sh --- scripts/run-benchmarks-on-travis.sh | 59 ----------------------------- 1 file changed, 59 deletions(-) delete mode 100755 scripts/run-benchmarks-on-travis.sh diff --git a/scripts/run-benchmarks-on-travis.sh b/scripts/run-benchmarks-on-travis.sh deleted file mode 100755 index 69d55a03d1..0000000000 --- a/scripts/run-benchmarks-on-travis.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -set -v - -BASE_BRANCH=master - -if [[ $TRAVIS == true ]]; then - if [[ $TRAVIS_PULL_REQUEST == true ]]; then - CURRENT_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH - exit 0 # avoid double run on commit and PR - else - CURRENT_BRANCH=$TRAVIS_BRANCH - fi -else - CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) -fi - -SANTI_BR_NAME=$(echo $CURRENT_BRANCH | sed 's/\W/_/g') -COMMIT_SHA=$(git rev-parse HEAD) -TIME=$(date +%Y%m%d%H%M%S) -BM_JOB_NAME="BMCI-${SANTI_BR_NAME}-${COMMIT_SHA:0:7}-${TIME}" - -# Run benchmarks by default, so the following lines are commented out -# COMMIT_MSG=$(git show -s --format="%s") -# if [[ $COMMIT_MSG != *"[bm]"* ]]; then -# echo "skipping the benchmark jobs." -# exit 0 -# fi - -git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*' -git fetch --all --unshallow - -git clone https://github.com/TuringLang/TuringBenchmarks.git ../TuringBenchmarks - -# Notice: uncomment the following line to use travis-ci branch of TuringBenchmarks -# git -C ../TuringBenchmarks checkout -b travis-ci origin/travis-ci - -unset JULIA_PROJECT -cat > pre.jl < run.jl < Date: Mon, 24 Jun 2019 12:11:43 +0100 Subject: [PATCH 09/11] Rename scripts/run-benchmarks-on-travis.jl to benchmarks/runbenchmarks.jl --- .../run-benchmarks-on-travis.jl => benchmarks/runbenchmarks.jl | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/run-benchmarks-on-travis.jl => benchmarks/runbenchmarks.jl (100%) diff --git a/scripts/run-benchmarks-on-travis.jl b/benchmarks/runbenchmarks.jl similarity index 100% rename from scripts/run-benchmarks-on-travis.jl rename to benchmarks/runbenchmarks.jl From 6062c5b5360ed10bcdade5ec84a53c255d7ecc29 Mon Sep 17 00:00:00 2001 From: Hong Ge Date: Mon, 24 Jun 2019 12:12:31 +0100 Subject: [PATCH 10/11] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 26f620ff25..e858547931 100644 --- a/.travis.yml +++ b/.travis.yml @@ -114,7 +114,7 @@ jobs: os: linux env: STAGE=benchmark script: - - julia ./scripts/run-benchmarks-on-travis.jl + - julia ./benchmark/runbenchmarks.jl after_success: - julia -e 'if get(ENV, "STAGE", "") == "test" using Pkg; cd(Pkg.dir("Turing")); Pkg.add("Coverage"); From 29b5738dc6978331baeb4a9c86a2c62cc62b1f75 Mon Sep 17 00:00:00 2001 From: Hong Ge Date: Mon, 24 Jun 2019 14:16:15 +0100 Subject: [PATCH 11/11] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e858547931..4caef482eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -114,7 +114,7 @@ jobs: os: linux env: STAGE=benchmark script: - - julia ./benchmark/runbenchmarks.jl + - julia ./benchmarks/runbenchmarks.jl after_success: - julia -e 'if get(ENV, "STAGE", "") == "test" using Pkg; cd(Pkg.dir("Turing")); Pkg.add("Coverage");