Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into refacotor/add-clj…
Browse files Browse the repository at this point in the history
…s-env
  • Loading branch information
defclass committed Feb 2, 2021
2 parents 49da4f4 + 8339121 commit 8d868bf
Show file tree
Hide file tree
Showing 108 changed files with 5,415 additions and 2,484 deletions.
280 changes: 280 additions & 0 deletions .github/workflows/build-desktop-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,280 @@
# This is a basic workflow to help you get started with Actions

name: Build-Desktop-Release

on:
workflow_dispatch:
inputs:
tag-version:
description: "Release Tag Version"
required: true
git-ref:
description: "Release Git Ref"
required: true
default: "master"
is-draft:
description: 'Draft Release? '
required: true
default: "true"
is-pre-release:
description: 'Pre Release?'
required: true
default: "true"

jobs:
compile-cljs:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v1

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 14

- name: Setup Java JDK
uses: actions/[email protected]
with:
java-version: 1.8

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven

- name: Install clojure
run: |
curl -O https://download.clojure.org/install/linux-install-1.10.1.763.sh
chmod +x linux-install-1.10.1.763.sh
sudo ./linux-install-1.10.1.763.sh
- name: Compile CLJS
run: yarn install --frozen-lockfile && gulp build && yarn cljs:release

- name: Update APP Version
run: |
sed -i 's/"version": "0.0.1"/"version": "${{ github.event.inputs.tag-version }}"/g' ./package.json
working-directory: ./static

- name: Update OSX Packager Config
run: |
sed -i 's/appleId: "my-fake-apple-id"/appleId: "${{ secrets.APPLE_ID_EMAIL }}"/' ./forge.config.js
sed -i 's/appleIdPassword: "my-fake-apple-id-password"/appleIdPassword: "${{ secrets.APPLE_ID_PASSWORD }}"/' ./forge.config.js
working-directory: ./static

- name: Display Package.json
run: cat ./package.json
working-directory: ./static

- name: List Files
run: ls -al
working-directory: ./static

- name: Compress Static Files
run: zip -r static.zip ./static

- name: Cache Static File
uses: actions/upload-artifact@v1
with:
name: static.zip
path: static.zip

build-linux:
runs-on: ubuntu-latest
needs: [ compile-cljs ]
steps:
- name: Download The Static Asset
uses: actions/download-artifact@v1
with:
name: static.zip
path: ./

- name: Uncompress Static FIles
run: unzip static.zip

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 14

- name: Cache Node Modules
uses: actions/cache@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-modules

- name: Build/Release Electron App
run: yarn install --frozen-lockfile && yarn electron:make
working-directory: ./static

- name: Change Artifact Name
run: mv static/out/make/zip/linux/x64/logseq-linux-x64-*.zip static/out/make/zip/linux/x64/Logseq-linux.zip

- name: Cache Artifact
uses: actions/upload-artifact@v1
with:
name: Logseq-linux.zip
path: static/out/make/zip/linux/x64/Logseq-linux.zip

build-windows:
runs-on: windows-latest
needs: [ compile-cljs ]
steps:
- name: Download The Static Asset
uses: actions/download-artifact@v1
with:
name: static.zip
path: ./

- name: Uncompress Static FIles
run: unzip static.zip

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 14

- name: Cache Node Modules
uses: actions/cache@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-modules

- name: Build/Release Electron app
run: yarn install --frozen-lockfile && yarn electron:make
working-directory: ./static

- name: Change Artifact Name
run: Get-ChildItem static\out\make\squirrel.windows\x64\*.exe | Rename-Item -NewName Logseq-win64.exe

- name: List Directory
run: dir
working-directory: static/out/make/squirrel.windows/x64/

- name: Cache Artifact
uses: actions/upload-artifact@v1
with:
name: Logseq-win64.exe
path: static/out/make/squirrel.windows/x64/Logseq-win64.exe

build-macos:
needs: [ compile-cljs ]
runs-on: macos-latest

steps:
- name: Download The Static Asset
uses: actions/download-artifact@v1
with:
name: static.zip
path: ./

- name: Uncompress Static Files
run: unzip ./static.zip

- name: List Static Files
run: ls -al ./static

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 14

- name: Signing By Apple Developer ID
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATES_P12 }}
p12-password: ${{ secrets.APPLE_CERTIFICATES_P12_PASSWORD }}

- name: Cache Node Modules
uses: actions/cache@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-modules

- name: Build/Release Electron App
run: yarn install --frozen-lockfile && yarn electron:make
working-directory: ./static

- name: Change Artifact Name
run: mv static/out/make/Logseq.dmg static/out/make/Logseq-x64.dmg

- name: Cache Artifact
uses: actions/upload-artifact@v1
with:
name: Logseq-x64.dmg
path: static/out/make/Logseq-x64.dmg

release:
needs: [ build-macos, build-linux, build-windows ]
runs-on: ubuntu-latest

steps:
- name: Download The MacOS X64 Artifact
uses: actions/download-artifact@v1
with:
name: Logseq-x64.dmg
path: ./

- name: Download The Linux Artifact
uses: actions/download-artifact@v1
with:
name: Logseq-linux.zip
path: ./

- name: Download The Windows Artifact
uses: actions/download-artifact@v1
with:
name: Logseq-win64.exe
path: ./

- name: List files
run: ls -rl

