From ed844ed0576bdd0b26af6bdb981b92dc4478e0a0 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Sat, 25 Sep 2021 17:51:48 -0700 Subject: [PATCH] add snapshot on deploy --- .github/workflows/test-and-snapshot.yml | 48 +++++++++++++++++++++++++ .github/workflows/test.yml | 2 +- README.md | 4 ++- build.clj | 8 +++-- 4 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/test-and-snapshot.yml diff --git a/.github/workflows/test-and-snapshot.yml b/.github/workflows/test-and-snapshot.yml new file mode 100644 index 0000000..3e6f6e4 --- /dev/null +++ b/.github/workflows/test-and-snapshot.yml @@ -0,0 +1,48 @@ +name: Clojure CI + +on: [push] + +jobs: + build-and-snapshot: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '11' + cache: 'maven' + - name: Setup Clojure + uses: DeLaGuardo/setup-clojure@master + with: + tools-deps: '1.10.3.986' + - name: Run Tests + run: clojure -T:build ci :snapshot true + - name: Deploy Snapshot + run: clojure -T:build deploy :snapshot true + env: + CLOJARS_PASSWORD: ${{secrets.DEPLOY_TOKEN}} + CLOJARS_USERNAME: ${{secrets.DEPLOY_USERNAME}} + + build: + runs-on: ubuntu-latest + strategy: + matrix: + java: [ '8', '14', '15', '16', '17' ] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: ${{ matrix.java }} + cache: 'maven' + - name: Clojure CLI + uses: DeLaGuardo/setup-clojure@master + with: + tools-deps: '1.10.3.986' + - name: Run Tests + run: clojure -T:build ci + - name: Check cljdoc.edn + run: curl -fsSL https://raw.githubusercontent.com/cljdoc/cljdoc/master/script/verify-cljdoc-edn | bash -s doc/cljdoc.edn diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9d3b291..5b323f9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,6 @@ name: Clojure CI -on: [push, pull_request] +on: [pull_request] jobs: build: diff --git a/README.md b/README.md index 965ae5f..ab39606 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@ SQL as Clojure data structures. Build queries programmatically -- even at runtim [![Clojars Project](https://clojars.org/com.github.seancorfield/honeysql/latest-version.svg)](https://clojars.org/com.github.seancorfield/honeysql) [![cljdoc badge](https://cljdoc.org/badge/com.github.seancorfield/honeysql?2.0.783)](https://cljdoc.org/d/com.github.seancorfield/honeysql/CURRENT) -Once the prerelease testing is complete, this project will follow the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. +This project follows the version scheme MAJOR.MINOR.COMMITS where MAJOR and MINOR provide some relative indication of the size of the change, but do not follow semantic versioning. In general, all changes endeavor to be non-breaking (by moving to new names rather than by breaking existing names). COMMITS is an ever-increasing counter of commits since the beginning of this repository. + +> Note: every commit to the **develop** branch runs CI (GitHub Actions) and successful runs push a MAJOR.MINOR.999-SNAPSHOT build to Clojars so the very latest version of `next.jdbc` is always available either via that [snapshot on Clojars](https://clojars.org/com.github.seancorfield/honeysql) or via a git dependency on the latest SHA. HoneySQL 2.x requires Clojure 1.9 or later. diff --git a/build.clj b/build.clj index 2419962..039d4ac 100644 --- a/build.clj +++ b/build.clj @@ -17,7 +17,9 @@ [org.corfield.build :as bb])) (def lib 'com.github.seancorfield/honeysql) -(def version (format "2.0.%s" (b/git-count-revs nil))) +(defn- the-version [patch] (format "2.0.%s" patch)) +(def version (the-version (b/git-count-revs nil))) +(def snapshot (the-version "999-SNAPSHOT")) (defn eastwood "Run Eastwood." [opts] (-> opts (bb/run-task [:eastwood]))) @@ -51,7 +53,7 @@ (defn ci "Run the CI pipeline of tests (and build the JAR)." [opts] (-> opts (bb/clean) - (assoc :lib lib :version version) + (assoc :lib lib :version (if (:snapshot opts) snapshot version)) (as-> opts (reduce (fn [opts alias] (run-doc-tests (assoc opts :aliases [alias]))) @@ -68,5 +70,5 @@ (defn deploy "Deploy the JAR to Clojars." [opts] (-> opts - (assoc :lib lib :version version) + (assoc :lib lib :version (if (:snapshot opts) snapshot version)) (bb/deploy)))