Skip to content

Commit af01e2a

Browse files
committed
build: move from lein to clj+deps.edn
Lein with deps.edn does not work on Windows, so we're moving to clj+deps.edn. See RickMoynihan/lein-tools-deps#85
1 parent 805cc41 commit af01e2a

File tree

17 files changed

+158
-198
lines changed

17 files changed

+158
-198
lines changed

.carve_ignore .carve/ignore

File renamed without changes.

.github/custom-actions/clojure-env/action.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,19 @@ runs:
88
id: restore-maven
99
with:
1010
path: ~/.m2/repository
11-
key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }}
11+
key: ${{ runner.os }}-maven-${{ hashFiles('deps.edn') }}
1212
restore-keys: |
1313
${{ runner.os }}-maven-
1414
15+
- name: Restore gitlibs
16+
uses: actions/cache@v2
17+
id: restore-gitlibs
18+
with:
19+
path: ~/.gitlibs
20+
key: ${{ runner.os }}-gitlibs-${{ hashFiles('deps.edn') }}
21+
restore-keys: |
22+
${{ runner.os }}-gitlibs-
23+
1524
- name: Prepare java
1625
uses: actions/setup-java@v2
1726
with:
@@ -21,20 +30,19 @@ runs:
2130
- uses: DeLaGuardo/[email protected]
2231
with:
2332
cli: 1.10.3.986
24-
lein: 2.9.7
2533

2634
- name: Fetch maven dependencies
2735
shell: bash
2836
# 'if' not supported yet, workaround in bash
2937
# https://github.com/actions/runner/issues/834
3038
# if: steps.restore-maven.outputs.cache-hit != 'true'
31-
# run: lein deps
39+
# run: clj -P
3240
run: |
3341
if echo ${{ steps.restore-maven.outputs.cache-hit }} | grep -c "true"
3442
then
3543
echo "Cache hit - skipping dependency installation"
3644
else
37-
${{ runner.os != 'Windows' && 'lein deps' || 'pwsh -c "lein deps"' }}
45+
${{ runner.os != 'Windows' && 'clojure -P' || 'pwsh -c "clojure -P"' }}
3846
fi
3947
4048

.github/workflows/build.yml

+12-30
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ on:
1111
- 'docs/**'
1212

1313
env:
14-
REGISTRY: ghcr.io # Github container registry https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
14+
# Github container registry https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
15+
REGISTRY: ghcr.io
1516

1617
jobs:
1718

@@ -28,14 +29,11 @@ jobs:
2829
- uses: ./.github/custom-actions/node-env
2930

3031
- name: Run JVM tests
31-
run: script/test/jvm
32-
33-
- name: Compile components
34-
run: yarn components
32+
run: yarn server:test
3533

3634
# TODO: re-enable once web build is fixed
3735
# - name: Run Karma tests
38-
# run: script/test/karma
36+
# run: yarn client:test
3937

4038
lint:
4139
runs-on: ubuntu-latest
@@ -46,27 +44,14 @@ jobs:
4644
fetch-depth: 1
4745
submodules: 'true'
4846

47+
# We don't use yarn lint here in order to have faster CI.
48+
# Keep version and script up to date!
4949
- uses: DeLaGuardo/setup-clj-kondo@master
5050
with:
51-
version: '2021.03.03'
51+
version: '2021.08.06'
5252

5353
- name: Lint
54-
run: script/lint
55-
56-
# # ignore for now
57-
# deps-check:
58-
# runs-on: ubuntu-18.04
59-
# steps:
60-
# - name: Git checkout
61-
# uses: actions/checkout@v1
62-
# with:
63-
# fetch-depth: 1
64-
# submodules: 'true'
65-
#
66-
# - uses: ./.github/custom-actions/clojure-env
67-
#
68-
# - name: Check Dependencies
69-
# run: lein ancient
54+
run: clj-kondo --lint src
7055

7156
style:
7257
runs-on: ubuntu-latest
@@ -80,7 +65,7 @@ jobs:
8065
- uses: ./.github/custom-actions/clojure-env
8166

8267
- name: Style
83-
run: script/style
68+
run: yarn lint
8469

8570
carve:
8671
runs-on: ubuntu-latest
@@ -94,7 +79,7 @@ jobs:
9479
- uses: ./.github/custom-actions/clojure-env
9580

9681
- name: Carve unused vars
97-
run: script/carve
82+
run: yarn carve
9883

9984
build-app:
10085
needs: [test, lint, style, carve]
@@ -110,11 +95,8 @@ jobs:
11095
- uses: ./.github/custom-actions/clojure-env
11196
- uses: ./.github/custom-actions/node-env
11297

