|
| 1 | +# Use the latest 2.1 version of CircleCI pipeline process engine. |
| 2 | +# See: https://circleci.com/docs/2.0/configuration-reference |
| 3 | +# For a detailed guide to building and testing with clojure, read the docs: |
| 4 | +# https://circleci.com/docs/2.0/language-clojure/ for more details |
| 5 | +version: 2.1 |
| 6 | + |
| 7 | +workflows: |
| 8 | + build-deploy: |
| 9 | + jobs: |
| 10 | + - build: |
| 11 | + filters: |
| 12 | + tags: |
| 13 | + only: /.*/ |
| 14 | + |
| 15 | + - deploy: |
| 16 | + requires: |
| 17 | + - build |
| 18 | + filters: |
| 19 | + tags: |
| 20 | + only: /Release-.*/ |
| 21 | + context: |
| 22 | + - CLOJARS_DEPLOY |
| 23 | + |
| 24 | +# Define a job to be invoked later in a workflow. |
| 25 | +# See: https://circleci.com/docs/2.0/configuration-reference/#jobs |
| 26 | +jobs: |
| 27 | + build: |
| 28 | + # Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub. |
| 29 | + # See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor |
| 30 | + docker: |
| 31 | + # specify the version you desire here |
| 32 | + - image: circleci/clojure:lein-2.9.5 |
| 33 | + |
| 34 | + # Specify service dependencies here if necessary |
| 35 | + # CircleCI maintains a library of pre-built images |
| 36 | + # documented at https://circleci.com/docs/2.0/circleci-images/ |
| 37 | + # - image: circleci/postgres:9.4 |
| 38 | + |
| 39 | + working_directory: ~/repo |
| 40 | + |
| 41 | + environment: |
| 42 | + LEIN_ROOT: "true" |
| 43 | + # Customize the JVM maximum heap limit |
| 44 | + JVM_OPTS: -Xmx3200m |
| 45 | + |
| 46 | + # Add steps to the job |
| 47 | + # See: https://circleci.com/docs/2.0/configuration-reference/#steps |
| 48 | + steps: |
| 49 | + - checkout |
| 50 | + |
| 51 | + # Download and cache dependencies |
| 52 | + - restore_cache: |
| 53 | + keys: |
| 54 | + - v1-dependencies-{{ checksum "project.clj" }} |
| 55 | + # fallback to using the latest cache if no exact match is found |
| 56 | + - v1-dependencies- |
| 57 | + |
| 58 | + - run: lein deps |
| 59 | + |
| 60 | + - save_cache: |
| 61 | + paths: |
| 62 | + - ~/.m2 |
| 63 | + key: v1-dependencies-{{ checksum "project.clj" }} |
| 64 | + |
| 65 | + # run tests! |
| 66 | + - run: lein test |
| 67 | + |
| 68 | + deploy: |
| 69 | + docker: |
| 70 | + # specify the version you desire here |
| 71 | + - image: circleci/clojure:openjdk-8-lein-2.9.1 |
| 72 | + # Specify service dependencies here if necessary |
| 73 | + # CircleCI maintains a library of pre-built images |
| 74 | + # documented at https://circleci.com/docs/2.0/circleci-images/ |
| 75 | + # - image: circleci/postgres:9.4 |
| 76 | + |
| 77 | + working_directory: ~/repo |
| 78 | + |
| 79 | + environment: |
| 80 | + LEIN_ROOT: "true" |
| 81 | + # Customize the JVM maximum heap limit |
| 82 | + JVM_OPTS: -Xmx3200m |
| 83 | + |
| 84 | + steps: |
| 85 | + - checkout |
| 86 | + |
| 87 | + # Download and cache dependencies |
| 88 | + - restore_cache: |
| 89 | + keys: |
| 90 | + - v1-dependencies-{{ checksum "project.clj" }} |
| 91 | + # fallback to using the latest cache if no exact match is found |
| 92 | + - v1-dependencies- |
| 93 | + |
| 94 | + # Download and cache dependencies |
| 95 | + - restore_cache: |
| 96 | + keys: |
| 97 | + - v1-dependencies-{{ checksum "project.clj" }} |
| 98 | + # fallback to using the latest cache if no exact match is found |
| 99 | + - v1-dependencies- |
| 100 | + |
| 101 | + - run: |
| 102 | + name: Install babashka |
| 103 | + command: | |
| 104 | + curl -s https://github.com/borkdude/babashka/master/install -o install.sh |
| 105 | + sudo bash install.sh |
| 106 | + rm install.sh |
| 107 | + - run: |
| 108 | + name: Install deployment-script |
| 109 | + command: | |
| 110 | + curl -s https://github.com/clj-commons/infra/main/deployment/circle-maybe-deploy.bb -o circle-maybe-deploy.bb |
| 111 | + chmod a+x circle-maybe-deploy.bb |
| 112 | + - run: lein deps |
| 113 | + |
| 114 | + - run: |
| 115 | + name: Setup GPG signing key |
| 116 | + command: | |
| 117 | + GNUPGHOME="$HOME/.gnupg" |
| 118 | + export GNUPGHOME |
| 119 | + mkdir -p "$GNUPGHOME" |
| 120 | + chmod 0700 "$GNUPGHOME" |
| 121 | + echo "$GPG_KEY" \ |
| 122 | + | base64 --decode --ignore-garbage \ |
| 123 | + | gpg --batch --allow-secret-key-import --import |
| 124 | + gpg --keyid-format LONG --list-secret-keys |
| 125 | + - save_cache: |
| 126 | + paths: |
| 127 | + - ~/.m2 |
| 128 | + key: v1-dependencies-{{ checksum "project.clj" }} |
| 129 | + - run: |
| 130 | + name: Deploy |
| 131 | + command: | |
| 132 | + GPG_TTY=$(tty) |
| 133 | + export GPG_TTY |
| 134 | + echo $GPG_TTY |
| 135 | + ./circle-maybe-deploy.bb lein deploy clojars |
0 commit comments