Skip to content

Commit

Permalink
Add build and release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
julienvincent committed Aug 5, 2024
1 parent 3134d48 commit 60df404
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 14 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release
on: [push]

jobs:
publish:
runs-on: ubuntu-latest
env:
VERSION: ${{ github.ref_name }}
steps:
- name: Checkout git repo
uses: actions/checkout@v2

- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '21'

- uses: extractions/setup-just@v1

- uses: DeLaGuardo/[email protected]
with:
cli: latest

- name: Build
run: |
just build
- name: Release
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
env:
CLOJARS_USERNAME: infrastructure-kepler16-com
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
run: |
just release
11 changes: 4 additions & 7 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
test *ARGS:
clojure -T:kmono run :exec "\"just test\"" {{ ARGS }}
build:
clojure -T:build jar

build *ARGS:
clojure -T:kmono run :exec :build {{ ARGS }}

release *ARGS:
clojure -T:kmono run :exec :release {{ ARGS }}
release:
clojure -T:build release
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Forge

A clojure test runner

+ Parallel execution
+ Human parseable output
A parallel test runner for clojure.test
53 changes: 53 additions & 0 deletions build.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
(ns build
(:require
[clojure.string :as str]
[clojure.tools.build.api :as b]
[deps-deploy.deps-deploy :as deps-deploy]))

(def basis
(b/create-basis {}))

(def lib 'com.kepler16/forge)
(def version
(str/replace (or (System/getenv "VERSION")
"0.0.0")
#"v" ""))
(def class-dir "target/classes")
(def jar-file "target/lib.jar")

(defn clean [_]
(b/delete {:path "target"}))

(defn jar [_]
(clean nil)

(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:src-dirs ["src"]
:pom-data [[:description "Parallel test runner for clojure.test"]
[:url "https://github.com/kepler16/forge"]
[:licenses
[:license
[:name "MIT"]
[:url "https://opensource.org/license/mit"]]]]})

(b/copy-dir {:src-dirs ["src"]
:target-dir class-dir})

(b/compile-clj {:basis basis
:src-dirs [class-dir]
:class-dir class-dir
:ns-compile ['k16.forge]
:java-opts ["-Dclojure.compiler.direct-linking=true"
"-Dclojure.spec.skip-macros=true"]})

(b/jar {:class-dir class-dir
:jar-file jar-file}))

(defn release [_]
(deps-deploy/deploy {:installer :remote
:artifact (b/resolve-path jar-file)
:pom-file (b/pom-path {:lib lib
:class-dir class-dir})}))
9 changes: 6 additions & 3 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{:deps {org.clj-commons/pretty {:mvn/version "3.0.0"}
{:paths ["src"]

:deps {org.clj-commons/pretty {:mvn/version "3.0.0"}
mvxcvi/puget {:mvn/version "1.3.4"}
cli-matic/cli-matic {:mvn/version "0.5.4"}
lambdaisland/deep-diff2 {:mvn/version "2.11.216"}}

:aliases {:kmono {:deps {com.kepler16/kmono {:mvn/version "2.0.1.0"}}
: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"}}
:ns-default build}}}

0 comments on commit 60df404

Please sign in to comment.