113-
- name: Compile components
114-
run: yarn components
115-
11698
- name: Compile JS Assets
117-
run: lein run -m shadow.cljs.devtools.cli --npm release main renderer --config-merge "{:closure-defines {athens.core/SENTRY_DSN \"${SENTRY_DSN}\" athens.util/COMMIT_URL \"${COMMIT_URL}\" athens.main.core/AUTO_UPDATE ${AUTO_UPDATE}}}"
99+
run: yarn prod --config-merge "{:closure-defines {athens.core/SENTRY_DSN \"${SENTRY_DSN}\" athens.util/COMMIT_URL \"${COMMIT_URL}\" athens.main.core/AUTO_UPDATE ${AUTO_UPDATE}}}"
118100
env:
119101
SENTRY_DSN: ${{ secrets.sentry_dsn }}
120102
AUTO_UPDATE: ${{ github.ref == 'refs/heads/main' }}
@@ -234,7 +216,7 @@ jobs:
234216
- uses: ./.github/custom-actions/clojure-env
235217

236218
- name: Build server JAR
237-
run: lein uberjar
219+
run: yarn server
238220

239221
- name: Set up Docker Buildx
240222
uses: docker/setup-buildx-action@v1

README.self-hosted.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Use DB Picker -> join with `localhost:3010` as URL, no password.
1010

1111
To create uberjar:
1212
``` shell
13-
lein uberjar
13+
yarn server
1414
```
1515

1616
This will create `target/athens-lan-party-standalone.jar`.
@@ -39,10 +39,10 @@ In the output you can notice `Starting WebServer with config: {:port 3010}`,
3939
this **3010** is the port number that Athens Lan-Party runs on,
4040
notice it might be different number if you've changed configuration.
4141

42-
### Running Athens Self-Hosted Server (using `lein`)
42+
### Running Athens Self-Hosted Server
4343

4444
``` shell
45-
lein run
45+
yarn server:run
4646
```
4747

4848
This will start HTTP server on port 3010, unless you've modified `src/clj/config.edn`.
@@ -54,7 +54,7 @@ Also nREPL server is started on port 8877, unless you've modified `src/clj/confi
5454
Start REPL:
5555

5656
``` shell
57-
lein repl
57+
yarn server:repl
5858
```
5959

