From e7b6a365daedc9f20e91a3795e44ca3fd9148507 Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Fri, 1 Dec 2017 19:20:24 -0800 Subject: [PATCH] build pill if none yet uploaded --- .travis.yml | 37 +++++++++++++++-------- .travis/get-or-build-pill.sh | 50 ++++++++++++++++++++++++++++++++ .travis/make-pill.sh | 16 ---------- .travis/package.json | 5 +++- .travis/pin-parent-pill-pier.url | 1 + .travis/pin-parent-pill.url | 1 - .travis/test.ls | 4 +-- 7 files changed, 82 insertions(+), 32 deletions(-) create mode 100644 .travis/get-or-build-pill.sh delete mode 100644 .travis/make-pill.sh create mode 100644 .travis/pin-parent-pill-pier.url delete mode 100644 .travis/pin-parent-pill.url diff --git a/.travis.yml b/.travis.yml index 6bd122dee..b788f6ea9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,18 +8,31 @@ before_install: echo "FIXME downloaded raw urbit binary releaseinstead of .deb"; echo "FIXME read full pinned url instead of tag name" -before_script: bash make-pill.sh +before_script: bash get-or-build-pill.sh before_deploy: mkdir piers && tar cvzSf piers/zod-$TRAVIS_COMMIT.tgz zod/ deploy: - skip_cleanup: true - provider: gcs - access_key_id: GOOGW5WD4W7RF3TQ5EBM - secret_access_key: - secure: cbMrx/jloYtTiMc9b+gujrpdzmB05yHC7C2PN1dqHoe25JqwS1c8ne0jhzYOanSkJptPEjwpKeEYLyF87CStCglMJaHwsx1wAm94D8Vh6WL96pgxFbMdVRD+g2dAcSXYnSX5C0QpFrnxY8ujg9yqhItpvd+whsPYjxZahIUd5rPPS1gCP2O6hGpKFCv5++DB1RgqL5y1Hlm9efsLxsnkS7cuzrSX6o8I6Yns5pFlDDRED7Tgpp5DYYfq6ZmiIpxbuYZK+AYJKK7N2zC4RfFXstgL+M9h7joFE1r8RlzrVHLXL7+3qg8POWEEu47008ORByDCmlt5VKoMBJ3q4J4ykDKI2qmx3jw68tGIu2o5uVf6KpxtAM2IJSNZ4mOEYjs7ieR1GOrLKr7lSSYEOIShJhx7J1MMjBOaS17Ho7Uc4iNLGpH4M7DpiKwVLnjfsYiasv/1xq71ed386wLTpI5YyY/SfsNPoIbgv1IjkKIMRLl5l85tEUK10h8dxQi3mXeaP698LnQLdHdxeBKJB08hwJrl7kIOJnqZxWPBp8i7OQeIvKcu+WzMg5UIR4hR7wj7NEga/+1jjjDQeo7EHQB2Tk9dhXtTmozOGpsW49H7+VBThhhNODEYeX3CIcdOtSyjuwBLZ45HsKIhhWA00b+YyE8boBkV1yQeFh/IYCZBn7s= - bucket: ci-piers.urbit.org - local-dir: piers/ - acl: public-read - on: - repo: urbit/arvo - all_branches: true + - skip_cleanup: true + provider: gcs + access_key_id: GOOGW5WD4W7RF3TQ5EBM + secret_access_key: + secure: cbMrx/jloYtTiMc9b+gujrpdzmB05yHC7C2PN1dqHoe25JqwS1c8ne0jhzYOanSkJptPEjwpKeEYLyF87CStCglMJaHwsx1wAm94D8Vh6WL96pgxFbMdVRD+g2dAcSXYnSX5C0QpFrnxY8ujg9yqhItpvd+whsPYjxZahIUd5rPPS1gCP2O6hGpKFCv5++DB1RgqL5y1Hlm9efsLxsnkS7cuzrSX6o8I6Yns5pFlDDRED7Tgpp5DYYfq6ZmiIpxbuYZK+AYJKK7N2zC4RfFXstgL+M9h7joFE1r8RlzrVHLXL7+3qg8POWEEu47008ORByDCmlt5VKoMBJ3q4J4ykDKI2qmx3jw68tGIu2o5uVf6KpxtAM2IJSNZ4mOEYjs7ieR1GOrLKr7lSSYEOIShJhx7J1MMjBOaS17Ho7Uc4iNLGpH4M7DpiKwVLnjfsYiasv/1xq71ed386wLTpI5YyY/SfsNPoIbgv1IjkKIMRLl5l85tEUK10h8dxQi3mXeaP698LnQLdHdxeBKJB08hwJrl7kIOJnqZxWPBp8i7OQeIvKcu+WzMg5UIR4hR7wj7NEga/+1jjjDQeo7EHQB2Tk9dhXtTmozOGpsW49H7+VBThhhNODEYeX3CIcdOtSyjuwBLZ45HsKIhhWA00b+YyE8boBkV1yQeFh/IYCZBn7s= + bucket: ci-piers.urbit.org + local-dir: piers/ + acl: public-read + on: + repo: urbit/arvo + all_branches: true + # + - skip_cleanup: true + provider: gcs + access_key_id: GOOGW5WD4W7RF3TQ5EBM + secret_access_key: + secure: cbMrx/jloYtTiMc9b+gujrpdzmB05yHC7C2PN1dqHoe25JqwS1c8ne0jhzYOanSkJptPEjwpKeEYLyF87CStCglMJaHwsx1wAm94D8Vh6WL96pgxFbMdVRD+g2dAcSXYnSX5C0QpFrnxY8ujg9yqhItpvd+whsPYjxZahIUd5rPPS1gCP2O6hGpKFCv5++DB1RgqL5y1Hlm9efsLxsnkS7cuzrSX6o8I6Yns5pFlDDRED7Tgpp5DYYfq6ZmiIpxbuYZK+AYJKK7N2zC4RfFXstgL+M9h7joFE1r8RlzrVHLXL7+3qg8POWEEu47008ORByDCmlt5VKoMBJ3q4J4ykDKI2qmx3jw68tGIu2o5uVf6KpxtAM2IJSNZ4mOEYjs7ieR1GOrLKr7lSSYEOIShJhx7J1MMjBOaS17Ho7Uc4iNLGpH4M7DpiKwVLnjfsYiasv/1xq71ed386wLTpI5YyY/SfsNPoIbgv1IjkKIMRLl5l85tEUK10h8dxQi3mXeaP698LnQLdHdxeBKJB08hwJrl7kIOJnqZxWPBp8i7OQeIvKcu+WzMg5UIR4hR7wj7NEga/+1jjjDQeo7EHQB2Tk9dhXtTmozOGpsW49H7+VBThhhNODEYeX3CIcdOtSyjuwBLZ45HsKIhhWA00b+YyE8boBkV1yQeFh/IYCZBn7s= + bucket: bootstrap.urbit.org + local-dir: built-pill/ + acl: public-read + on: + condition: -d built-pill/ + repo: urbit/arvo + all_branches: true diff --git a/.travis/get-or-build-pill.sh b/.travis/get-or-build-pill.sh new file mode 100644 index 000000000..b542bd470 --- /dev/null +++ b/.travis/get-or-build-pill.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# XX use -s instead of hash pill +HASH=$(git -C .. log -1 HEAD --format="%H" -- sys/) +export PILL_NAME="git-${HASH:0:10}" + +if [ ! $PILL_FORCE ]; then + wget https://bootstrap.urbit.org/$PILL_NAME.pill -O urbit.pill && exit 0 +fi + +# if wget failed +if [ $TRAVIS_COMMIT ] && [ $TRAVIS_COMMIT != $HASH ]; then + echo Directory sys/ not modified in commit $TRAVIS_COMMIT + echo For auto-build please tag and push $HASH + exit 1 +fi + +mkdir prev +curl < pin-parent-pill-pier.url | tar xvz -C prev/ || +{ echo "FIXME not building directly from pill"; exit 1} + +lsc -e < + pty = require \pty.js + + urbit = pty.spawn './urbit' <[-FI zod prev/zod]> + .on \data -> process.stdout.write it + + on-next = (re,cb)-> + urbit.pipe (new stream-snitch re).on \match once cb + + on-next /\n(\/~|ford: )/ -> + console.log "\n\n---\nnode: detected error\n---\n\n" + set-timeout (-> process.exit 1), 1000 + + <- on-next /dojo> / + {PILL_NAME} = process.env + urbit.write "|autoload |\r" + urbit.write "|mount %\r" + <- wait-on resources: <[ prev/zod/home ]> + <- recursive-copy '../sys/' 'prev/zod/home/sys/' {+overwrite} .then + <- on-next /sync/ + urbit.write "|label %home %#PILL_NAME\r" + urbit.write ".urbit/pill +solid /==/#PILL_NAME/sys, =dub &\r" + <- wait-on resources: <[ prev/zod/.urb/put/urbit.pill ]> + urbit.write "\04" + process.exit 0 +done +cp prev/zod/.urb/put/urbit.pill urbit.pill +mkdir built-pill; cp urbit.pill built-pill/$PILL_NAME.pill diff --git a/.travis/make-pill.sh b/.travis/make-pill.sh deleted file mode 100644 index 6a5da7a7b..000000000 --- a/.travis/make-pill.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# XX use -s instead of hash pill -HASH=$(git -C .. log -1 HEAD --format="%H" -- sys/) - -echo FIXME blindly assuming master pill -wget https://bootstrap.urbit.org/$HASH-master.pill -O urbit.pill && exit 0 - -# if wget failed -if [ $TRAVIS_COMMIT ] && [ $TRAVIS_COMMIT != $HASH ]; then - echo Directory sys/ not modified in commit $TRAVIS_COMMIT - # echo For auto-build please tag and push $HASH - echo FIXME Please manually build and upload $HASH-master.pill - exit 1 -fi -echo STUB should build a pill here -exit 1 diff --git a/.travis/package.json b/.travis/package.json index 3c804ea84..57a37cc44 100644 --- a/.travis/package.json +++ b/.travis/package.json @@ -10,7 +10,10 @@ "license": "MIT", "dependencies": { "livescript": "^1.5.0", + "once": "^1.4.0", "pty.js": "^0.3.1", - "stream-snitch": "0.0.3" + "recursive-copy": "^2.0.7", + "stream-snitch": "0.0.3", + "wait-on": "^2.0.2" } } diff --git a/.travis/pin-parent-pill-pier.url b/.travis/pin-parent-pill-pier.url new file mode 100644 index 000000000..ccefa13a0 --- /dev/null +++ b/.travis/pin-parent-pill-pier.url @@ -0,0 +1 @@ +https://ci-piers.urbit.org/zod-d8eef9cc46aaf076453b996677d644798847c3e4.tgz diff --git a/.travis/pin-parent-pill.url b/.travis/pin-parent-pill.url deleted file mode 100644 index 03eb419ae..000000000 --- a/.travis/pin-parent-pill.url +++ /dev/null @@ -1 +0,0 @@ -https://github.com/ohAitch/urbit/releases/download/untagged-4dd5d7e977e58b5f1e21/urbit \ No newline at end of file diff --git a/.travis/test.ls b/.travis/test.ls index 6485147cf..dd43c9f98 100644 --- a/.travis/test.ls +++ b/.travis/test.ls @@ -13,7 +13,7 @@ urbit.pipe (new stream-snitch /dojo> /g).on \match -> console.log "\n\n---\nnode: got dojo!\n---\n\n" set-timeout (-> process.exit 0), 1000 # should probably test further -urbit.pipe (new stream-snitch /ford: /g).on \match -> +urbit.pipe (new stream-snitch /\n(\/~|ford: )/g).on \match -> return if fin fin := yes console.log "\n\n---\nnode: detected error\n---\n\n" @@ -23,4 +23,4 @@ set-timeout ... -> console.log "\n\n---\nnode: timed out after 5 min\n---" 5*60000 -process.on \exit -> urbit.write '\x04' # send EOF to gracefully checkpoint +process.on \exit -> urbit.write '\04' # send EOF to gracefully checkpoint