diff --git a/.circleci/config.yml b/.circleci/config.yml index ac97a70..5f7d6d0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -30,9 +30,9 @@ jobs: name: Install Clojure command: |2- - wget https://download.clojure.org/install/linux-install-1.10.2.796.sh - chmod +x linux-install-1.10.2.796.sh - sudo ./linux-install-1.10.2.796.sh + wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh + chmod +x linux-install-1.11.1.1224.sh + sudo ./linux-install-1.11.1.1224.sh - run: name: Install lsof command: | @@ -104,9 +104,9 @@ jobs: name: Install Clojure command: |2- - wget https://download.clojure.org/install/linux-install-1.10.2.796.sh - chmod +x linux-install-1.10.2.796.sh - sudo ./linux-install-1.10.2.796.sh + wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh + chmod +x linux-install-1.11.1.1224.sh + sudo ./linux-install-1.11.1.1224.sh - run: name: Install lsof command: | @@ -189,17 +189,18 @@ jobs: - run: name: Install bb command: bash <(curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install) --dir $(pwd) - - run: - name: Build binary - command: ./bb script/compile.clj - no_output_timeout: 30m - run: name: Fix ssl libs for tests - command: |2 + command: |2+ - sudo ln -s /usr/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib + # sudo ln -s /usr/local/opt/openssl@3/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib + + # sudo ln -s /usr/local/opt/openssl@3/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib - sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib + - run: + name: Build binary + command: ./bb script/compile.clj + no_output_timeout: 30m - run: name: Run tests command: | @@ -244,9 +245,9 @@ jobs: name: Install Clojure command: |2- - wget https://download.clojure.org/install/linux-install-1.10.2.796.sh - chmod +x linux-install-1.10.2.796.sh - sudo ./linux-install-1.10.2.796.sh + wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh + chmod +x linux-install-1.11.1.1224.sh + sudo ./linux-install-1.11.1.1224.sh - run: name: Install lsof command: | @@ -318,9 +319,9 @@ jobs: name: Install Clojure command: |2- - wget https://download.clojure.org/install/linux-install-1.10.2.796.sh - chmod +x linux-install-1.10.2.796.sh - sudo ./linux-install-1.10.2.796.sh + wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh + chmod +x linux-install-1.11.1.1224.sh + sudo ./linux-install-1.11.1.1224.sh - run: name: Install lsof command: | @@ -360,75 +361,6 @@ jobs: - store_artifacts: path: /tmp/release destination: release - mysql-mac: - macos: - xcode: 14.0.0 - environment: - GRAALVM_HOME: /Users/distiller/graalvm-ce-java11-22.0.0.2/Contents/Home - MACOSX_DEPLOYMENT_TARGET: '10.13' - BABASHKA_PLATFORM: macos - BABASHKA_TEST_ENV: native - BABASHKA_XMX: -J-Xmx7g - POD_TEST_ENV: native - POD_DB_TYPE: mysql - 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 /usr/local - - run: - name: Install Leiningen - command: | - script/install-leiningen - - run: - name: Download GraalVM - command: |2- - - cd ~ - ls -la - if ! [ -d graalvm-ce-java11-22.0.0.2 ]; then - curl -O -sL https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java11-darwin-amd64-22.0.0.2.tar.gz - tar xzf graalvm-ce-java11-darwin-amd64-22.0.0.2.tar.gz - fi - - run: - name: Install bb - command: bash <(curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install) --dir $(pwd) - - run: - name: Build binary - command: ./bb script/compile.clj - no_output_timeout: 30m - - run: - name: Fix ssl libs for tests - command: |2 - - sudo ln -s /usr/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib - - sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib - - run: - name: Run tests - command: | - script/test - - run: - name: Release - command: | - .circleci/script/release - - save_cache: - paths: - - ~/.m2 - key: mac-{{ checksum "project.clj" }}-{{ checksum ".circleci/config.yml" }} - - store_artifacts: - path: /tmp/release - destination: release postgresql-linux: docker: - image: circleci/clojure:openjdk-11-lein-2.9.6-bullseye @@ -458,9 +390,9 @@ jobs: name: Install Clojure command: |2- - wget https://download.clojure.org/install/linux-install-1.10.2.796.sh - chmod +x linux-install-1.10.2.796.sh - sudo ./linux-install-1.10.2.796.sh + wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh + chmod +x linux-install-1.11.1.1224.sh + sudo ./linux-install-1.11.1.1224.sh - run: name: Install lsof command: | @@ -532,9 +464,9 @@ jobs: name: Install Clojure command: |2- - wget https://download.clojure.org/install/linux-install-1.10.2.796.sh - chmod +x linux-install-1.10.2.796.sh - sudo ./linux-install-1.10.2.796.sh + wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh + chmod +x linux-install-1.11.1.1224.sh + sudo ./linux-install-1.11.1.1224.sh - run: name: Install lsof command: | @@ -617,17 +549,18 @@ jobs: - run: name: Install bb command: bash <(curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install) --dir $(pwd) - - run: - name: Build binary - command: ./bb script/compile.clj - no_output_timeout: 30m - run: name: Fix ssl libs for tests - command: |2 + command: |2+ - sudo ln -s /usr/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib + # sudo ln -s /usr/local/opt/openssl@3/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib - sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib + # sudo ln -s /usr/local/opt/openssl@3/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib + + - run: + name: Build binary + command: ./bb script/compile.clj + no_output_timeout: 30m - run: name: Run tests command: | @@ -672,9 +605,9 @@ jobs: name: Install Clojure command: |2- - wget https://download.clojure.org/install/linux-install-1.10.2.796.sh - chmod +x linux-install-1.10.2.796.sh - sudo ./linux-install-1.10.2.796.sh + wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh + chmod +x linux-install-1.11.1.1224.sh + sudo ./linux-install-1.11.1.1224.sh - run: name: Install lsof command: | @@ -746,9 +679,9 @@ jobs: name: Install Clojure command: |2- - wget https://download.clojure.org/install/linux-install-1.10.2.796.sh - chmod +x linux-install-1.10.2.796.sh - sudo ./linux-install-1.10.2.796.sh + wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh + chmod +x linux-install-1.11.1.1224.sh + sudo ./linux-install-1.11.1.1224.sh - run: name: Install lsof command: | @@ -831,17 +764,18 @@ jobs: - run: name: Install bb command: bash <(curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install) --dir $(pwd) - - run: - name: Build binary - command: ./bb script/compile.clj - no_output_timeout: 30m - run: name: Fix ssl libs for tests - command: |2 + command: |2+ + + # sudo ln -s /usr/local/opt/openssl@3/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib - sudo ln -s /usr/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib + # sudo ln -s /usr/local/opt/openssl@3/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib - sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib + - run: + name: Build binary + command: ./bb script/compile.clj + no_output_timeout: 30m - run: name: Run tests command: | @@ -886,9 +820,9 @@ jobs: name: Install Clojure command: |2- - wget https://download.clojure.org/install/linux-install-1.10.2.796.sh - chmod +x linux-install-1.10.2.796.sh - sudo ./linux-install-1.10.2.796.sh + wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh + chmod +x linux-install-1.11.1.1224.sh + sudo ./linux-install-1.11.1.1224.sh - run: name: Install lsof command: | @@ -960,9 +894,9 @@ jobs: name: Install Clojure command: |2- - wget https://download.clojure.org/install/linux-install-1.10.2.796.sh - chmod +x linux-install-1.10.2.796.sh - sudo ./linux-install-1.10.2.796.sh + wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh + chmod +x linux-install-1.11.1.1224.sh + sudo ./linux-install-1.11.1.1224.sh - run: name: Install lsof command: | @@ -1045,17 +979,18 @@ jobs: - run: name: Install bb command: bash <(curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install) --dir $(pwd) - - run: - name: Build binary - command: ./bb script/compile.clj - no_output_timeout: 30m - run: name: Fix ssl libs for tests - command: |2 + command: |2+ + + # sudo ln -s /usr/local/opt/openssl@3/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib - sudo ln -s /usr/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib + # sudo ln -s /usr/local/opt/openssl@3/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib - sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib + - run: + name: Build binary + command: ./bb script/compile.clj + no_output_timeout: 30m - run: name: Run tests command: | @@ -1080,7 +1015,6 @@ workflows: - hsqldb-mac - mysql-linux - mysql-linux-aarch64 - - mysql-mac - postgresql-linux - postgresql-linux-aarch64 - postgresql-mac diff --git a/deps.edn b/deps.edn index 60d2132..12c49a5 100644 --- a/deps.edn +++ b/deps.edn @@ -1,20 +1,20 @@ -{:deps {org.hsqldb/hsqldb {:mvn/version "2.6.0"} - com.github.seancorfield/next.jdbc {:mvn/version "1.2.753"} +{:deps {org.hsqldb/hsqldb {:mvn/version "2.7.1"} + com.github.seancorfield/next.jdbc {:mvn/version "1.3.847"} nrepl/bencode {:mvn/version "1.1.0"} - com.cognitect/transit-clj {:mvn/version "1.0.324"} - cheshire/cheshire {:mvn/version "5.10.1"}} + com.cognitect/transit-clj {:mvn/version "1.0.329"} + cheshire/cheshire {:mvn/version "5.11.0"}} :aliases {:test {:extra-deps {cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner" :sha "7284cda41fb9edc0f3bc6b6185cfb7138fc8a023"} - ch.vorburger.mariaDB4j/mariaDB4j {:mvn/version "2.4.0"} - com.opentable.components/otj-pg-embedded {:mvn/version "0.13.3"} + ch.vorburger.mariaDB4j/mariaDB4j {:mvn/version "2.6.0"} + io.zonky.test/embedded-postgres {:mvn/version "2.0.1"} babashka/babashka.pods #_{:local/root "../pods"} {:git/url "https://github.com/babashka/babashka.pods" - :sha "de4c3610c9ef3879370d01b7202a9f3a9d056f6e"}} + :git/sha "75c2216649bf5caf3ae41e7b8fc202e45b090ea9"}} :extra-paths ["test"] :main-opts ["-m" "cognitect.test-runner"]} :mysql {:extra-deps {mysql/mysql-connector-java {:mvn/version "8.0.25"}}}}} diff --git a/script/generate_circleci.clj b/script/generate_circleci.clj index acbefd1..efbb26f 100755 --- a/script/generate_circleci.clj +++ b/script/generate_circleci.clj @@ -38,9 +38,9 @@ {:restore_cache {:keys ["linux-{{ checksum \"project.clj\" }}-{{ checksum \".circleci/config.yml\" }}"]}} {:run {:name "Install Clojure", :command " -wget https://download.clojure.org/install/linux-install-1.10.2.796.sh -chmod +x linux-install-1.10.2.796.sh -sudo ./linux-install-1.10.2.796.sh"}} +wget https://download.clojure.org/install/linux-install-1.11.1.1224.sh +chmod +x linux-install-1.11.1.1224.sh +sudo ./linux-install-1.11.1.1224.sh"}} {:run {:name "Install lsof", :command "sudo apt-get install lsof\n"}} {:run {:name "Install native dev tools", @@ -101,13 +101,14 @@ if ! [ -d graalvm-ce-java%s-{{graalvm-version}} ]; then fi" java java java)}} {:run {:name "Install bb" :command "bash <(curl -s https://raw.githubusercontent.com/borkdude/babashka/master/install) --dir $(pwd)"}} + {:run {:name "Fix ssl libs for tests" + :command " +# sudo ln -s /usr/local/opt/openssl@3/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib\n +# sudo ln -s /usr/local/opt/openssl@3/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib\n +"}} {:run {:name "Build binary", :command "./bb script/compile.clj", :no_output_timeout "30m"}} - {:run {:name "Fix ssl libs for tests" - :command " -sudo ln -s /usr/lib/libssl.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib\n -sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib\n"}} {:run {:name "Run tests", :command "script/test\n"}} {:run {:name "Release", @@ -133,7 +134,8 @@ sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.d [:environment :POD_DB_TYPE] "mysql") :mysql-linux-aarch64 (assoc-in (linux :arch "aarch64" :static true) [:environment :POD_DB_TYPE] "mysql") - :mysql-mac (assoc-in (mac) + ;; disabled because of libssl issues + #_#_:mysql-mac (assoc-in (mac) [:environment :POD_DB_TYPE] "mysql") :postgresql-linux (assoc-in (linux :static true) [:environment :POD_DB_TYPE] "postgresql") @@ -157,7 +159,7 @@ sudo ln -s /usr/lib/libcrypto.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.d "hsqldb-mac" "mysql-linux" "mysql-linux-aarch64" - "mysql-mac" + #_"mysql-mac" "postgresql-linux" "postgresql-linux-aarch64" "postgresql-mac" diff --git a/script/install-clojure b/script/install-clojure index 7583a79..c623068 100755 --- a/script/install-clojure +++ b/script/install-clojure @@ -3,8 +3,8 @@ install_dir=${1:-/usr/local} mkdir -p "$install_dir" cd /tmp -curl -O -sL https://download.clojure.org/install/clojure-tools-1.10.2.796.tar.gz -tar xzf clojure-tools-1.10.2.796.tar.gz +curl -O -sL https://download.clojure.org/install/clojure-tools-1.11.1.1224.tar.gz +tar xzf clojure-tools-1.11.1.1224.tar.gz cd clojure-tools clojure_lib_dir="$install_dir/lib/clojure" mkdir -p "$clojure_lib_dir/libexec" @@ -18,6 +18,6 @@ cp clojure "$install_dir/bin" cp clj "$install_dir/bin" cd /tmp -rm -rf clojure-tools-1.10.2.796.tar.gz +rm -rf clojure-tools-1.11.1.1224.tar.gz rm -rf clojure-tools echo "Installed clojure to $install_dir/bin" diff --git a/test/pod/babashka/postgresql_test.clj b/test/pod/babashka/postgresql_test.clj index 4874f75..58bc66f 100644 --- a/test/pod/babashka/postgresql_test.clj +++ b/test/pod/babashka/postgresql_test.clj @@ -3,7 +3,7 @@ '{:lint-as {pod.babashka.postgresql/with-transaction next.jdbc/with-transaction}}} (:require [babashka.pods :as pods] [clojure.test :refer [deftest is testing]]) - (:import [com.opentable.db.postgres.embedded EmbeddedPostgres] + (:import [io.zonky.test.db.postgres.embedded EmbeddedPostgres] [java.util Date Arrays])) (pods/load-pod (if (= "native" (System/getenv "POD_TEST_ENV")) @@ -16,17 +16,18 @@ (require '[pod.babashka.postgresql.transaction :as transaction]) (def port 54322) + (def db {:dbtype "postgres" - :port port :user "postgres" + :port port :dbname "postgres"}) (deftest postgresql-test - (with-open [_ (-> (EmbeddedPostgres/builder) - (.setPort port) - .start - .getPostgresDatabase - .getConnection)] + (with-open [_conn (-> (EmbeddedPostgres/builder) + (.setPort port) + .start + .getPostgresDatabase + .getConnection)] (is (db/execute! db ["create table foo ( foo int );"])) (is (thrown-with-msg? Exception #"exists" (db/execute! db ["create table foo ( foo int );"]))) @@ -36,7 +37,7 @@ (testing "connection" (let [conn (db/get-connection db)] (is (= [#:foo{:foo 1} #:foo{:foo 2} #:foo{:foo 3}] - (db/execute! conn ["select * from foo;"]))) + (db/execute! conn ["select * from foo;"]))) (db/close-connection conn))) (testing "input parameters" (let [conn (db/get-connection db) @@ -52,7 +53,7 @@ (db/execute! conn ["insert into foo values (4);"]) (transaction/commit conn) (is (= [#:foo{:foo 1} #:foo{:foo 2} #:foo{:foo 3} #:foo{:foo 4}] - (db/execute! db ["select * from foo;"])))) + (db/execute! db ["select * from foo;"])))) (testing "rollback" (let [conn (db/get-connection db)] (transaction/begin conn) @@ -60,20 +61,20 @@ (transaction/rollback conn) (db/close-connection conn) (is (= [#:foo{:foo 1} #:foo{:foo 2} #:foo{:foo 3} #:foo{:foo 4}] - (db/execute! db ["select * from foo;"]))))) + (db/execute! db ["select * from foo;"]))))) (testing "with-transaction" (dotimes [_ 10] (is (= [#:next.jdbc{:update-count 2}] (db/with-transaction [x db] (db/execute! x ["insert into foo values (5);"]) (db/execute! x ["insert into foo values (6), (7);"]))))) - (is (= 2 (count (db/execute! db ["select distinct foo from foo where foo > 5;"])))) + (is (= 2 (count (db/execute! db ["select distinct foo from foo where foo > 5;"])))) (testing "failing transaction" (is (thrown-with-msg? Exception #"read-only" (db/with-transaction [x db {:read-only true}] (db/execute! x ["insert into foo values (8);"])))) - (is (zero? (count (db/execute! db ["select * from foo where foo = 8;"]))))))) + (is (zero? (count (db/execute! db ["select * from foo where foo = 8;"]))))))) (testing "arrays" (testing "byte arrays" (let [bs (.getBytes "foo")]