6060
Start the system:
@@ -76,7 +76,7 @@ After starting HTTP & nREPL servers are running on default ports or changes in `
7676

7777
**Clean the Datahike DB**
7878

79-
Stop the Self-Hosted server. [ctrl+c] if using `lein run` or [ctrl+d] if repl.
79+
Stop the Self-Hosted server. [ctrl+c] if using `yarn server:run` or [ctrl+d] if repl.
8080
By default Datahike DB is stored in `/tmp/exmaple`, remove this forlder
8181
start the srever and Bob's your unkle.
8282

athens-data/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# athens-data
22

3-
This is where `lein run` and `docker compose up` will place data files while working in dev setups.
3+
This is where `yarn server:run` and `docker compose up` will place data files while working in dev setups.

build.clj

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(ns build
2+
"Build the Athens server uberjar.
3+
From https://clojure.org/guides/tools_build#_compiled_uberjar_application_build"
4+
(:require [clojure.tools.build.api :as b]))
5+
6+
(def version (format "1.0.0-alpha.rtc.xx"))
7+
(def class-dir "target/classes")
8+
(def basis (b/create-basis {:project "deps.edn"}))
9+
(def uber-file "target/athens-lan-party-standalone.jar")
10+
11+
(defn uber [_]
12+
(b/delete {:path "target"})
13+
(b/compile-clj {:basis basis
14+
:src-dirs ["src/clj" "src/cljc"]
15+
:class-dir class-dir})
16+
(b/uber {:class-dir class-dir
17+
:uber-file uber-file
18+
:basis basis
19+
:main 'athens.self-hosted.core}))

deps.edn

+56-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
{:aliases
2-
{:carve
3-
{:extra-deps
4-
#:borkdude{carve
5-
{:git/url "https://github.com/borkdude/carve"
6-
:sha "4b5010a09e030dbd998faff718d12400748ab3b9"}}
7-
:main-opts ["-m" "carve.main"]}}
8-
9-
:paths ["src" "target/classes"]
1+
{:paths ["src/clj" "src/cljs" "src/cljc" "src/js" "src/gen"]
102

113
:deps
124
{org.clojure/clojure #:mvn{:version "1.10.3"}
@@ -29,9 +21,12 @@
2921
tick/tick #:mvn{:version "0.4.26-alpha"}
3022
com.rpl/specter #:mvn{:version "1.1.3"}
3123
com.taoensso/sente #:mvn{:version "1.16.2"}
24+
binaryage/devtools #:mvn{:version "1.0.3"}
25+
day8.re-frame/re-frame-10x #:mvn{:version "1.1.13"}
26+
day8.re-frame/tracing #:mvn{:version "0.6.2"}
3227
;; TODO: use released version after >1.5.9 release.
33-
org.flatland/ordered {:git/url "https://github.com/clj-commons/ordered.git"
34-
:sha "c6612e46a596842336b24f0bc6fac2d638c46224"}
28+
org.flatland/ordered #:git{:url "https://github.com/clj-commons/ordered.git"
29+
:sha "c6612e46a596842336b24f0bc6fac2d638c46224"}
3530
;; backend
3631
;; logging hell
3732
org.clojure/tools.logging #:mvn{:version "1.1.0"}
@@ -51,4 +46,53 @@
5146
metosin/malli #:mvn{:version "0.5.1"}
5247
;; networked repl
5348
com.stuartsierra/component.repl #:mvn{:version "0.2.0"}
54-
nrepl/nrepl #:mvn{:version "0.8.3"}}}
49+
nrepl/nrepl #:mvn{:version "0.8.3"}
50+
cider/cider-nrepl #:mvn{:version "0.27.2"}}
51+
52+
:aliases
53+
{:carve
54+
{:extra-deps {borkdude/carve
55+
#:git{:url "https://github.com/borkdude/carve"
56+
:sha "c9a4dec89032f2003cc439c473fcd3c41e809669"}}
57+
:main-opts ["-m" "carve.main"]}
58+
59+
:cljstyle
60+
{:deps {mvxcvi/cljstyle
61+
#:git{:url "https://github.com/greglook/cljstyle.git"
62+
:sha "13fd2a3ff4097f1ed5c7ec96baf13e547ac2a26b"}
63+
64+
;; Workaround for https://github.com/greglook/cljstyle/issues/79
65+
rewrite-clj/rewrite-clj
66+
#:mvn{:version "1.0.594-alpha"}}
67+
:main-opts ["-m" "cljstyle.main"]}
68+
69+
:clj-kondo
70+
{:extra-deps {borkdude/clj-kondo
71+
#:git{:url "https://github.com/borkdude/clj-kondo"
72+
:sha "9bb69c3188f7efe6e17d392def89e89ec9d85ae5"
73+
:tag "v2021.08.06"}}
74+
:main-opts ["-m" "clj-kondo.main"]}
75+
76+
:outdated
77+
{:extra-deps {com.github.liquidz/antq
78+
#:mvn{:version "1.1.0"}}
79+
;; Very noisy, due to https://github.com/liquidz/antq/issues/108
80+
:main-opts ["-m" "antq.core"]}
81+
82+
:build
83+
{:deps {io.github.clojure/tools.build
84+
#:git{:sha "599be6c8c94a6ac6cc02fc9b43536f9052225b60"
85+
:tag "v0.5.1"}}
86+
:ns-default build}
87+
88+
:test
89+
{:extra-paths ["test"]
90+
:extra-deps {io.github.cognitect-labs/test-runner
91+
#:git{:url "https://github.com/cognitect-labs/test-runner.git"
92+
:sha "48c3c67f98362ba1e20526db4eeb6996209c050a"
93+
:tag "v0.5.0"}}
94+
:main-opts ["-m" "cognitect.test-runner"]
95+
:exec-fn cognitect.test-runner.api/test}
96+
97+
:athens
98+
{:main-opts ["-m" "athens.self-hosted.core"]}}}

dev/Brewfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
brew 'openjdk@11'
2-
brew 'leiningen'
3-
brew 'yarn'
2+
brew 'clojure'
3+
brew 'yarn'

package.json

+18-3
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,34 @@
88
"url": "https://github.com/athensresearch/athens/"
99
},
1010
"scripts": {
11+
"//repo scripts": "",
1112
"update:dry": "standard-version --dry-run -p --releaseCommitMessageFormat v{{currentTag}}",
1213
"update": "standard-version -p --releaseCommitMessageFormat v{{currentTag}}",
14+
"clean": "rm -rf resources/public/**/*.js target .shadow-cljs src/gen",
15+
"lint": "clojure -M:clj-kondo --lint src",
16+
"style": "clojure -M:cljstyle check",
17+
"style:fix": "clojure -M:cljstyle fix",
18+
"carve": "clojure -M:carve --opts '{:paths [\"src\" \"test\"] :report {:format :text}}'",
19+
"carve:interactive": "clojure -M:carve --opts '{:paths [\"src\" \"test\"]}'",
20+
"clj:outdated": "clojure -M:outdated",
21+
"//client scripts": "",
1322
"dev": "yarn components && concurrently \"yarn components:watch\" \"yarn client:watch\"",
1423
"client:watch": "shadow-cljs watch main renderer app",
24+
"client:test": "yarn components && shadow-cljs compile karma-test && karma start --single-run",
25+
"client:electron": "electron .",
1526
"components": "babel ./src/js/components/ --extensions \".ts,.tsx\" --out-dir ./src/gen/components/",
1627
"components:watch": "yarn components --watch",
17-
"compile": "yarn components && shadow-cljs compile main renderer app",
1828
"prod": "yarn components && shadow-cljs release main renderer app",
19-
"clean": "rm -rf resources/public/**/*.js target .shadow-cljs src/gen",
2029
"dist": "electron-builder -p always",
2130
"storybook:watch": "start-storybook -p 6006",
2231
"storybook": "build-storybook",
23-
"vercel-build": "yarn storybook"
32+
"vercel-build": "yarn storybook",
33+
"//server scripts": "",
34+
"server": "clojure -T:build uber",
35+
"server:run": "clojure -M:athens",
36+
"server:test": "clojure -X:test :excludes '[:stress]'",
37+
"server:test:only": "clojure -M:test --var",
38+
"server:repl": "clojure"
2439
},
2540
"main": "resources/main.js",
2641
"build": {

0 commit comments

Comments
 (0)