diff --git a/.circleci/config.yml b/.circleci/config.yml index 0f61ac3..ac73c97 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,15 +1,24 @@ -# Use the latest 2.1 version of CircleCI pipeline process engine. -# See: https://circleci.com/docs/2.0/configuration-reference -# For a detailed guide to building and testing with clojure, read the docs: -# https://circleci.com/docs/2.0/language-clojure/ for more details version: 2.1 -# Define a job to be invoked later in a workflow. -# See: https://circleci.com/docs/2.0/configuration-reference/#jobs +workflows: + build-deploy: + jobs: + - build: + filters: + tags: + only: /.*/ + + - deploy: + requires: + - build + filters: + tags: + only: /Release-.*/ + context: + - CLOJARS_DEPLOY + jobs: build: - # Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub. - # See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor docker: # specify the version you desire here - image: clojure:openjdk-8-lein-2.9.8-bullseye @@ -26,8 +35,6 @@ jobs: # Customize the JVM maximum heap limit JVM_OPTS: -Xmx3200m - # Add steps to the job - # See: https://circleci.com/docs/2.0/configuration-reference/#steps steps: - checkout @@ -45,13 +52,82 @@ jobs: - ~/.m2 key: v1-dependencies-{{ checksum "project.clj" }} + - run: + name: Ensure No Reflection Warnings + command: "! lein check 2>&1 | grep 'Reflection warning'" + # run tests! - - run: lein test + - run: lein do clean, test -# Invoke jobs via workflows -# See: https://circleci.com/docs/2.0/configuration-reference/#workflows -workflows: - sample: # This is the name of the workflow, feel free to change it to better match your workflow. - # Inside the workflow, you define the jobs you want to run. - jobs: - - build + deploy: + docker: + # specify the version you desire here + - image: clojure:openjdk-8-lein-2.9.8-bullseye + # Specify service dependencies here if necessary + # CircleCI maintains a library of pre-built images + # documented at https://circleci.com/docs/2.0/circleci-images/ + # - image: circleci/postgres:9.4 + + working_directory: ~/repo + + environment: + LEIN_ROOT: "true" + # Customize the JVM maximum heap limit + JVM_OPTS: -Xmx3200m + + steps: + - checkout + + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "project.clj" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "project.clj" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: + name: Install babashka + command: | + curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install -o install.sh + sudo bash install.sh + rm install.sh + - run: + name: Install deployment-script + command: | + curl -s https://raw.githubusercontent.com/clj-commons/infra/main/deployment/circle-maybe-deploy.bb -o circle-maybe-deploy.bb + chmod a+x circle-maybe-deploy.bb + + - run: lein deps + + - run: + name: Setup GPG signing key + command: | + GNUPGHOME="$HOME/.gnupg" + export GNUPGHOME + mkdir -p "$GNUPGHOME" + chmod 0700 "$GNUPGHOME" + + echo "$GPG_KEY" \ + | base64 --decode --ignore-garbage \ + | gpg --batch --allow-secret-key-import --import + + gpg --keyid-format LONG --list-secret-keys + + - save_cache: + paths: + - ~/.m2 + key: v1-dependencies-{{ checksum "project.clj" }} + - run: + name: Deploy + command: | + GPG_TTY=$(tty) + export GPG_TTY + echo $GPG_TTY + ./circle-maybe-deploy.bb lein deploy clojars diff --git a/project.clj b/project.clj index 7520f89..c94ce89 100644 --- a/project.clj +++ b/project.clj @@ -12,12 +12,17 @@ ;; and limitations under the License. (defproject org.clj-commons/claypoole - "1.2.0-SNAPSHOT" + (or (System/getenv "PROJECT_VERSION") "1.2.0") :description "Claypoole: Threadpool tools for Clojure." :url "https://github.com/clj-commons/claypoole" :license {:name "Apache License Version 2.0" :url "http://www.apache.org/licenses/LICENSE-2.0" :distribution :repo} + :deploy-repositories [["clojars" {:url "https://repo.clojars.org" + :username :env/clojars_username + :password :env/clojars_password + :sign-releases true}]] + :min-lein-version "2.0.0" :source-paths ["src/clj"] :java-source-paths ["src/java"]