Skip to content

Commit

Permalink
Merge pull request #2 from jesims/JESI-3840
Browse files Browse the repository at this point in the history
JESI-3840
  • Loading branch information
axrs committed Nov 23, 2020
2 parents 6c4710d + 915450d commit 3c4296c
Show file tree
Hide file tree
Showing 15 changed files with 241 additions and 633 deletions.
37 changes: 22 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
version: 2
aliases:
cache:
lein_cache: &LEIN_CACHE
key: lein-{{ checksum "project.clj" }}
lein_cache: &CACHE
key: cache-{{ .Environment.CACHE_VERSION }}-{{ .Environment.NODE_VERSION }}-{{ checksum "project.clj" }}-{{ checksum "package-lock.json" }}
paths:
- project.sh
- ~/.lein
- ~/.m2
- node_modules
containers:
docker: &DEFAULT
- image: jesiio/build-bus:latest
Expand All @@ -19,57 +19,64 @@ aliases:
run:
name: Check & Cancel Redundant Build
command: 'cancel-redundant-builds.sh'
submodule: &SUBMODULE
run: git submodule update --init --recursive
jobs:
deps:
docker: *DEFAULT
steps:
- *CANCEL_REDUNDANT
- checkout
- *SUBMODULE
- restore_cache:
<<: *LEIN_CACHE
<<: *CACHE
- run: './clojure-polyline.sh deps'
- save_cache:
<<: *LEIN_CACHE
<<: *CACHE
test_clj:
docker: *DEFAULT
steps:
- *CANCEL_REDUNDANT
- checkout
- *SUBMODULE
- restore_cache:
<<: *LEIN_CACHE
- run: './clojure-polyline.sh unit-test'
<<: *CACHE
- run: './clojure-polyline.sh test'
- save_cache:
<<: *LEIN_CACHE
<<: *CACHE
test_cljs:
docker: *DEFAULT
steps:
- *CANCEL_REDUNDANT
- checkout
- *SUBMODULE
- restore_cache:
<<: *LEIN_CACHE
- run: './clojure-polyline.sh unit-test-cljs'
<<: *CACHE
- run: './clojure-polyline.sh test-cljs'
- save_cache:
<<: *LEIN_CACHE
<<: *CACHE
snapshot:
docker: *DEFAULT
steps:
- *CANCEL_REDUNDANT
- checkout
- *SUBMODULE
- restore_cache:
<<: *LEIN_CACHE
<<: *CACHE
- run: './clojure-polyline.sh snapshot'
- save_cache:
<<: *LEIN_CACHE
<<: *CACHE
release:
docker: *DEFAULT
steps:
- *CANCEL_REDUNDANT
- checkout
- *SUBMODULE
- restore_cache:
<<: *LEIN_CACHE
<<: *CACHE
- run: './clojure-polyline.sh release'
- save_cache:
<<: *LEIN_CACHE
<<: *CACHE
workflows:
version: 2
build:
Expand Down
16 changes: 10 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
/target
/lib
/classes
/checkouts
pom.xml
*.jar
*.class
*.jar
.clj-kondo/
.idea/
.lein-deps-sum
.lein-failures
.lein-plugins
.remarkrc.js
/.shadow-cljs
/checkouts
/classes
/lib
/target
pom.xml
project.sh
tests.edn
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "bindle"]
path = bindle
url = git@github.com:jesims/bindle.git
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 0.4.2

Changed:

* Added `bindle` subproject
* Updated helper bash script
* Using `cljs.core/+` for string concatenation to avoid join calls
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.1
0.4.2
1 change: 1 addition & 0 deletions bindle
Submodule bindle added at 0f89b9
90 changes: 39 additions & 51 deletions clojure-polyline.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#!/usr/bin/env bash
cd $(realpath $(dirname $0))
# TODO: Source and load from common repository
if [ ! -f ./project.sh ]; then
echo "Downloading bash helper utilities"
curl -OL https://raw.githubusercontent.com/jesims/backpack/master/project.sh
fi
source ./project.sh
if [[ $? -ne 0 ]]; then
#shellcheck disable=2215
cd "$(realpath "$(dirname "$0")")" &&
source bindle/project.sh
if [ $? -ne 0 ];then
exit 1
fi

Expand All @@ -20,25 +16,23 @@ clean () {
## deps:
## Installs all required dependencies for Clojure and ClojureScript
deps () {
echo_message 'Installing dependencies'
lein deps
abort_on_error
-deps
}

## unit-test:
## test:
## Runs the Clojure unit tests
unit-test () {
test () {
clean
lein test
abort_on_error 'Clojure tests failed'
-test-clj "$@"
abort-on-error 'Clojure tests failed'
}

## unit-test-cljs:
## test-cljs:
## Runs the ClojureScript unit tests
unit-test-cljs () {
test-cljs () {
clean
lein node-test
abort_on_error 'ClojureScript tests failed'
-test-cljs "$@"
abort-on-error 'ClojureScript tests failed'
}

is-snapshot () {
Expand All @@ -49,49 +43,43 @@ is-snapshot () {
deploy () {
if [[ -n "$CIRCLECI" ]];then
lein deploy clojars &>/dev/null
abort_on_error
abort-on-error
else
lein deploy clojars
abort_on_error
abort-on-error
fi
}

## snapshot:
## args: [-l]
## Pushes a snapshot to Clojars
snapshot () {
if is-snapshot;then
echo_message 'SNAPSHOT suffix already defined... Aborting'
exit 1
else
version=$(cat VERSION)
snapshot="$version-SNAPSHOT"
echo ${snapshot} > VERSION
echo_message "Snapshotting $snapshot"
deploy
echo "$version" > VERSION
fi
## [-l] local
snapshot(){
-snapshot "$@"
}

## release:
## Pushes a release to Clojars
release () {
version=$(cat VERSION)
if ! is-snapshot;then
version=$(cat VERSION)
echo_message "Releasing $version"
deploy
else
echo_message 'SNAPSHOT suffix already defined... Aborting'
exit 1
fi
-release
}

if [[ "$#" -eq 0 ]] || [[ "$1" =~ ^(help|-h|--help)$ ]];then
usage
exit 1
elif [[ $(grep "^$1\ (" "$script_name") ]];then
eval $@
else
echo_error "Unknown function $1 ($script_name $@)"
exit 1
fi
deploy(){
deploy-clojars
}

deploy-snapshot(){
deploy-clojars
}

## lint:
lint () {
-lint
}

## outdated:
outdated () {
-outdated
}

script-invoke "$@"

0 comments on commit 3c4296c

Please sign in to comment.