forked from replikativ/datahike
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to main branch (replikativ#454)
* Switch to GitHub Flow and tools.build This commit changes the CI to create a release on every merge to the `main`-branch. The patch-release will always incremented when released. CircleCI-pipeline creates a release automatically on GitHub and tags the commit. This commit also switches to use tools.build and with that it is possible to run the compilation and jar-builds from the REPL. There is no need to run maven anymore. * Documentation and ADR Co-authored-by: Timo Kramer <fw-git@timokramer.de> Co-authored-by: Timo Kramer <info@lambdaforge.io>
- Loading branch information
1 parent
0b48cf7
commit dac52a9
Showing
8 changed files
with
286 additions
and
1,105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
(ns build | ||
(:require | ||
[borkdude.gh-release-artifact :as gh] | ||
[clojure.tools.build.api :as b] | ||
[deps-deploy.deps-deploy :as dd])) | ||
|
||
(def lib 'io.replikativ/datahike) | ||
(def version (format "0.4.%s" (b/git-count-revs nil))) | ||
(def current-commit (gh/current-commit)) | ||
(def class-dir "target/classes") | ||
(def basis (b/create-basis {:project "deps.edn"})) | ||
(def jar-file (format "target/%s-%s.jar" (name lib) version)) | ||
|
||
(defn clean | ||
[_] | ||
(b/delete {:path "target"})) | ||
|
||
(defn compile | ||
[_] | ||
(b/javac {:src-dirs ["java"] | ||
:class-dir class-dir | ||
:basis basis | ||
:javac-opts ["-source" "8" "-target" "8"]})) | ||
|
||
(defn jar | ||
[_] | ||
(compile nil) | ||
(b/write-pom {:class-dir class-dir | ||
:src-pom "./template/pom.xml" | ||
:lib lib | ||
:version version | ||
:basis basis | ||
:src-dirs ["src"]}) | ||
(b/copy-dir {:src-dirs ["src" "resources"] | ||
:target-dir class-dir}) | ||
(b/jar {:class-dir class-dir | ||
:jar-file jar-file})) | ||
|
||
(defn deploy | ||
"Don't forget to set CLOJARS_USERNAME and CLOJARS_PASSWORD env vars." | ||
[_] | ||
(dd/deploy {:installer :remote :artifact jar-file | ||
:pom-file (b/pom-path {:lib lib :class-dir class-dir})})) | ||
|
||
(defn release | ||
[_] | ||
(-> (gh/overwrite-asset {:org (namespace lib) | ||
:repo (name lib) | ||
:tag version | ||
:commit current-commit | ||
:file jar-file | ||
:content-type "application/java-archive"}) | ||
:url | ||
println)) | ||
|
||
(defn install | ||
[_] | ||
(clean nil) | ||
(jar nil) | ||
(b/install {:basis (b/create-basis {}) | ||
:lib lib | ||
:version version | ||
:jar-file jar-file | ||
:class-dir class-dir})) | ||
|
||
(comment | ||
(b/pom-path {:lib lib :class-dir class-dir}) | ||
(clean nil) | ||
(compile nil) | ||
(jar nil) | ||
(deploy nil) | ||
(release nil) | ||
(install nil) | ||
|
||
(name lib) | ||
(namespace lib) | ||
(require '[babashka.fs :as fs]) | ||
(fs/file-name (format "target/datahike-%s.jar" version))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Github Flow | ||
|
||
## Context | ||
|
||
[GitHub Flow](https://githubflow.github.io/) | ||
|
||
We want to release more often. Therefore we are considering the GitHub Flow as an alternative to | ||
our current Gitflow. Everytime a merge-request gets merged a new release should be created after | ||
running the pipeline. That means features and bugfixes are propagated faster. Apart from that | ||
the flow is just simpler and sufficient for our and our users' needs. | ||
|
||
[Discussion](https://github.com/replikativ/datahike/discussions/447) | ||
|
||
## Options | ||
|
||
[4 branching workflows for Git](https://medium.com/@patrickporto/4-branching-workflows-for-git-30d0aaee7bf) | ||
|
||
## Status | ||
|
||
**Proposed** | ||
|
||
## Decision | ||
|
||
We are switching to the GitHub Flow with [PR #445](https://github.com/replikativ/datahike/pull/445). | ||
|
||
## Consequences | ||
|
||
When the PR is merged into the newly created `main`-branch we are from then on only branching off | ||
of main for feature- and bugfix-branches. `main` needs to be the new default branch where everyone | ||
is landing on by default. Everytime a PR is merged there will be a new release on GitHub with the | ||
patch-level set to the overall commit-count. To make a new minor or major release the number | ||
needs to be adjusted manually in the build.clj-file. | ||
|
||
This change needs to be announced properly so that everyone working on Datahike knows about this | ||
new way of working. In the future all replikativ-libraries will be switched so everyone needs to | ||
know that there will not be any long-living-branches any more. | ||
|
||
Another consequence to consider is that CircleCI then has permission to write to our GitHub-repo. | ||
Since it is necessary to write to the git-repo when tagging a commit CircleCI needs the full | ||
write access. It already has the ability to release a jar to Clojars. |
Oops, something went wrong.