- name: Create Release Draft
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.tag-version }}
release_name: Desktop APP ${{ github.event.inputs.tag-version }} (Alpha Testing)
draft: ${{ github.event.inputs.is-draft }}
prerelease: ${{ github.event.inputs.is-pre-release }}

- name: Upload MacOS X64 Artifact
id: upload-macos-x64-artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Logseq-x64.dmg
asset_name: logseq-darwin-x64-${{ github.event.inputs.tag-version }}.dmg
asset_content_type: application/x-apple-diskimage

- name: Upload Linux Artifact
id: upload-linux-artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Logseq-linux.zip
asset_name: logseq-linux-x64-${{ github.event.inputs.tag-version }}.zip
asset_content_type: application/zip

- name: Upload Windows Artifact
id: upload-win-artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./Logseq-win64.exe
asset_name: logseq-win-x64-${{ github.event.inputs.tag-version }}.exe
asset_content_type: application/octet-stream
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ report.html
strings.csv

.calva
resources/electron.js
.clj-kondo/
.lsp/
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Use it to organize your todo list, to write your journals, or to record your uni

## Why Logseq?

[Logseq](https://logseq.com) is a freedom-respecting (and open-source too) platform for knowledge sharing and management. It focuses on privacy, longevity, and user control.
[Logseq](https://logseq.com) is a platform for knowledge sharing and management. It focuses on privacy, longevity, and user control.
Notice: the backend code will not be open-sourced for security reasons and other potential risks.

The server will never store or analyze your private notes. Your data are plain text files and we currently support both Markdown and Emacs Org mode (more to be added soon).

Expand Down Expand Up @@ -68,7 +69,7 @@ The following is for developers and designers who want to build and run Logseq l
### 1. Requirements

- [Node.js](https://nodejs.org/en/download/) & [Yarn](https://classic.yarnpkg.com/en/docs/install/)
- [Java & Clojure](https://clojure.org/guides/getting_started)
- [Java & Clojure](https://clojure.org/guides/getting_started). (If you run into `Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2). -M:cljs (No such file or directory)`, it means you have a wrong Clojure version installed. Please uninstall it and follow the instructions linked.)

### 2. Compile to JavaScript

Expand All @@ -88,6 +89,40 @@ Open <http://localhost:3001>.
yarn release
```

### 5. Run tests

Run ClojureScript tests
```bash
yarn
yarn cljs:test
node static/tests.js
```

Run Clojure tests. (Note: `.cljc` files may be tested both by ClojureScript, and Clojure.)
```bash
clj -Mtest-clj
```

## Desktop app development

### 1. Compile to JavaScript

``` bash
yarn watch
```

### 2. Open the debug app

``` bash
yarn debug-electron
```

### 3. Build a release

``` bash
yarn release-electron
```

## Alternative: Docker based development environment

### 1. Fetch sources
Expand Down Expand Up @@ -116,3 +151,7 @@ cd logseq
yarn
yarn watch
```

## Thanks

[![JetBrains](docs/assets/jetbrains.svg)](https://www.jetbrains.com/?from=logseq)
18 changes: 10 additions & 8 deletions deps.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{:paths ["src/main" "resources"]
:deps
{org.clojure/clojure {:mvn/version "1.10.0"}
cheshire/cheshire {:mvn/version "5.10.0"}
rum/rum {:mvn/version "0.12.3"}
;; rum {:local/root "/home/tienson/codes/source/clj/rum"}
;; persistent-sorted-set {:mvn/version "0.1.2"}
Expand Down Expand Up @@ -28,14 +29,13 @@
hiccups/hiccups {:mvn/version "0.3.0"}
tongue/tongue {:mvn/version "0.2.9"}
org.clojure/core.async {:mvn/version "1.3.610"}
thheller/shadow-cljs {:mvn/version "2.8.81"}
thheller/shadow-cljs {:mvn/version "2.11.14"}
expound/expound {:mvn/version "0.8.6"}
lambdaisland/glogi {:mvn/version "1.0.74"}}
lambdaisland/glogi {:mvn/version "1.0.74"}
binaryage/devtools {:mvn/version "1.0.2"}}

:aliases {:cljs {:extra-paths ["src/dev-cljs/" "src/test/"]
:aliases {:cljs {:extra-paths ["src/dev-cljs/" "src/test/" "src/electron/"]
:extra-deps {org.clojure/clojurescript {:mvn/version "1.10.764"}
thheller/shadow-cljs {:mvn/version "2.8.81"}
binaryage/devtools {:mvn/version "1.0.2"}
org.clojure/tools.namespace {:mvn/version "0.2.11"}
cider/cider-nrepl {:mvn/version "0.25.5"}
aero/aero {:mvn/version "1.1.6"}
Expand All @@ -48,9 +48,11 @@
aero/aero {:mvn/version "1.1.6"}
mhuebert/shadow-env {:mvn/version "0.1.6"}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
:runner
{:extra-deps

:test-clj
{:extra-paths ["src/test/"]
:extra-deps
{com.cognitect/test-runner
{:git/url "https://github.com/cognitect-labs/test-runner",
:sha "76568540e7f40268ad2b646110f237a60295fa3c"}},
:main-opts ["-m" "cognitect.test-runner" "-d" "test"]}}}
:main-opts ["-m" "cognitect.test-runner" "-d" "src/test"]}}}
Loading

0 comments on commit 8d868bf

Please sign in to comment.