Skip to content

Commit

Permalink
Configure releases
Browse files Browse the repository at this point in the history
  • Loading branch information
nenadalm committed May 29, 2021
1 parent f19ae58 commit 98624a1
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 7 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,39 @@ jobs:
- run: clojure -M:cljfmt check
- run: clojure -M:clj-kondo
- run: clojure -M:test
release:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- uses: DeLaGuardo/setup-clojure@master
with:
cli: '1.10.3.855'
- uses: actions/cache@v2
with:
path: '~/.m2'
key: "${{ runner.os }}-maven-${{ hashFiles('deps.edn') }}"
restore-keys: |
${{ runner.os }}-maven-
- name: Create tag
id: create-tag
run: echo "::set-output name=tag::$(date +v%Y.%m.%d.%H%M)"
- name: Configure version
run: |
mkdir -p resources/META-INF/app
echo "version=${{ steps.create-tag.outputs.tag }}" > resources/META-INF/app/config.properties
- name: Build artifacts
run: make target/plv-portal.jar target/plv-reveal.jar
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: '${{ steps.create-tag.outputs.tag }}'
files: |
target/plv-portal.jar
target/plv-reveal.jar
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.cpcache/
/.clj-kondo/.cache/
/target/
/resources/
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,25 @@

## Usage

Just replace `<sha>` in the following command with some commit hash (probably latest on `master` branch) and you should see opened browser window with postgres logs>

```shell
tail -f /var/lib/pgsql/data/log/postgresql.csv | clojure -Sdeps '{:deps {github-nenadalm/postgresql-log-viewer {:git/url "https://github.com/nenadalm/postgresql-log-viewer" :sha "<sha>"}}}' -M:portal
```
First download jar in [releases](https://github.com/nenadalm/postgresql-log-viewer/releases) then follow instructions for specific ui below.

### UI

#### [Portal](https://github.com/djblue/portal#portal)

```shell
tail -f /var/lib/pgsql/data/log/postgresql.csv | java -jar ./plv-portal.jar
```

Command window: `Ctrl+Shift+P` or `Meta+Shift+P`

See [this video](https://youtu.be/gByyg-m0XOg?t=175) on how it can be used.

#### [Reveal](https://vlaaad.github.io/reveal/)

Replace `-M:portal` with `-M:reveal` in usage section in order to use this ui.
```shell
tail -f /var/lib/pgsql/data/log/postgresql.csv | java -jar ./plv-reveal.jar
```

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion deps.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:paths ["src"]
{:paths ["src" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.10.3"}
org.clojure/data.csv {:mvn/version "1.0.0"}
com.github.vertical-blank/sql-formatter {:mvn/version "2.0.0"}}
Expand Down
4 changes: 4 additions & 0 deletions extra-src/portal/app/portal.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[app.postgresql-log.core :as log]
[app.postgresql-log.parser :as log-parser]
[app.postgresql-log.reader :as log-reader]
[app.config :refer [config]]
[portal.api :as portal])
(:gen-class))

Expand All @@ -24,6 +25,9 @@
v))}))

(defn -main [& _]
(println (str "App info:\n"
" Version: " (:app.config/version config) "\n"
" UI: portal\n"))
(init-portal)
(log-reader/safe-read
(doseq [line (log-reader/read-csv *in*)]
Expand Down
4 changes: 4 additions & 0 deletions extra-src/reveal/app/reveal.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[app.postgresql-log.core :as log]
[app.postgresql-log.parser :as log-parser]
[app.postgresql-log.reader :as log-reader]
[app.config :refer [config]]
[vlaaad.reveal :as reveal]
[vlaaad.reveal.ext :as ve])
(:gen-class))
Expand Down Expand Up @@ -30,6 +31,9 @@
v)))}))

(defn -main [& _]
(println (str "App info:\n"
" Version: " (:app.config/version config) "\n"
" UI: reveal\n"))
(init-reveal)
(log-reader/safe-read
(doseq [line (log-reader/read-csv *in*)]
Expand Down
14 changes: 14 additions & 0 deletions src/app/config.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(ns app.config
(:require
[clojure.java.io]))

(defn- app-version []
(if-some [f (some-> "META-INF/app/config.properties"
clojure.java.io/resource
clojure.java.io/reader)]
(let [properties (java.util.Properties.)]
(.load properties f)
(.get properties "version"))
"unknown"))

(def config {:app.config/version (app-version)})

0 comments on commit 98624a1

Please sign in to comment.