Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 8 additions & 66 deletions .github/workflows/jan-electron-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ jobs:

- name: Update app version base on tag
run: |
if [[ ! "${VERSION_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Tag is not valid!"
exit 1
fi
jq --arg version "${VERSION_TAG#v}" '.version = $version' electron/package.json > /tmp/package.json
mv /tmp/package.json electron/package.json
make update-app-version
env:
VERSION_TAG: ${{ steps.tag.outputs.tag }}

Expand All @@ -49,32 +44,18 @@ jobs:
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}


- name: Build uikit
run: |
cd uikit
yarn install
yarn build

- name: Install yarn dependencies
run: |
yarn build:core
yarn install
yarn build:plugins
env:
APP_PATH: "."
DEVELOPER_ID: ${{ secrets.DEVELOPER_ID }}

- name: Build and publish app
run: |
yarn build:publish
make build-and-publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_LINK: "/tmp/codesign.p12"
CSC_KEY_PASSWORD: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
CSC_IDENTITY_AUTO_DISCOVERY: "true"
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APP_PATH: "."
DEVELOPER_ID: ${{ secrets.DEVELOPER_ID }}

build-windows-x64:
runs-on: windows-latest
Expand All @@ -99,34 +80,13 @@ jobs:
- name: Update app version base on tag
shell: bash
run: |
if [[ ! "${VERSION_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Tag is not valid!"
exit 1
fi
jq --arg version "${VERSION_TAG#v}" '.version = $version' electron/package.json > /tmp/package.json
mv /tmp/package.json electron/package.json
make update-app-version
env:
VERSION_TAG: ${{ steps.tag.outputs.tag }}

- name: Build uikit
run: |
cd uikit
yarn config set network-timeout 300000
yarn install
yarn build

- name: Install yarn dependencies
shell: powershell
run: |
yarn config set network-timeout 300000
yarn build:core
yarn install
$env:NITRO_VERSION = Get-Content .\plugins\inference-plugin\nitro\version.txt; echo $env:NITRO_VERSION
yarn build:plugins

- name: Build and publish app
run: |
yarn build:publish
make build-and-publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -158,31 +118,13 @@ jobs:

- name: Update app version base on tag
run: |
if [[ ! "${VERSION_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Tag is not valid!"
exit 1
fi
jq --arg version "${VERSION_TAG#v}" '.version = $version' electron/package.json > /tmp/package.json
mv /tmp/package.json electron/package.json
make update-app-version
env:
VERSION_TAG: ${{ steps.tag.outputs.tag }}

- name: Build uikit
run: |
cd uikit
yarn install
yarn build

- name: Install yarn dependencies
run: |
yarn config set network-timeout 300000
yarn build:core
yarn install
yarn build:plugins

- name: Build and publish app
run: |
yarn build:publish
make build-and-publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
43 changes: 3 additions & 40 deletions .github/workflows/jan-electron-linter-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,9 @@ jobs:
with:
node-version: 20

- name: Build uikit
run: |
cd uikit
yarn install
yarn build

- name: Linter and test
run: |
yarn config set network-timeout 300000
yarn build:core
yarn install
yarn lint
yarn build:plugins
yarn build:test
yarn test
make test
env:
CSC_IDENTITY_AUTO_DISCOVERY: "false"

Expand All @@ -81,24 +69,10 @@ jobs:
with:
node-version: 20

- name: Build uikit
run: |
yarn config set network-timeout 300000
cd uikit
yarn install
yarn build

- name: Linter and test
shell: powershell
run: |
yarn config set network-timeout 300000
yarn build:core
yarn install
$env:NITRO_VERSION = Get-Content .\plugins\inference-plugin\nitro\version.txt; echo $env:NITRO_VERSION
yarn build:plugins
yarn build:test
$env:CI="e2e"
yarn test
make test

test-on-ubuntu:
runs-on: [self-hosted, Linux, ubuntu-desktop]
Expand All @@ -118,19 +92,8 @@ jobs:
with:
node-version: 20

- name: Build uikit
run: |
cd uikit
yarn install
yarn build

- name: Linter and test
run: |
export DISPLAY=$(w -h | awk 'NR==1 {print $2}')
echo -e "Display ID: $DISPLAY"
yarn config set network-timeout 300000
yarn build:core
yarn install
yarn build:plugins
yarn build:test
yarn test
make test
62 changes: 62 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Makefile for Jan Electron App - Build, Lint, Test, and Clean

# Default target, does nothing
all:
@echo "Specify a target to run"

# Builds the UI kit
build-uikit:
ifeq ($(OS),Windows_NT)
cd uikit && yarn config set network-timeout 300000 && yarn install && yarn build
else
cd uikit && yarn install && yarn build
endif
# Updates the app version based on the tag
update-app-version:
if [[ ! "${VERSION_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then \
echo "Error: Tag is not valid!"; \
exit 1; \
fi
jq --arg version "${VERSION_TAG#v}" '.version = $version' electron/package.json > /tmp/package.json
mv /tmp/package.json electron/package.json

# Installs yarn dependencies and builds core and plugins
install-and-build: build-uikit
ifeq ($(OS),Windows_NT)
powershell -Command "yarn config set network-timeout 300000; \
$$env:NITRO_VERSION = Get-Content .\\plugins\\inference-plugin\\nitro\\version.txt; \
Write-Output \"Nitro version: $$env:NITRO_VERSION\"; yarn build:core; yarn install; yarn build:plugins"
else
yarn build:core
yarn install
yarn build:plugins
endif

dev: install-and-build
yarn dev

# Linting
lint: install-and-build
yarn lint

# Testing
test: lint
yarn build:test
yarn test

# Builds and publishes the app
build-and-publish: install-and-build
yarn build:publish

# Build
build: install-and-build
yarn build

clean:
ifeq ($(OS),Windows_NT)
powershell -Command "Get-ChildItem -Path . -Include node_modules, .next, dist -Recurse -Directory | Remove-Item -Recurse -Force"
else
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
find . -name ".next" -type d -exec rm -rf '{}' +
find . -name "dist" -type d -exec rm -rf '{}' +
endif
34 changes: 4 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ Contributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) fi

- node >= 20.0.0
- yarn >= 1.22.0
- make >= 3.81

### Instructions

Note: This instruction is tested on MacOS only.

1. **Clone the Repository:**

```bash
Expand All @@ -104,25 +103,10 @@ Note: This instruction is tested on MacOS only.
cd jan
```

2. **Install dependencies:**

```bash
yarn install

# Build core module
yarn build:core

# Packing base plugins
yarn build:plugins

# Packing uikit
yarn build:uikit
```

3. **Run development and Using Jan Desktop**
2. **Run development and Using Jan Desktop**

```
yarn dev
make dev
```

This will start the development server and open the desktop app.
Expand All @@ -134,19 +118,9 @@ Note: This instruction is tested on MacOS only.
# Do step 1 and 2 in previous section
git clone https://github.com/janhq/jan
cd jan
yarn install

# Build core module
yarn build:core

# Package base plugins
yarn build:plugins

# Packing uikit
yarn build:uikit

# Build the app
yarn build
make build
```

This will build the app MacOS m1/m2 for production (with code signing already done) and put the result in `dist` folder.
Expand Down