* Migrate `Dockerfile` to use a bullseye-based image Also, some QoL changes on the `Dockerfile`: - Parametrize GRAALVM_VERSION to make it easier to update - Remove installing programs already included on base image - Remove `deps.edn` from `.dockerignore` since it is necessary to build * Migrate CircleCI to use a bullseye-based image Also some modifications necessary to make it work: - Migrate from `circleci` images to `clojure` since they're out-of-date and also seem to be considered legacy: https://circleci.com/docs/2.0/circleci-images/#legacy-language-images - Remove unnecessary usage of `sudo`, since all commands runs as root - Sync packages with `Dockerfile`. This will make easier to test locally if everything will work (of course, it is not 100% guarantee) * Remove lsof * Remove "Install {Clojure,Leiningen}" steps Already included on the base image. * Do not change directory when downloading GraalVM * Move "Download GraalVM" to script/download-graalvm * Set GRAALVM_HOME correctly * Unbreak mac build * Revert "Set GRAALVM_HOME correctly" This reverts commit5e2a6158dc. * Set GRAALVM_HOME correctly, take 2 * Improve download-graalvm script * Re-added "Install Clojure" steps * Set amd64 as default GRAALVM_ARCH * Unbreak linux-aarch64 * Ubreak jvm * Do not change directory * Fix yaml * Fix mac/linux-aarch64 * Add missing Clojure * Fix cache * Move GraalVM installation to /tmp * Use script/install-clojure * Use /opt instead of /tmp to install GraalVM * Revert "Use /opt instead of /tmp to install GraalVM" This reverts commit3cfad03c8e. * Use CircleCI's Clojure images again * Go back to installing GraalVM on $HOME
488 lines
14 KiB
YAML
488 lines
14 KiB
YAML
# Clojure CircleCI 2.0 configuration file
|
|
#
|
|
# Check https://circleci.com/docs/2.0/language-clojure/ for more details
|
|
#
|
|
version: 2.1
|
|
jobs:
|
|
jvm:
|
|
docker:
|
|
- image: circleci/clojure:openjdk-11-lein-2.9.6-bullseye
|
|
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: circleci/clojure:openjdk-11-lein-2.9.6-bullseye
|
|
working_directory: ~/repo
|
|
environment:
|
|
LEIN_ROOT: "true"
|
|
GRAALVM_VERSION: "21.2.0"
|
|
GRAALVM_HOME: /home/circleci/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: |
|
|
sudo script/install-clojure
|
|
- 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: |
|
|
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
|
|
- ~/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: circleci/clojure:openjdk-11-lein-2.9.6-bullseye
|
|
working_directory: ~/repo
|
|
environment:
|
|
LEIN_ROOT: "true"
|
|
GRAALVM_VERSION: "21.2.0"
|
|
GRAALVM_HOME: /home/circleci/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: |
|
|
sudo script/install-clojure
|
|
- 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: |
|
|
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
|
|
- ~/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: /home/circleci/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: |
|
|
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
|
|
- ~/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: /home/circleci/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 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: |
|
|
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
|
|
- ~/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: /Users/distiller/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
|
|
- 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
|
|
- ~/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
|