From d6c3087c8edcd5717ce6e7b894ee159c7c682143 Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Tue, 24 Aug 2021 09:44:03 +0300 Subject: [PATCH 1/5] ci step changes --- .circleci/config.yml | 97 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 84 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8ba5fc7..cd80b2e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,24 +1,47 @@ -# Java Maven CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-java/ for more details # version: 2 -jobs: - build: - docker: - - image: circleci/openjdk:8u171-jdk - - image: redislabs/rejson:edge - port: 6379:6379 +commands: - working_directory: ~/repo + abort_for_docs: + steps: + - run: + name: Avoid tests for docs + command: | + if [[ $CIRCLE_BRANCH == *docs ]]; then + echo "Identifies as documents PR, no testing required" + circleci step halt + fi + + abort_for_noci: + steps: + - run: + name: Ignore CI for specific branches + command: | + if [[ $CIRCLE_BRANCH == *noci ]]; then + echo "Identifies as actively ignoring CI, no testing required." + circleci step halt + fi - environment: - # Customize the JVM maximum heap limit - MAVEN_OPTS: -Xmx3200m + early_return_for_forked_pull_requests: + description: >- + If this build is from a fork, stop executing the current job and return success. + This is useful to avoid steps that will fail due to missing credentials. steps: + - run: + name: Early return if this build is from a forked PR + command: | + if [[ -n "$CIRCLE_PR_NUMBER" ]]; then + echo "Nothing to do for forked PRs, so marking this step successful" + circleci step halt + fi + build_all: + steps: + - abort_for_docs + - abort_for_noci + - early_return_for_forked_pull_requests - checkout # Download and cache dependencies @@ -40,15 +63,63 @@ jobs: - run: mvn cobertura:cobertura - run: bash <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -t ${CODECOV_TOKEN} +jobs: + build: + docker: + - image: circleci/openjdk:8u171-jdk + - image: redislabs/rejson:edge + port: 6379:6379 + + working_directory: ~/repo + + environment: + # Customize the JVM maximum heap limit + MAVEN_OPTS: -Xmx3200m + + steps: + - build_all + + build-and-publish: + docker: + - image: circleci/openjdk:8u171-jdk + + environment: + # Customize the JVM maximum heap limit + MAVEN_OPTS: -Xmx3200m + + steps: + - build_all - run: mvn -s .circleci.settings.xml -DskipTests -Dgpg.skip deploy + +on-master: &on-master + filters: + branches: + only: master + tags: + ignore: /.*/ + +not-on-master: ¬-on-master + filters: + branches: + ignore: master + tags: + ignore: /.*/ + + workflows: version: 2 commit: jobs: - build: + <<: *not-on-master context: - common + - build-and-publish: + <<: *on-master + context: + - common + nightly: triggers: - schedule: From 0ed547c3cbad3ce99a84fd5ebe2c689f45bc45ea Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Tue, 24 Aug 2021 09:56:25 +0300 Subject: [PATCH 2/5] no multis in steps --- .circleci/config.yml | 52 ++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cd80b2e..e22337b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -37,7 +37,19 @@ commands: circleci step halt fi - build_all: +jobs: + build: + docker: + - image: circleci/openjdk:8u171-jdk + - image: redislabs/rejson:edge + port: 6379:6379 + + working_directory: ~/repo + + environment: + # Customize the JVM maximum heap limit + MAVEN_OPTS: -Xmx3200m + steps: - abort_for_docs - abort_for_noci @@ -63,32 +75,40 @@ commands: - run: mvn cobertura:cobertura - run: bash <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -t ${CODECOV_TOKEN} -jobs: - build: + build-and-publish: docker: - image: circleci/openjdk:8u171-jdk - - image: redislabs/rejson:edge - port: 6379:6379 - - working_directory: ~/repo environment: # Customize the JVM maximum heap limit MAVEN_OPTS: -Xmx3200m steps: - - build_all + - abort_for_docs + - abort_for_noci + - early_return_for_forked_pull_requests + - checkout - build-and-publish: - docker: - - image: circleci/openjdk:8u171-jdk + # Download and cache dependencies + - restore_cache: + keys: + - v1-dependencies-{{ checksum "pom.xml" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: mvn dependency:go-offline + + - save_cache: + paths: + - ~/.m2 + key: v1-dependencies-{{ checksum "pom.xml" }} + + # run tests! + - run: mvn integration-test + - run: mvn cobertura:cobertura + - run: bash <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -t ${CODECOV_TOKEN} - environment: - # Customize the JVM maximum heap limit - MAVEN_OPTS: -Xmx3200m - steps: - - build_all - run: mvn -s .circleci.settings.xml -DskipTests -Dgpg.skip deploy From 54299a501e90c962fae5d97977f92d6cf133129e Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Tue, 24 Aug 2021 09:59:02 +0300 Subject: [PATCH 3/5] circle version --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e22337b..248898e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,5 +1,5 @@ # -version: 2 +version: 2.1 commands: From 01aa356c67a6e3f0d203d08e785aa7643b8b813f Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Tue, 24 Aug 2021 09:59:36 +0300 Subject: [PATCH 4/5] moving to 2.1 --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 248898e..37f92d1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -42,7 +42,6 @@ jobs: docker: - image: circleci/openjdk:8u171-jdk - image: redislabs/rejson:edge - port: 6379:6379 working_directory: ~/repo From 188167c2a96da3ce63d5dc3463ff5bc1cae369ce Mon Sep 17 00:00:00 2001 From: "Chayim I. Kirshen" Date: Wed, 25 Aug 2021 16:46:31 +0300 Subject: [PATCH 5/5] moving early returns down --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 37f92d1..b47de21 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -52,7 +52,6 @@ jobs: steps: - abort_for_docs - abort_for_noci - - early_return_for_forked_pull_requests - checkout # Download and cache dependencies @@ -71,6 +70,7 @@ jobs: # run tests! - run: mvn integration-test + - early_return_for_forked_pull_requests - run: mvn cobertura:cobertura - run: bash <(curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov) -t ${CODECOV_TOKEN} @@ -85,7 +85,6 @@ jobs: steps: - abort_for_docs - abort_for_noci - - early_return_for_forked_pull_requests - checkout # Download and cache dependencies