# Clojure CircleCI 2.0 configuration file # # Check https://circleci.com/docs/2.0/language-clojure/ for more details # version: 2.1 jobs: jvm: docker: # specify the version you desire here - image: circleci/clojure:lein-2.9.6 working_directory: ~/repo environment: LEIN_ROOT: "true" BABASHKA_PLATFORM: linux # could be used in jar name resource_class: large steps: - checkout - run: name: "Pull Submodules" command: | git submodule init git submodule update - restore_cache: keys: - v1-dependencies-{{ checksum "project.clj" }}-{{ checksum "deps.edn" }} # fallback to using the latest cache if no exact match is found - v1-dependencies- - run: name: Install Clojure command: | sudo script/install-clojure - run: name: Run JVM tests command: | export BABASHKA_FEATURE_JDBC=true export BABASHKA_FEATURE_POSTGRESQL=true script/test script/run_lib_tests # - run: # name: Run as tools.deps dependency # command: | # .circleci/script/tools.deps - run: name: Run as lein command command: | .circleci/script/lein - run: name: Create uberjar command: | mkdir -p /tmp/release script/uberjar VERSION=$(cat resources/BABASHKA_VERSION) jar=target/babashka-$VERSION-standalone.jar cp $jar /tmp/release java -jar $jar script/reflection.clj reflection="babashka-$VERSION-reflection.json" BABASHKA_EDN=".build/bb.edn" java -jar "$jar" release-artifact "$jar" BABASHKA_EDN=".build/bb.edn" java -jar "$jar" release-artifact "$reflection" - store_artifacts: path: /tmp/release destination: release - save_cache: paths: - ~/.m2 key: v1-dependencies-{{ checksum "project.clj" }}-{{ checksum "deps.edn" }} linux: docker: - image: clojure:openjdk-11-lein-2.9.6-bullseye working_directory: ~/repo environment: LEIN_ROOT: "true" GRAALVM_VERSION: "21.2.0" GRAALVM_HOME: /opt/graalvm-ce-java11-21.2.0 BABASHKA_PLATFORM: linux # used in release script BABASHKA_TEST_ENV: native BABASHKA_XMX: "-J-Xmx6500m" resource_class: large steps: - checkout - run: name: "Pull Submodules" command: | git submodule init git submodule update - restore_cache: keys: - linux-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - run: name: Install Clojure command: | script/install-clojure - run: name: Install native dev tools command: | apt-get update apt-get -y install build-essential zlib1g-dev - run: name: Download GraalVM command: | script/install-graalvm - run: name: Build binary command: | script/uberjar script/compile no_output_timeout: 30m - run: name: Run tests command: | script/test script/run_lib_tests - run: name: Release command: | .circleci/script/release - persist_to_workspace: root: /tmp paths: - release - save_cache: paths: - ~/.m2 - /opt/graalvm-ce-java11-21.2.0 key: linux-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - store_artifacts: path: /tmp/release destination: release - run: name: Publish artifact link to Slack command: | ./bb .circleci/script/publish_artifact.clj || true linux-static: docker: - image: clojure:openjdk-11-lein-2.9.6-bullseye working_directory: ~/repo environment: LEIN_ROOT: "true" GRAALVM_VERSION: "21.2.0" GRAALVM_HOME: /opt/graalvm-ce-java11-21.2.0 BABASHKA_PLATFORM: linux # used in release script BABASHKA_TEST_ENV: native BABASHKA_STATIC: "true" BABASHKA_MUSL: "true" BABASHKA_XMX: "-J-Xmx6500m" resource_class: large steps: - checkout - attach_workspace: at: /tmp - run: name: "Pull Submodules" command: | git submodule init git submodule update # - run: # name: "Short circuit on SNAPSHOT" # command: | # VERSION=$(cat resources/BABASHKA_VERSION) # if [[ "$VERSION" == *-SNAPSHOT ]] # then # circleci task halt # fi - restore_cache: keys: - linux-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - run: name: Install Clojure command: | script/install-clojure - run: name: Install native dev tools command: | apt-get update apt-get -y install build-essential zlib1g-dev script/setup-musl - run: name: Download GraalVM command: | script/install-graalvm - run: name: Build binary command: | script/uberjar script/compile no_output_timeout: 30m - run: name: Run tests command: | script/test script/run_lib_tests - run: name: Release command: | .circleci/script/release - persist_to_workspace: root: /tmp paths: - release - save_cache: paths: - ~/.m2 - /opt/graalvm-ce-java11-21.2.0 key: linux-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - store_artifacts: path: /tmp/release destination: release - run: name: Publish artifact link to Slack command: | ./bb .circleci/script/publish_artifact.clj || true linux-aarch64: machine: enabled: true image: ubuntu-2004:202101-01 resource_class: arm.large working_directory: ~/repo environment: LEIN_ROOT: "true" GRAALVM_VERSION: "21.2.0" GRAALVM_HOME: /opt/graalvm-ce-java11-21.2.0 BABASHKA_PLATFORM: linux # used in release script BABASHKA_ARCH: aarch64 BABASHKA_TEST_ENV: native BABASHKA_XMX: "-J-Xmx6500m" steps: - checkout - run: name: "Pull Submodules" command: | git submodule init git submodule update - run: name: "Short circuit on SNAPSHOT" command: | VERSION=$(cat resources/BABASHKA_VERSION) if [[ "$VERSION" == *-SNAPSHOT ]] then circleci task halt fi - run: name: Install Clojure command: | sudo script/install-clojure - restore_cache: keys: - linux-aarch64-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - run: name: Install native dev tools command: | sudo apt-get update sudo apt-get -y install build-essential zlib1g-dev - run: name: Download GraalVM command: | sudo -E script/install-graalvm - run: name: Build binary command: | script/uberjar script/compile no_output_timeout: 30m - run: name: Run tests command: | script/test script/run_lib_tests - run: name: Release command: | .circleci/script/release - persist_to_workspace: root: /tmp paths: - release - save_cache: paths: - ~/.m2 - /opt/graalvm-ce-java11-21.2.0 key: linux-aarch64-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - store_artifacts: path: /tmp/release destination: release - run: name: Publish artifact link to Slack command: | ./bb .circleci/script/publish_artifact.clj || true linux-aarch64-static: machine: enabled: true image: ubuntu-2004:202101-01 resource_class: arm.large working_directory: ~/repo environment: LEIN_ROOT: "true" GRAALVM_VERSION: "21.2.0" GRAALVM_HOME: /opt/graalvm-ce-java11-21.2.0 BABASHKA_PLATFORM: linux # used in release script BABASHKA_ARCH: aarch64 BABASHKA_TEST_ENV: native BABASHKA_XMX: "-J-Xmx6500m" BABASHKA_STATIC: "true" steps: - checkout - run: name: "Pull Submodules" command: | git submodule init git submodule update # - run: # name: "Short circuit on SNAPSHOT" # command: | # VERSION=$(cat resources/BABASHKA_VERSION) # if [[ "$VERSION" == *-SNAPSHOT ]] # then # circleci task halt # fi - run: name: Install Clojure command: | sudo -E script/install-clojure - restore_cache: keys: - linux-aarch64-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - run: name: Install native dev tools command: | sudo apt-get update sudo apt-get -y install build-essential zlib1g-dev # sudo -E script/setup-musl - run: name: Download GraalVM command: | sudo -E script/install-graalvm - run: name: Build binary command: | script/uberjar script/compile no_output_timeout: 30m - run: name: Run tests command: | script/test script/run_lib_tests - run: name: Release command: | .circleci/script/release - persist_to_workspace: root: /tmp paths: - release - save_cache: paths: - ~/.m2 - /opt/graalvm-ce-java11-21.2.0 key: linux-aarch64-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - store_artifacts: path: /tmp/release destination: release - run: name: Publish artifact link to Slack command: | ./bb .circleci/script/publish_artifact.clj || true mac: macos: xcode: "12.0.0" environment: MACOSX_DEPLOYMENT_TARGET: 10.13 # 10.12 is EOL GRAALVM_VERSION: "21.2.0" GRAALVM_HOME: /usr/local/opt/graalvm-ce-java11-21.2.0/Contents/Home BABASHKA_PLATFORM: macos # used in release script BABASHKA_TEST_ENV: native BABASHKA_XMX: "-J-Xmx6500m" resource_class: large steps: - checkout - run: name: "Pull Submodules" command: | git submodule init git submodule update - restore_cache: keys: - mac-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - run: name: Install Clojure command: | script/install-clojure - run: name: Install Leiningen command: | script/install-leiningen - run: name: Download GraalVM command: | script/install-graalvm /usr/local/opt - run: name: Build binary command: | export PATH=$GRAALVM_HOME/bin:$PATH script/uberjar script/compile no_output_timeout: 30m - run: name: Run tests command: | export PATH=$GRAALVM_HOME/bin:$PATH script/test script/run_lib_tests - run: name: Release command: | .circleci/script/release - save_cache: paths: - ~/.m2 - /usr/local/opt/graalvm-ce-java11-21.2.0/Contents/Home key: mac-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - store_artifacts: path: /tmp/release destination: release - run: name: Publish artifact link to Slack command: | ./bb .circleci/script/publish_artifact.clj || true deploy: resource_class: large docker: - image: circleci/clojure:lein-2.9.6 working_directory: ~/repo environment: LEIN_ROOT: "true" steps: - checkout - run: name: "Pull Submodules" command: | git submodule init git submodule update - restore_cache: keys: - v1-dependencies-{{ checksum "project.clj" }} # fallback to using the latest cache if no exact match is found - v1-dependencies- - run: .circleci/script/deploy - save_cache: paths: - ~/.m2 key: v1-dependencies-{{ checksum "project.clj" }} docker: docker: - image: circleci/buildpack-deps:bullseye steps: - checkout - attach_workspace: at: /tmp - setup_remote_docker: version: 19.03.12 - run: name: Build Docker image command: .circleci/script/docker workflows: version: 2 ci: jobs: - jvm - linux - linux-static - mac - linux-aarch64 - linux-aarch64-static - deploy: filters: branches: only: master requires: - jvm - linux - mac - docker: filters: branches: only: master requires: - linux - linux-static