From 89e356023f273dbd18419ba5306add805e0c056b Mon Sep 17 00:00:00 2001 From: Katelyn Gadd Date: Mon, 31 Aug 2015 00:36:37 -0700 Subject: [PATCH] Package restore and compilation caching work. --- .travis.yml | 6 ++++-- ci/download-asset.sh | 9 +++++++++ ci/download-compile-cache.sh | 9 --------- ci/upload-asset.sh | 11 +++++++++++ ci/upload-compile-cache.sh | 9 --------- jsil.org/ci/download.aspx.cs | 12 +++++++++--- jsil.org/ci/upload.aspx.cs | 7 ------- jsil.org/ci/web.config | 10 +++++++++- 8 files changed, 42 insertions(+), 31 deletions(-) create mode 100755 ci/download-asset.sh delete mode 100755 ci/download-compile-cache.sh create mode 100755 ci/upload-asset.sh delete mode 100755 ci/upload-compile-cache.sh diff --git a/.travis.yml b/.travis.yml index 842ae29a6..4aed2475e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,14 +8,16 @@ before_install: install: - export NODEJS=$(dirname `nvm which $NODEJS_VERSION`) + - ci/download-asset.sh packages . - nuget restore JSIL.sln + - ci/upload-asset.sh packages packages & - nuget install NUnit.Runners -Version 2.6.4 -OutputDirectory testrunner script: - xbuild /p:Configuration=Release /p:Platform=NoXna /v:m JSIL.sln - - ci/download-compile-cache.sh + - ci/download-asset.sh compilecache / - mono ./testrunner/NUnit.Runners.2.6.4/tools/nunit-console.exe ./bin/Tests.DCE.dll ./bin/SimpleTests.dll ./bin/Tests.dll --run:$TestRun --exclude:FailsOnMono\|\(FailsOnMonoWhenStubbed+Stubbed\)\|\(FailsOnMonoWhenStubbed+Translated\) - - ci/upload-compile-cache.sh + - ci/upload-asset.sh compilecache "/tmp/JSIL Tests" env: global: diff --git a/ci/download-asset.sh b/ci/download-asset.sh new file mode 100755 index 000000000..8a36f9423 --- /dev/null +++ b/ci/download-asset.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +SUBTAG=$1 +DESTDIR=$2 +ZIPFILE=/tmp/$SUBTAG.zip + +curl -s -S "jsil.org/ci/download.aspx?key=travisci&tag=$JSIL_STORAGE_TAG-$SUBTAG&password=$JSIL_STORAGE_PASSWORD" -o $ZIPFILE +unzip -q -o $ZIPFILE -d "$DESTDIR" +rm -rf "$DESTDIR/$SUBTAG/$SUBTAG" \ No newline at end of file diff --git a/ci/download-compile-cache.sh b/ci/download-compile-cache.sh deleted file mode 100755 index e0675c9d1..000000000 --- a/ci/download-compile-cache.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if curl -S "jsil.org/ci/download.aspx?key=travisci&tag=$JSIL_STORAGE_TAG&password=$JSIL_STORAGE_PASSWORD" -o "/tmp/compilecache.zip"; then - echo "Failed to download compile cache." -else - echo "Downloaded compile cache." - unzip -o "/tmp/compilecache.zip" -d /tmp/JSIL Tests/ - echo "Unpacked compile cache." -fi \ No newline at end of file diff --git a/ci/upload-asset.sh b/ci/upload-asset.sh new file mode 100755 index 000000000..d559a75c7 --- /dev/null +++ b/ci/upload-asset.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +SUBTAG=$1 +SOURCEDIR=$2 +ZIPFILE=/tmp/$SUBTAG.zip + +echo "Uploading $SUBTAG..." +rm $ZIPFILE +zip -3 -r -q $ZIPFILE "$SOURCEDIR" +curl -S -X POST "jsil.org/ci/upload.aspx?key=travisci&tag=$JSIL_STORAGE_TAG-$SUBTAG&password=$JSIL_STORAGE_PASSWORD" --data-binary "@$ZIPFILE" +echo "Done uploading $SUBTAG." \ No newline at end of file diff --git a/ci/upload-compile-cache.sh b/ci/upload-compile-cache.sh deleted file mode 100755 index e0501b5e9..000000000 --- a/ci/upload-compile-cache.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -zip -3 -r "/tmp/compilecache.zip" "/tmp/JSIL Tests/*" - -if curl -S -X POST "jsil.org/ci/upload.aspx?key=travisci&tag=$JSIL_STORAGE_TAG&password=$JSIL_STORAGE_PASSWORD" --data-binary "@/tmp/compilecache.zip"; then - echo "Failed to upload compile cache." -else - echo "Uploaded compile cache." -fi diff --git a/jsil.org/ci/download.aspx.cs b/jsil.org/ci/download.aspx.cs index 259deaeba..77f7d938e 100644 --- a/jsil.org/ci/download.aspx.cs +++ b/jsil.org/ci/download.aspx.cs @@ -5,16 +5,21 @@ public partial class DownloadPage : JSONPage { protected void Page_Load (object sender, EventArgs e) { if (Request.RequestType != "GET") { - Fail("Request must be a GET"); + Response.Clear(); + Response.StatusCode = 400; return; } string targetPath; - if (!SetupRequest(out targetPath)) + if (!SetupRequest(out targetPath)) { + Response.Clear(); + Response.StatusCode = 400; return; + } if (!File.Exists(targetPath)) { - Fail("File not found"); + Response.Clear(); + Response.StatusCode = 404; return; } @@ -22,6 +27,7 @@ protected void Page_Load (object sender, EventArgs e) { Response.StatusCode = 200; Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=\"" + Path.GetFileName(targetPath) + "\""); + Response.Buffer = false; Response.Flush(); using (var fileStream = File.OpenRead(targetPath)) diff --git a/jsil.org/ci/upload.aspx.cs b/jsil.org/ci/upload.aspx.cs index f2413924c..49c9faf48 100644 --- a/jsil.org/ci/upload.aspx.cs +++ b/jsil.org/ci/upload.aspx.cs @@ -4,13 +4,6 @@ public partial class UploadPage : JSONPage { protected void Page_Load (object sender, EventArgs e) { - /* - if (Request.RequestType != "POST") { - Fail("Request must be a POST"); - return; - } - */ - string targetPath; if (!SetupRequest(out targetPath)) return; diff --git a/jsil.org/ci/web.config b/jsil.org/ci/web.config index 205aa9929..e147e8cea 100644 --- a/jsil.org/ci/web.config +++ b/jsil.org/ci/web.config @@ -1,9 +1,17 @@ - + + + + + + + + + \ No newline at end of file