Skip to content

Commit

Permalink
unify ci/ and hack/ under bass/
Browse files Browse the repository at this point in the history
previously, ci/ was for things "run by ci" and hack/ was for things "run
by devs". ci/ would typically prefer to start with a SHA and fetch a
reproducible input, while hack/ would always run with host paths.

with the last slew of changes it's pretty easy to unify them so they
take a `src` value on stdin, which can be easily passed with -i src=./
during dev.
  • Loading branch information
vito committed Apr 17, 2022
1 parent 6b17a73 commit 6982b2b
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 85 deletions.
8 changes: 8 additions & 0 deletions bass/actions
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bass

(defn main []
(for [{sha :sha} *stdin*]
(use (*dir*/../project))
(let [repo (project:checkout sha)]
(run (*dir*/test {:src repo}))
(run (*dir*/nix-check {:src repo})))))
13 changes: 13 additions & 0 deletions bass/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bass

(defn main []
(for [{src (:src *dir*/../)
version (:version "dev")
os (:os "linux")
arch (:arch "amd64")} *stdin*]
(use (src/project))

(log "building and smoke-testing %s" src)
(let [dist (project:build src version os arch)]
(project:smoke-test dist)
(emit dist *stdout*))))
9 changes: 9 additions & 0 deletions bass/docs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bass

(defn main []
(for [{src (:src *dir*/../)
version (:version "dev")
os (:os "linux")
arch (:arch "amd64")} *stdin*]
(use (src/project))
(emit (project:docs src) *stdout*)))
7 changes: 7 additions & 0 deletions bass/nix-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bass

(defn main testflags
(for [{src (:src *dir*/../)} *stdin*]
(use (src/project))
(log "running nix-check")
(run (project:nix-checks src))))
18 changes: 9 additions & 9 deletions ci/shipit → bass/shipit
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
(use (*dir*/../project)
(.strings))

; builds and publishes a GitHub release
;
; Needs the tag to checkout, build, and publish along with a title for the
; release.
(defn main [sha tag title]
(let [src (project:checkout sha)
release-url (create-release src sha tag title)]
(logf "release published to %s" release-url)))

; all supported os and architectures supported by bass
;
; Must be valid values to pass to GOOS / GOARCH.
Expand Down Expand Up @@ -76,12 +85,3 @@
:draft draft
:prerelease pre?
:discussion-category (if (or draft pre?) null "General"))))

; builds and publishes a GitHub release
;
; Needs the tag to checkout, build, and publish along with a title for the
; release.
(defn main [sha tag title]
(let [src (project:checkout sha)
release-url (create-release src sha tag title)]
(logf "release published to %s" release-url)))
7 changes: 7 additions & 0 deletions bass/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bass

(defn main testflags
(for [{src (:src *dir*/../)} *stdin*]
(use (src/project))
(log "running tests")
(run (project:tests src ["./..." & testflags]))))
8 changes: 0 additions & 8 deletions ci/build

This file was deleted.

11 changes: 0 additions & 11 deletions ci/check

This file was deleted.

6 changes: 0 additions & 6 deletions ci/nix-check

This file was deleted.

2 changes: 1 addition & 1 deletion ci/test
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -e -u -x

cd $(dirname $0)/..

nix develop -c ./hack/with-deps ./ci/check $GITHUB_SHA
nix develop -c ./hack/with-deps ./bass/actions -i sha=$GITHUB_SHA
4 changes: 2 additions & 2 deletions demos/godoc.bass
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
($ go list -json $pkg)))

(defn main []
(each (read (go-list "testing/...") :json)
(fn [info] (log (:Doc info)))))
(for [info (read (go-list "testing/...") :json)]
(log (:Doc info))))
5 changes: 2 additions & 3 deletions docs/scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
set -x

docs=$(dirname $0)/..
dest=$(readlink -f ${1:-$docs})

cd $docs
find $dest -maxdepth 1 -name '*.html' -delete
env DISABLE_CACHE=yep ./scripts/booklit -o $dest
find $docs -maxdepth 1 -name '*.html' -delete
env DISABLE_CACHE=yep ./scripts/booklit -o $docs
14 changes: 0 additions & 14 deletions hack/build

This file was deleted.

6 changes: 0 additions & 6 deletions hack/build-docs

This file was deleted.

6 changes: 0 additions & 6 deletions hack/fmt-notes

This file was deleted.

6 changes: 0 additions & 6 deletions hack/nix-check

This file was deleted.

9 changes: 0 additions & 9 deletions hack/test

This file was deleted.

8 changes: 4 additions & 4 deletions project.bass
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
(str "VERSION=" version)
(str "GOOS=" os)
(str "GOARCH=" arch)
"DESTDIR=./"
"DESTDIR=./dist/"
install))]
(archive src staged/./ os arch)))
(archive src staged/dist/ os arch)))

; returns a thunk with the make targets built into the output directory, as
; an overlay of src
Expand Down Expand Up @@ -108,8 +108,8 @@
(defn docs [src]
(subpath
(with-deps src
($ ./docs/scripts/build ./out/))
./out/))
($ ./docs/scripts/build))
./docs/))

; returns a thunk that will run the tests and return cover.html
(defn tests [src testflags]
Expand Down

0 comments on commit 6982b2b

Please sign in to comment.