Skip to content

Commit

Permalink
all the things
Browse files Browse the repository at this point in the history
  • Loading branch information
kongeor committed Jul 18, 2024
1 parent a00dfc2 commit d9b59db
Show file tree
Hide file tree
Showing 34 changed files with 411 additions and 1,674 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: release

on:
push:
tags:
- 'v*'

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout git repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
cli: 1.11.1.1189

- name: Run tests
run: clojure -X:test

- name: Build uberjar
run: clojure -T:build uber

- name: Release
uses: softprops/action-gh-release@v1
with:
files: target/*.jar

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: kongeor/evolduo-app
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tag_names: true
platforms: linux/amd64,linux/arm64
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ pom.xml.asc
.hgignore
.hg/

resources/config.edn

/data
*.iml
/.idea

run.sh

/resources/public/js
/resources/public/test
/.shadow-cljs
node_modules
.cpcache
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM adoptopenjdk/openjdk12:x86_64-alpine-jdk-12.0.2_10-slim
FROM eclipse-temurin:22-jdk

COPY target/kino.jar /kino/app.jar
COPY target/kino* /kino/app.jar

CMD ["java", "-jar", "/kino/app.jar"]
35 changes: 35 additions & 0 deletions build.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
(ns build
(:require [clojure.string :as str]
[clojure.tools.build.api :as b]))


(def lib 'kino)
(def version (format "0.1.%s" (b/git-count-revs nil)))
(def class-dir "target/classes")
(def config-example (str class-dir "/config.edn.example"))
(def basis (b/create-basis {:project "deps.edn"}))
(def uber-file (format "target/%s-%s-standalone.jar" (name lib) version))

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

(defn config-string []
(str/replace (slurp config-example)
#":version \"dev\"" (str ":version \"" version "\"")))

(defn print-version [_]
(println version))

(defn uber [_]
(clean nil)
(b/copy-dir {:src-dirs ["src" "resources"]
:target-dir class-dir})
(b/write-file {:path (str class-dir "/config.edn")
:string (config-string)})
(b/compile-clj {:basis basis
:src-dirs ["src"]
:class-dir class-dir})
(b/uber {:class-dir class-dir
:uber-file uber-file
:basis basis
:main 'kion.system}))
44 changes: 44 additions & 0 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{:paths ["src" "resources"]
:deps
{org.clojure/clojure {:mvn/version "1.12.0-beta1"}
integrant/integrant {:mvn/version "0.8.1"}
compojure/compojure {:mvn/version "1.7.1"}
cprop/cprop {:mvn/version "0.1.19"}

ring/ring-core {:mvn/version "1.11.0"},
ring/ring-jetty-adapter {:mvn/version "1.11.0"}
ring/ring-defaults {:mvn/version "0.4.0"}

dev.weavejester/ragtime {:mvn/version "0.9.3"}
com.github.seancorfield/honeysql {:mvn/version "2.5.1103"}
com.github.seancorfield/next.jdbc {:mvn/version "1.3.909"}
org.postgresql/postgresql {:mvn/version "42.7.1"}

;; TODO
com.mchange/c3p0 {:mvn/version "0.9.5.5"}

clj-spotify/clj-spotify {:mvn/version "0.1.9"}

hiccup/hiccup {:mvn/version "1.0.5"}

org.clj-commons/humanize {:mvn/version "1.0"}
org.clojure/data.json {:mvn/version "2.5.0"}

org.slf4j/slf4j-simple {:mvn/version "2.0.11"}

http-kit/http-kit {:mvn/version "2.8.0"}

jarohen/chime {:mvn/version "0.3.3"}
com.taoensso/timbre {:mvn/version "6.3.1"}
}
:aliases
{:dev {:extra-paths ["dev"]
:extra-deps {integrant/repl {:mvn/version "0.3.3"}}}
:server {:main-opts ["-m" "kino.system"]}
:build {:deps {io.github.clojure/tools.build {:git/tag "v0.9.6" :git/sha "8e78bcc"}}
:ns-default build}
:test {:extra-paths ["test"]
:extra-deps {io.github.cognitect-labs/test-runner
{:git/tag "v0.5.1" :git/sha "dfb30dd"}}
:main-opts ["-m" "cognitect.test-runner"]
:exec-fn cognitect.test-runner.api/test}}}
15 changes: 15 additions & 0 deletions dev-scripts/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
database:
image: 'postgres:15.7'
container_name: kino_db

ports:
- 5432:5432

environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres

volumes:
- ./sql/init.sql:/docker-entrypoint-initdb.d/init.sql
5 changes: 5 additions & 0 deletions dev-scripts/sql/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE DATABASE kino;
CREATE USER kino WITH PASSWORD 'kino';
ALTER DATABASE kino owner to kino;
ALTER ROLE kino SET client_encoding TO 'utf8';
ALTER ROLE kino SET timezone TO 'UTC';
26 changes: 18 additions & 8 deletions dev/user.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
(ns user
(:require [integrant.repl :as ig-repl]
[clojure.tools.namespace.repl :refer [set-refresh-dirs]]
[kino.system :as system]))

#_(set-init! #'base-system)
; type (start) in the repl to start your development-time system.

(set-refresh-dirs "src")
[kino.system :as system]
[ragtime.jdbc :as rt-jdbc]
[ragtime.repl :as rt-repl]))

(ig-repl/set-prep! (fn [] system/config))

Expand All @@ -19,4 +15,18 @@
(go)
(halt)
(reset)
(reset-all))
(reset-all))

;; ragtime

(comment
(let [db (:db (:config/settings integrant.repl.state/system))
rt-config {:datastore (rt-jdbc/sql-database db)
:migrations (rt-jdbc/load-resources "migrations")}]
(rt-repl/migrate rt-config)))

(comment
(let [db (:db (:config/settings integrant.repl.state/system))
rt-config {:datastore (rt-jdbc/sql-database db)
:migrations (rt-jdbc/load-resources "migrations")}]
(rt-repl/rollback rt-config)))
Loading

0 comments on commit d9b59db

Please sign in to comment.