Skip to content
Snippets Groups Projects
Unverified Commit 8456a5cb authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Mega release script improvements :exploding_head: (#13795)

* Mega build script improvements 2

* Fix Circle
parent 5e8c0e69
No related branches found
No related tags found
No related merge requests found
Showing
with 110 additions and 22 deletions
......@@ -474,6 +474,38 @@ jobs:
./bin/test-load-and-dump.sh
no_output_timeout: 5m
test-build-scripts:
executor: clojure-and-node
steps:
- attach-workspace
- restore-be-deps-cache
- run:
name: Install Clojure CLI
command: >
curl -O https://download.clojure.org/install/linux-install-1.10.1.708.sh &&
chmod +x linux-install-1.10.1.708.sh &&
sudo ./linux-install-1.10.1.708.sh
- run:
name: Run metabuild-common build script tests
command: >
cd /home/circleci/metabase/metabase/bin/common && clojure -M:test
no_output_timeout: 5m
- run:
name: Run build-drivers build script tests
command: >
cd /home/circleci/metabase/metabase/bin/build-drivers && clojure -M:test
no_output_timeout: 5m
- run:
name: Run build-mb build script tests
command: >
cd /home/circleci/metabase/metabase/bin/build-mb && clojure -M:test
no_output_timeout: 5m
- run:
name: Run release script tests
command: >
cd /home/circleci/metabase/metabase/bin/release && clojure -M:test
no_output_timeout: 5m
########################################################################################################################
# FRONTEND #
......@@ -960,6 +992,10 @@ workflows:
db-type: mysql
<<: *Matrix
- test-build-scripts:
requires:
- be-deps
- fe-deps:
requires:
- checkout
......
......@@ -2,7 +2,10 @@
set -euo pipefail
source "./bin/check-clojure-cli.sh"
script_directory=`dirname "${BASH_SOURCE[0]}"`
cd "$script_directory"
source "../bin/check-clojure-cli.sh"
check_clojure_cli
cd OSX/macos_release
......
{:paths ["./"]
{:paths ["src"]
:deps
{common/common {:local/root "../common"}
......@@ -6,4 +6,10 @@
commons-codec/commons-codec {:mvn/version "1.14"}
hiccup/hiccup {:mvn/version "1.0.5"}
io.forward/yaml {:mvn/version "1.0.9"}
stencil/stencil {:mvn/version "0.5.0"}}}
stencil/stencil {:mvn/version "0.5.0"}}
:aliases
{:test {:extra-paths ["test"]
:extra-deps {com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git"
:sha "209b64504cb3bd3b99ecfec7937b358a879f55c1"}}
:main-opts ["-m" "cognitect.test-runner"]}}}
{:paths ["./"]
{:paths ["src"]
:deps
{common/common {:local/root "../common"}
build-drivers/build-drivers {:local/root "../build-drivers"}
org.flatland/ordered {:mvn/version "1.5.7"}}}
org.flatland/ordered {:mvn/version "1.5.7"}}
:aliases
{:test {:extra-paths ["test"]
:extra-deps {com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git"
:sha "209b64504cb3bd3b99ecfec7937b358a879f55c1"}}
:main-opts ["-m" "cognitect.test-runner"]}}}
File moved
......@@ -38,12 +38,13 @@
(defn most-recent-tag []
(shell-output-when-nonzero "git" "describe" "--abbrev=0" "--tags"))
(defn most-recent-tag-parts []
(when-let [tag (most-recent-tag)]
(for [part (str/split tag #"\.")
:let [numeric-part (re-find #"\d+" part)]
:when (seq numeric-part)]
(Integer/parseInt numeric-part))))
(defn- tag-parts [tag]
(when tag
(not-empty
(for [part (str/split tag #"\.")
:let [numeric-part (re-find #"\d+" part)]
:when (seq numeric-part)]
(Integer/parseInt numeric-part)))))
(defn current-snapshot-version
"Attempt to come up with a snapshot version for builds that aren't given explicit version info based on the most
......@@ -54,15 +55,18 @@
For builds from `master`, increment the minor version instead e.g.
v0.37.1 -> v0.38.0-SNAPSHOT"
[]
(if-let [tag-parts (most-recent-tag-parts)]
(let [[major minor patch] tag-parts
major (or major 0)
[minor patch] (if (= (git-branch) "master")
[(inc (or minor 0)) 0]
[(or minor 0) (inc (or patch 0))])]
(format "v%d.%d.%d-SNAPSHOT" major minor patch))
"UNKNOWN"))
([]
(current-snapshot-version (git-branch) (most-recent-tag)))
([branch tag]
(if-let [tag-parts (not-empty (tag-parts tag))]
(let [[major minor patch] tag-parts
major (or major 0)
[minor patch] (if (= branch "master")
[(inc (or minor 0)) 0]
[(or minor 0) (inc (or patch 0))])]
(format "v%d.%d.%d-SNAPSHOT" major minor patch))
"UNKNOWN")))
(defn generate-version-info-file!
"Generate version.properties file"
......
(ns build.version-info-test
(:require [build.version-info :as version-info]
[clojure.test :refer :all]))
(deftest tag-parts-test
(doseq [[tag expected] {nil nil
"0.37.0" [0 37 0]
"0.37.0.1" [0 37 0 1]
"0.37.1-rc2" [0 37 1]}
tag [tag (str \v tag)]]
(testing (str (pr-str (list 'tag-parts tag)) " => " (pr-str expected))
(is (= expected
(#'version-info/tag-parts tag))))))
(deftest current-snapshot-version-test
(doseq [[branch tag->expected] {"release-x.37.x" {nil "UNKNOWN"
"0.37.0" "v0.37.1-SNAPSHOT"
"0.37.0.1" "v0.37.1-SNAPSHOT"
"0.37.1-rc2" "v0.37.2-SNAPSHOT"}
"master" {nil "UNKNOWN"
"0.37.0" "v0.38.0-SNAPSHOT"
"0.37.0.1" "v0.38.0-SNAPSHOT"
"0.37.1-rc2" "v0.38.0-SNAPSHOT"}}
[tag expected] tag->expected]
(testing (str (pr-str (list 'current-snapshot-version branch tag)) " => " (pr-str expected))
(is (= expected
(version-info/current-snapshot-version branch tag))))))
{:paths ["./"]
{:paths ["src"]
:deps
{commons-io/commons-io {:mvn/version "2.6"}
colorize/colorize {:mvn/version "0.1.1"}
environ/environ {:mvn/version "1.1.0"}
potemkin/potemkin {:mvn/version "0.4.5"}}}
potemkin/potemkin {:mvn/version "0.4.5"}}
:aliases
{:test {:extra-paths ["test"]
:extra-deps {com.cognitect/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git"
:sha "209b64504cb3bd3b99ecfec7937b358a879f55c1"}}
:main-opts ["-m" "cognitect.test-runner"]}}}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment