]> gitweb.factorcode.org Git - factor.git/commitdiff
cli.git: Better branch names maybe. 2009/head
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 5 Jul 2018 01:31:44 +0000 (20:31 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 5 Jul 2018 05:13:02 +0000 (00:13 -0500)
zealot: use CI_BRANCH and set it in travis.
zealot.factor: Check against HEAD
.travis.yml: Travis seems to be terminating my command after the USING:.

[[
[0K$ ./factor -run=zealot.cli-changed-vocabs
io.pathnames
vocabs.loader
cli.git
modern
modern.out
modern.paths
modern.slices
sequences.extras
web-services.github
zealot.cli-changed-vocabs
zealot.factor
zealot

travis_time:end:155cd3d8:start=1530762416088842089,finish=1530762475370504525,duration=59281662436
[0K
[32;1mThe command "./factor -run=zealot.cli-changed-vocabs" exited with 0.[0m
travis_time:start:2ac2d2d0
[0K$ {:"./factor -run=zealot.cli-changed-vocabs | while read line ; do ./factor -e=\"USING"=>"kernel tools.test vocabs.hierarchy ; \\\"$line\\\" [ load ] [ test ] bi\" ; done"}
/home/travis/.travis/job_stages: line 78: {:./factor -run=zealot.cli-changed-vocabs | while read line ; do ./factor -e="USING=: No such file or directory

travis_time:end:2ac2d2d0:start=1530762475377510994,finish=1530762475383948090,duration=6437096
[0K
[31;1mThe command "{:"./factor -run=zealot.cli-changed-vocabs | while read line ; do ./factor -e=\"USING"=>"kernel tools.test vocabs.hierarchy ; \\"$line\\" [ load ] [ test ] bi\" ; done"}" exited with 127.[0m

Done. Your build exited with 1.
]]

zealot: test on cli.
travis: Load zealot so we can use it quickly twice. Also fetch origin/master so we can ``git diff`` against it.

.travis.yml
build.sh
extra/cli/git/git.factor
extra/zealot/cli-test-changed-vocabs/authors.txt [new file with mode: 0644]
extra/zealot/cli-test-changed-vocabs/cli-test-changed-vocabs.factor [new file with mode: 0644]
extra/zealot/factor/factor.factor

index 1653d104e88d252ba31541aed0a9eafcf8c2359c..a3ee330bfde32c1476960cd52dc464f3fdf9e36c 100644 (file)
@@ -40,6 +40,13 @@ before_install:
     wget https://github.com/vmt/udis86/archive/v1.7.2.tar.gz && tar xzvf v1.7.2.tar.gz &&
     ( cd udis86-1.7.2/ && ./autogen.sh && ./configure --enable-shared=yes && make && sudo make install ) &&
     ( [[ "$TRAVIS_OS_NAME" != "osx" ]] && sudo ldconfig || true )
+  - git remote set-branches --add origin master
+  - git fetch # so we can see which vocabs changed versus origin/master...
 script:
+  - echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, TRAVIS_PULL_REQUEST_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH"
+  - export CI_BRANCH="${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}"
+  - echo "CI_BRANCH=${CI_BRANCH}"
   - DEBUG=1 ./build.sh net-bootstrap < /dev/null
-  - ./factor -run=zealot.cli-changed-vocabs | while read line ; do ./factor -e="USING: kernel tools.test vocabs.hierarchy ; \"$line\" [ load ] [ test ] bi" ; done
+  - "./factor -e='USING: memory vocabs.hierarchy ; \"zealot\" load save'"
+  - ./factor -run=zealot.cli-changed-vocabs
+  - ./factor -run=zealot.cli-test-changed-vocabs
index 7b1c5632da5cc06c95947c10c1a09e01560d6cd2..97a4a719ea766fee64c230b6028508509471254d 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -590,10 +590,10 @@ set_boot_image_vars() {
 }
 
 set_current_branch() {
-    if [ -z ${TRAVIS_BRANCH} ]; then
-        CURRENT_BRANCH=$(current_git_branch)
+    if [ -n "${CI_BRANCH}" ]; then
+        CURRENT_BRANCH="${CI_BRANCH}"
     else
-        CURRENT_BRANCH=${TRAVIS_BRANCH}
+        CURRENT_BRANCH=$(current_git_branch)
     fi
 }
 
index 2ea02a53cf678f5326d71fc7341168d04c94c02b..bfee6419ff2171e85552887f3f4b92321b4c5a2e 100644 (file)
@@ -45,8 +45,7 @@ cli-git-num-parallel [ cpus 2 * ] initialize
     ?file-info dup [ directory? ] when ;
 
 : git-current-branch* ( -- name )
-     ! { "git" "rev-parse" "--abbrev-ref" "HEAD" }
-     { "git" "name-rev" "--name-only" "HEAD" } git-command>string ;
+     { "git" "rev-parse" "--abbrev-ref" "HEAD" } git-command>string ;
 
 : git-current-branch ( directory -- name )
     [ git-current-branch* ] with-directory ;
diff --git a/extra/zealot/cli-test-changed-vocabs/authors.txt b/extra/zealot/cli-test-changed-vocabs/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/zealot/cli-test-changed-vocabs/cli-test-changed-vocabs.factor b/extra/zealot/cli-test-changed-vocabs/cli-test-changed-vocabs.factor
new file mode 100644 (file)
index 0000000..200313c
--- /dev/null
@@ -0,0 +1,13 @@
+! Copyright (C) 2018 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel sequences tools.test vocabs zealot.factor ;
+IN: zealot.cli-test-changed-vocabs
+
+: zealot-test-changed-vocabs ( -- )
+    ci-vocabs-to-test [
+        [ require ] each
+    ] [
+        [ test ] each
+    ] bi ;
+
+MAIN: zealot-test-changed-vocabs
\ No newline at end of file
index a4fc2a7e1557dc5ca42682c94fcce261d8ed3508..4382e942371d996fc690854d03a24c66bc5435e8 100644 (file)
@@ -1,11 +1,12 @@
 ! Copyright (C) 2017 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays bootstrap.image calendar cli.git
-combinators concurrency.combinators formatting fry http.client
-io io.directories io.launcher io.pathnames kernel math.parser
-memory modern.paths namespaces parser.notes prettyprint
-sequences sequences.extras sets splitting system system-info
-threads tools.test tools.test.private vocabs vocabs.hierarchy
+USING: accessors arrays bootstrap.image bootstrap.image.upload
+calendar cli.git combinators concurrency.combinators environment
+formatting fry http.client io io.directories io.launcher
+io.pathnames kernel math.parser memory modern.paths namespaces
+parser.notes prettyprint sequences sequences.extras sets
+splitting system system-info threads tools.test
+tools.test.private vocabs vocabs.hierarchy
 vocabs.hierarchy.private vocabs.loader vocabs.metadata zealot ;
 IN: zealot.factor
 
@@ -187,7 +188,7 @@ M: windows factor-path "./factor.com" ;
     [ path-separator split harvest "." join ] map members ;
 
 : changed-factor-vocabs-from-master ( -- vocabs )
-    "master" "origin/master" changed-factor-vocabs ;
+    "HEAD" "origin/master" changed-factor-vocabs ;
 
 : reject-unloadable-vocabs ( vocabs -- vocabs' )
     [ don't-load? ] reject ;