From 9fd97284ea553e7fefc82a50e1fd92efac015630 Mon Sep 17 00:00:00 2001 From: Oleksandr Yakushev Date: Mon, 28 Apr 2025 13:58:34 +0300 Subject: [PATCH 1/5] [ci] Update linters --- .circleci/config.yml | 35 +++++++++++++++-------------------- Makefile | 6 +----- project.clj | 16 +++++++--------- 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8fb1d5013..ebb6ed5af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,17 +93,26 @@ jobs: lint: description: | Running linters - parameters: - steps: - type: steps - executor: jdk21 + executor: jdk24 environment: CLOJURE_VERSION: "1.12" steps: - checkout - with_cache: - cache_version: "lint_v3_1.12" - steps: << parameters.steps >> + cache_version: "lint_v4" + steps: + - run: + name: Running cljfmt + command: | + make cljfmt + - run: + name: Running clj-kondo + command: | + make kondo + - run: + name: Running Eastwood + command: | + make eastwood deploy: # JDK 8 is preferred for deployments (https://github.com/benedekfazekas/mranderson/issues/57) @@ -173,20 +182,6 @@ workflows: jdk_version: [jdk8, jdk11, jdk17, jdk21, jdk24] <<: *run_always - lint: - steps: - - run: - name: Running cljfmt - command: | - make cljfmt - # TODO: use `make kondo` instead once there's a fix for https://github.com/clj-kondo/clj-kondo/issues/2189 - - run: - name: Running clj-kondo - command: | - make light-kondo - - run: - name: Running Eastwood - command: | - make eastwood <<: *run_always - deploy: requires: diff --git a/Makefile b/Makefile index 9d2a4ed3a..e7b90fdc5 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: test quick-test eastwood cljfmt cljfmt-fix install fast-install smoketest deploy clean detect_timeout lint light-kondo docs test_impl +.PHONY: test quick-test eastwood cljfmt cljfmt-fix install fast-install smoketest deploy clean detect_timeout lint docs test_impl .DEFAULT_GOAL := quick-test # Set bash instead of sh for the @if [[ conditions, @@ -62,10 +62,6 @@ cljfmt-fix: kondo: .make_kondo_prep clean CIDER_NO_MRANDERSON="true" CIDER_NO_PEDANTIC="true" lein with-profile -user,-dev,+test,+clj-kondo,+deploy,+$(CLOJURE_VERSION) clj-kondo -# A variation that does not analyze the classpath, as it OOMs otherwise on CircleCI. -light-kondo: clean - CIDER_NO_MRANDERSON="true" CIDER_NO_PEDANTIC="true" lein with-profile -user,-dev,+test,+clj-kondo,+deploy,+$(CLOJURE_VERSION) clj-kondo - lint: kondo cljfmt eastwood # PROJECT_VERSION=x.y.z make install diff --git a/project.clj b/project.clj index 19c2ddf2a..50d9fbbe7 100644 --- a/project.clj +++ b/project.clj @@ -137,18 +137,16 @@ cider.nrepl/wrap-xref]}}] :cljfmt [:test - {:plugins [[lein-cljfmt "0.9.2"]] - :cljfmt {:indents {as-> [[:inner 0]] - delay [[:inner 0]] - timing [[:inner 0]] - with-debug-bindings [[:inner 0]] - merge-meta [[:inner 0]] - try-if-let [[:block 1]]}}}] + {:plugins [[dev.weavejester/lein-cljfmt "0.13.1"]] + :cljfmt {:extra-indents {timing [[:inner 0]] + with-debug-bindings [[:inner 0]] + merge-meta [[:inner 0]] + try-if-let [[:block 1]]}}}] - :clj-kondo {:plugins [[com.github.clj-kondo/lein-clj-kondo "2023.09.07"]]} + :clj-kondo {:plugins [[com.github.clj-kondo/lein-clj-kondo "2025.04.07"]]} :eastwood [:test - {:plugins [[jonase/eastwood "1.4.0"]] + {:plugins [[jonase/eastwood "1.4.3"]] :eastwood {:config-files ["eastwood.clj"] :exclude-namespaces [cider.nrepl.middleware.test-filter-tests cider.tasks]}}] From 1b82ce94f18baaed5ee735053f502d5cd9e32d8b Mon Sep 17 00:00:00 2001 From: Oleksandr Yakushev Date: Mon, 28 Apr 2025 14:15:53 +0300 Subject: [PATCH 2/5] [ci] Replace deploy-release script with make task --- .circleci/config.yml | 3 +-- .circleci/deploy/deploy_release.clj | 39 ----------------------------- Makefile | 8 +++++- project.clj | 11 +------- resources/cider/nrepl/version.edn | 2 +- 5 files changed, 10 insertions(+), 53 deletions(-) delete mode 100644 .circleci/deploy/deploy_release.clj diff --git a/.circleci/config.yml b/.circleci/config.yml index ebb6ed5af..91102ed52 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -125,8 +125,7 @@ jobs: - checkout - run: name: Deploy - command: | - lein with-profile -user,+deploy run -m deploy-release make deploy + command: make deploy test: description: | diff --git a/.circleci/deploy/deploy_release.clj b/.circleci/deploy/deploy_release.clj deleted file mode 100644 index 9217bbc75..000000000 --- a/.circleci/deploy/deploy_release.clj +++ /dev/null @@ -1,39 +0,0 @@ -(ns deploy-release - (:require - [clojure.java.io :as io] - [clojure.java.shell :refer [sh]] - [clojure.string :as str])) - -(def release-marker "v") - -(defn make-version [tag] - (str/replace-first tag release-marker "")) - -(defn log-result [m] - (println m) - m) - -(defn -main [& _] - (let [tag (System/getenv "CIRCLE_TAG")] - (if-not tag - (do - (println "No CIRCLE_TAG found.") - (System/exit 1)) - (if-not (re-find (re-pattern release-marker) tag) - (do - (println (format "The `%s` marker was not found in %s." release-marker tag)) - (System/exit 1)) - (let [version (make-version tag) - version-file (io/file "resources" "cider" "nrepl" "version.edn")] - (assert (.exists version-file)) - (spit version-file (pr-str version)) - (apply println "Executing" *command-line-args*) - (->> [:env (-> {} - (into (System/getenv)) - (assoc "PROJECT_VERSION" version) - (dissoc "CLASSPATH"))] - (into (vec *command-line-args*)) - (apply sh) - log-result - :exit - (System/exit))))))) diff --git a/Makefile b/Makefile index e7b90fdc5..a80387297 100644 --- a/Makefile +++ b/Makefile @@ -88,8 +88,14 @@ detect_timeout: # Deployment is performed via CI by creating a git tag prefixed with "v". # Please do not deploy locally as it skips various measures (particularly around mranderson). deploy: check-env target/srcdeps + @if ! echo "$(CIRCLE_TAG)" | grep -q "^v"; then \ + echo "[Error] CIRCLE_TAG $(CIRCLE_TAG) must start with 'v'."; \ + exit 1; \ + fi rm -f .no-mranderson - lein with-profile -user,+$(CLOJURE_VERSION),+plugin.mranderson/config deploy clojars + export PROJECT_VERSION=$$(echo "$(CIRCLE_TAG)" | sed 's/^v//'); \ + echo "$$PROJECT_VERSION" > resources/cider/nrepl/version.edn + lein with-profile -user,-dev,-provided,+$(CLOJURE_VERSION),+plugin.mranderson/config deploy clojars check-env: ifndef CLOJARS_USERNAME diff --git a/project.clj b/project.clj index 50d9fbbe7..6c1ba8efe 100644 --- a/project.clj +++ b/project.clj @@ -76,13 +76,6 @@ ~(clojure.java.io/as-relative-path (clojure.java.io/file "doc" "modules" "ROOT" "pages" "nrepl-api" "ops.adoc"))]} - :release-tasks [["vcs" "assert-committed"] - ["bump-version" "release"] - ["vcs" "commit" "Release %s"] - ["vcs" "tag" "v" "--no-sign"] - ["bump-version"] - ["vcs" "commit" "Begin %s"]] - :deploy-repositories [["clojars" {:url "https://clojars.org/repo" :username :env/clojars_username :password :env/clojars_password @@ -148,6 +141,4 @@ :eastwood [:test {:plugins [[jonase/eastwood "1.4.3"]] :eastwood {:config-files ["eastwood.clj"] - :exclude-namespaces [cider.nrepl.middleware.test-filter-tests cider.tasks]}}] - - :deploy {:source-paths [".circleci/deploy"]}}) + :exclude-namespaces [cider.nrepl.middleware.test-filter-tests cider.tasks]}}]}) diff --git a/resources/cider/nrepl/version.edn b/resources/cider/nrepl/version.edn index 4e5f3236d..5e42891f3 100644 --- a/resources/cider/nrepl/version.edn +++ b/resources/cider/nrepl/version.edn @@ -1,3 +1,3 @@ -;; This file is automatically overwriten from .circleci/deploy/deploy_release.clj, +;; This file is automatically overwriten by `make deploy` job ;; whenever we perform a deployment. "0.0.0" From 42881545d48155efa114a15ad2769a340f4360c8 Mon Sep 17 00:00:00 2001 From: Oleksandr Yakushev Date: Mon, 28 Apr 2025 14:37:02 +0300 Subject: [PATCH 3/5] [ci] Split testing jobs into quick and full tests --- .circleci/config.yml | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 91102ed52..99240b31f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -129,7 +129,30 @@ jobs: test: description: | - Run tests against given version of JDK and Clojure + Run quick tests against given version of JDK and Clojure without inlining dependencies + parameters: + jdk_version: + description: Version of JDK to test against + type: string + clojure_version: + description: Version of Clojure to test against + type: string + executor: << parameters.jdk_version >> + environment: + CLOJURE_VERSION: << parameters.clojure_version >> + JDK_SRC_VERSION: << parameters.jdk_version >> + steps: + - checkout + - with_cache: + cache_version: "test_v1_<< parameters.clojure_version >>_<< parameters.jdk_version >>" + steps: + - run: + name: Running quick tests + command: make quick-test + + full-test: + description: | + Run tests against given version of JDK and Clojure with inlining the dependencies parameters: jdk_version: description: Version of JDK to test against @@ -145,7 +168,7 @@ jobs: steps: - checkout - with_cache: - cache_version: "test_code_v4_<< parameters.clojure_version >>_<< parameters.jdk_version >>" + cache_version: "full_test_v1_<< parameters.clojure_version >>_<< parameters.jdk_version >>" steps: - run: name: Running tests with inlined deps @@ -171,20 +194,27 @@ workflows: ci-test-matrix: jobs: - test: - # Regular tests for all Clojure and JDK versions (except JDK21, see - # below). This matrix doesn't perform parser tests because we don't - # have JDK sources here. + # Regular (quick) tests for all Clojure and JDK versions. matrix: alias: "test" parameters: clojure_version: ["1.10", "1.11", "1.12"] jdk_version: [jdk8, jdk11, jdk17, jdk21, jdk24] <<: *run_always + - full-test: + # Full tests against selected versions. + matrix: + alias: "full-test" + parameters: + clojure_version: ["1.12"] + jdk_version: [jdk8, jdk24] + <<: *run_always - lint: <<: *run_always - deploy: requires: - test + - full-test - lint filters: branches: From 2a434f1ac236240ca2e7f4f00b17a47c735c618d Mon Sep 17 00:00:00 2001 From: Oleksandr Yakushev Date: Mon, 28 Apr 2025 14:41:56 +0300 Subject: [PATCH 4/5] Bump Orchard to 0.34.3 --- CHANGELOG.md | 2 ++ project.clj | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a667eebd..77eefa9f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master (unreleased) +* Bump `orchard` to [0.34.3](https://github.com/clojure-emacs/orchard/blob/master/CHANGELOG.md#0343-2025-04-28). + ## 0.55.4 (2025-04-26) * Bump `orchard` to [0.34.2](https://github.com/clojure-emacs/orchard/blob/master/CHANGELOG.md#0342-2025-04-26). diff --git a/project.clj b/project.clj index 6c1ba8efe..33dfa6b91 100644 --- a/project.clj +++ b/project.clj @@ -22,7 +22,7 @@ :url "http://www.eclipse.org/legal/epl-v10.html"} :scm {:name "git" :url "https://github.com/clojure-emacs/cider-nrepl"} :dependencies [[nrepl/nrepl "1.3.1" :exclusions [org.clojure/clojure]] - [cider/orchard "0.34.2" :exclusions [org.clojure/clojure]] + [cider/orchard "0.34.3" :exclusions [org.clojure/clojure]] ^:inline-dep [fipp ~fipp-version] ; can be removed in unresolved-tree mode ^:inline-dep [compliment "0.7.0"] ^:inline-dep [org.rksm/suitable "0.6.2" :exclusions [org.clojure/clojure From cf6c9346c702fc282d03c0719ddd8dbb343fd619 Mon Sep 17 00:00:00 2001 From: Oleksandr Yakushev Date: Mon, 28 Apr 2025 14:50:46 +0300 Subject: [PATCH 5/5] [test] Restrict flaky tests --- .clj-kondo/config.edn | 2 +- .../cider/nrepl/middleware/debug_integration_test.clj | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index 6b3f389d6..eda0e05e5 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -1,7 +1,7 @@ {:hooks {:analyze-call {cider.nrepl.middleware.out/with-out-binding hooks.core/with-out-binding}} :lint-as {cider.nrepl.middleware.log-test/with-each-framework clojure.core/let} - ;; :exclude-files ["middleware/debug.clj"] + :exclude-files "debug_integration_test.clj$" ;; TODO: remove once flaky debugger tests are addressed :linters {:unresolved-symbol {:exclude [(cider.nrepl/def-wrapper) (cider.nrepl.middleware.util.instrument/definstrumenter) (cider.nrepl.middleware.util.instrument/with-break) diff --git a/test/clj/cider/nrepl/middleware/debug_integration_test.clj b/test/clj/cider/nrepl/middleware/debug_integration_test.clj index f4ee21fab..9b4a98d03 100644 --- a/test/clj/cider/nrepl/middleware/debug_integration_test.clj +++ b/test/clj/cider/nrepl/middleware/debug_integration_test.clj @@ -2,15 +2,21 @@ (:require [cider.nrepl :refer [wrap-debug]] [cider.nrepl.middleware.debug :as d] - [clojure.test :refer :all] + [clojure.test :refer [is testing use-fixtures]] [nrepl.core :as nrepl] [nrepl.server :as nrepl.server] [nrepl.transport :as transport] - [clojure.java.io :as io]) + [clojure.java.io :as io] + [orchard.misc]) (:import java.util.UUID [java.util.concurrent TimeUnit LinkedBlockingQueue])) +;; TODO: this test namespace is flaky on JDK8. Disable it there for now. +(defmacro deftest [name & body] + `(when (> orchard.misc/java-api-version 8) + (clojure.test/deftest ~name ~@body))) + ;;; Helpers for starting an nRepl session ;;; We do not use nrepl/client-session here because it ;;; is built with the expectation that each message sent to the server