CI: Added CI scripts for Pharo
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 21 Mar 2016 13:15:35 +0100
changeset 314 9ac0be200068
parent 306 8050d8d3681f
child 315 e08b96365d76
CI: Added CI scripts for Pharo ...to make Jenkins setup easier. To run CalipeL/S tests on Pharo, simply execute: wget -O "ci-pharo-common.sh" https://bitbucket.org/janvrany/jv-calipel/raw/tip/s/pharo/ci/ci-pharo-tests.sh | bash -x To run standard set ob benchmarks on Pharo, run wget -O "ci-pharo-common.sh" https://bitbucket.org/janvrany/jv-calipel/raw/tip/s/pharo/ci/ci-pharo-benchmarks.sh | bash -x
s/pharo/ci/ci-pharo-benchmark.sh
s/pharo/ci/ci-pharo-common.sh
s/pharo/ci/ci-pharo-test.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/s/pharo/ci/ci-pharo-benchmark.sh	Mon Mar 21 13:15:35 2016 +0100
@@ -0,0 +1,46 @@
+#!/bin/bash
+# 
+# a CI job to run PetitCompiler benchmarks on Pharo
+#
+set -e
+
+if [ ! -f "ci-pharo-common.sh" ]; then
+   wget -O "ci-pharo-common.sh" https://bitbucket.org/janvrany/jv-calipel/raw/tip/s/pharo/ci/ci-pharo-common.sh
+fi
+. ci-pharo-common.sh
+
+BENCHMARK_REPORT=results.json
+
+function ci_upload_benchmark_results {
+        if [ -f "$BENCHMARK_REPORT" ]; then
+                curl 'https://swing.fit.cvut.cz/calipel/imports/push-import'  \
+                    --user "$CALIPEL_USER:$CALIPEL_PASSWORD" \
+                    --compressed \
+                    -H 'Content-Type: application/json' \
+                    --data "@$BENCHMARK_REPORT"
+        fi
+}
+
+
+
+
+ci_pharo_download_pharo
+ci_pharo_download_calipel
+
+set +e
+./pharo $IMAGE benchmark --json -o results.json \
+ BenchmarkMicro \
+ BenchmarkGameSuite#benchThreadRing \
+ BenchmarkGameSuite#benchPiDigits \
+ BenchmarkGameSuite#benchNBody \
+ BenchmarkGameSuite#benchFasta \
+ BenchmarkGameSuite#benchFannkuchRedux \
+ BenchmarkGameSuite#benchBinaryTrees
+status=$?
+set -e
+
+ci_upload_benchmark_results
+
+exit $status
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/s/pharo/ci/ci-pharo-common.sh	Mon Mar 21 13:15:35 2016 +0100
@@ -0,0 +1,46 @@
+#
+# A set of functions to be used in PetitParser's Pharo CI jobs
+#
+
+# Set up some environment variables (if not set by CI)
+if [ -z "$BUILD_NUMBER" ]; then
+   BUILD_NUMBER=0
+fi
+
+IMAGE_BASE=CalipeL-S-$BUILD_NUMBER
+IMAGE=$IMAGE_BASE.image
+
+# A function to download Pharo. The version of Pharo 
+# is taken from environment variable PHARO. If it's not
+# defined, defaults to  Pharo 5.0 
+function ci_pharo_download_pharo {
+    if [ -z "$PHARO" ]; then
+        PHARO=5.0
+    fi
+
+    if [ ! -x pharo-ui ]; then
+        rm -rf pharo pharo-ui pharo-vm Pharo.image Pharo.changes
+	case "$PHARO" in 
+            5.0)
+                wget -O- get.pharo.org/50+vm | bash
+                ;;	
+            4.0)
+                wget -O- get.pharo.org/40+vm | bash
+                ;;	
+            3.0)
+                wget -O- get.pharo.org/30+vm | bash
+                ;;	
+            *)
+                echo "Unknown PHARO version: $PHARO"
+                exit 1
+        esac
+    fi
+}
+
+# A function to download Calipel and build an image
+
+function ci_pharo_download_calipel {
+    ./pharo Pharo.image save $IMAGE_BASE
+    ./pharo $IMAGE config http://smalltalkhub.com/mc/JanVrany/CalipeL-S/main ConfigurationOfCalipeLS --install=0.1
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/s/pharo/ci/ci-pharo-test.sh	Mon Mar 21 13:15:35 2016 +0100
@@ -0,0 +1,21 @@
+#!/bin/bash
+# 
+# a CI job to run CalipeL/S tests on Pharo
+#
+set -e
+
+if [ ! -f "ci-pharo-common.sh" ]; then
+    wget -O "ci-pharo-common.sh" https://bitbucket.org/janvrany/jv-calipel/raw/tip/s/pharo/ci/ci-pharo-common.sh
+fi
+. ci-pharo-common.sh
+
+
+ci_pharo_download_pharo
+ci_pharo_download_calipel
+
+rm -rf Calipel*Test.xml
+# Must turn off errexit option, Pharo return non-zero
+# status when one or more tests fail. 
+set +e
+./pharo $IMAGE test CalipeL-S-Tests --junit-xml-output
+set -e