-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c785b59
commit f6d9218
Showing
93 changed files
with
2,254 additions
and
2,387 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{:remove-multiple-non-indenting-spaces? true | ||
:sort-ns-references? true} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Publish kmono 👘 | ||
name: Build | ||
on: [push] | ||
|
||
jobs: | ||
|
@@ -11,52 +11,54 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Cache clojure dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
~/.gitlibs | ||
~/.deps.clj | ||
key: cljdeps-${{ hashFiles('deps.edn') }} | ||
restore-keys: cljdeps- | ||
|
||
- uses: actions/setup-java@v2 | ||
- name: Setup Git | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Kmono CI" | ||
# - name: Cache clojure dependencies | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: | | ||
# ~/.m2/repository | ||
# ~/.gitlibs | ||
# ~/.deps.clj | ||
# key: cljdeps-${{ hashFiles('deps.edn') }} | ||
# restore-keys: cljdeps- | ||
|
||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
distribution: temurin | ||
java-version: 21 | ||
cache: 'maven' | ||
cache-dependency-path: '**/deps.edn' | ||
|
||
- uses: extractions/setup-just@v1 | ||
|
||
- uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: latest | ||
|
||
- uses: s4u/[email protected] | ||
with: | ||
githubServer: false | ||
servers: | | ||
[{"id": "github-kepler", | ||
"username": "${{ secrets.ORG_GITHUB_ACTOR }}", | ||
"password": "${{ secrets.ORG_GITHUB_TOKEN }}"}, | ||
{"id": "github-kepler-kmono", | ||
"username": "${{ github.actor }}", | ||
"password": "${{ secrets.GITHUB_TOKEN }}"}] | ||
- name: Test | ||
- name: Preload dependencies | ||
run: | | ||
just test | ||
just cli cp -P ':*/*' > /dev/null | ||
- name: Build | ||
run: | | ||
just build ":snapshot?" ${{ github.ref_name != 'master' }} | ||
just build | ||
- name: Release | ||
env: | ||
CLOJARS_USERNAME: infrastructure-kepler16-com | ||
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }} | ||
- name: Test | ||
run: | | ||
just release \ | ||
":snapshot?" ${{ github.ref_name != 'master' }} \ | ||
":create-tags?" ${{ github.ref_name == 'master' }} | ||
just cli run -M ':*/test' | ||
# - name: Release | ||
# env: | ||
# CLOJARS_USERNAME: infrastructure-kepler16-com | ||
# CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }} | ||
# run: | | ||
# just release \ | ||
# ":snapshot?" ${{ github.ref_name != 'master' }} \ | ||
# ":create-tags?" ${{ github.ref_name == 'master' }} | ||
|
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 |
---|---|---|
|
@@ -30,3 +30,5 @@ config-override.edn | |
|
||
!.github | ||
bin | ||
|
||
.test-repos |
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,95 @@ | ||
(ns build | ||
(:require | ||
[clojure.tools.build.api :as b] | ||
[deps-deploy.deps-deploy :as deps-deploy] | ||
[k16.kmono.build :as kmono.build] | ||
[k16.kmono.core.config :as core.config] | ||
[k16.kmono.core.fs :as core.fs] | ||
[k16.kmono.core.graph :as core.graph] | ||
[k16.kmono.core.packages :as core.packages] | ||
[k16.kmono.git.commit :as git.commit] | ||
[k16.kmono.git.tags :as git.tags] | ||
[k16.kmono.version :as kmono.version] | ||
[k16.kmono.version.semantic-commits :as semantic-commits])) | ||
|
||
(defn build [{:keys [snapshot release]}] | ||
(b/delete {:path "target"}) | ||
|
||
(let [project-root (core.fs/find-project-root) | ||
workspace-config (core.config/resolve-workspace-config project-root) | ||
|
||
sha (git.commit/get-current-commit-short project-root) | ||
|
||
packages | ||
(->> (core.packages/resolve-packages project-root workspace-config) | ||
(core.graph/filter-by #(not (get-in % [:deps-edn :kmono/private]))) | ||
(kmono.version/resolve-package-versions project-root) | ||
(kmono.version/resolve-package-changes project-root)) | ||
|
||
suffix (when snapshot (str sha "-SNAPSHOT")) | ||
|
||
versioned-packages | ||
(kmono.version/inc-package-versions | ||
semantic-commits/version-type | ||
suffix | ||
packages) | ||
|
||
changed-packages | ||
(->> versioned-packages | ||
(core.graph/filter-by #(seq (:commits %))) | ||
(core.graph/filter-by kmono.build/not-published?))] | ||
|
||
(kmono.build/exec | ||
"Building" changed-packages | ||
(fn [pkg] | ||
(let [pkg-name (:fqn pkg) | ||
{:keys [basis paths]} | ||
(kmono.build/create-build-context | ||
versioned-packages pkg) | ||
|
||
class-dir (str "target/" (kmono.build/relativize pkg "classes")) | ||
jar-file (str "target/" (kmono.build/relativize pkg "lib.jar"))] | ||
|
||
(b/copy-dir {:src-dirs paths | ||
:target-dir class-dir}) | ||
|
||
(b/write-pom {:class-dir class-dir | ||
:lib pkg-name | ||
:version (:version pkg) | ||
:basis basis}) | ||
|
||
(b/jar {:class-dir class-dir | ||
:jar-file jar-file}) | ||
|
||
(when-let [build (get-in pkg [:deps-edn :kmono/build])] | ||
(let [basis (b/create-basis | ||
{:dir (:relative-path pkg) | ||
:aliases (:aliases build)})] | ||
(b/compile-clj | ||
{:basis basis | ||
:compile-opts {:direct-linking true} | ||
:ns-compile [(:main build)] | ||
:class-dir class-dir}) | ||
|
||
(b/uber | ||
{:class-dir class-dir | ||
:uber-file (str "target/" (kmono.build/relativize pkg (:file build))) | ||
:basis basis | ||
:main (:main build)})))))) | ||
|
||
(when release | ||
(kmono.build/exec | ||
"Releasing" changed-packages | ||
(fn [pkg] | ||
(deps-deploy/deploy | ||
{:installer :remote | ||
:artifact (b/resolve-path (str "target/" (kmono.build/relativize pkg "lib.jar"))) | ||
:pom-file (b/pom-path {:lib (:fqn pkg) | ||
:class-dir (str "target/" (kmono.build/relativize pkg "classes"))})}))) | ||
|
||
(git.tags/create-tags | ||
project-root | ||
(map | ||
(fn [pkg] | ||
(str (:fqn pkg) "@" (:version pkg))) | ||
changed-packages))))) |
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 |
---|---|---|
@@ -1,22 +1,11 @@ | ||
{:kmono/package {:group com.kepler16 | ||
:artifact kmono | ||
:build-cmd "clojure -T:build build" | ||
:release-cmd "clojure -T:build release"} | ||
:paths ["src" "resources"] | ||
:deps {babashka/process {:mvn/version "0.5.22"} | ||
babashka/fs {:mvn/version "0.5.21"} | ||
org.slf4j/slf4j-api {:mvn/version "1.7.36"} | ||
org.slf4j/slf4j-simple {:mvn/version "1.7.36"} | ||
org.clojure/tools.deps {:mvn/version "0.19.1432"} | ||
metosin/malli {:mvn/version "0.16.1"} | ||
org.flatland/ordered {:mvn/version "1.15.12"} | ||
org.clojure/tools.cli {:mvn/version "1.1.230"}} | ||
{:kmono/workspace {:group com.kepler16} | ||
|
||
:aliases {:build {:deps {local/build {:local/root "./build"}} | ||
:ns-default build} | ||
:native {:extra-deps {com.github.clj-easy/graal-build-time {:mvn/version "1.0.5"}}} | ||
:test {:extra-paths ["test"] | ||
:extra-deps {lambdaisland/kaocha {:mvn/version "1.91.1392"}}} | ||
:kmono {:deps {com.kepler16/kmono {:local/root "."}} | ||
:main-opts [-m k16.kmono.main] | ||
:ns-default k16.kmono.api}}} | ||
:aliases {:build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.6"} | ||
slipset/deps-deploy {:mvn/version "0.2.2"} | ||
|
||
com.keperl16/kmono-core {:local/root "packages/kmono-core"} | ||
com.keperl16/kmono-version {:local/root "packages/kmono-version"} | ||
com.keperl16/kmono-build {:local/root "packages/kmono-build"} | ||
com.keperl16/kmono-git {:local/root "packages/kmono-git"}} | ||
:ns-default build | ||
:extra-paths ["./build.clj"]}}} |
Oops, something went wrong.