Skip to content

Commit 812bc11

Browse files
authored
Merge pull request #26 from shiv3/feat/desktop-app
feat: desktop application that Tauri based
2 parents f0a0370 + fc3da1b commit 812bc11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+632
-2
lines changed

.github/workflows/manual-release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Manual Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to release (e.g., 1.0.0)'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
create-release:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
outputs:
17+
release_id: ${{ steps.create_release.outputs.id }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Create Release
22+
id: create_release
23+
uses: actions/github-script@v7
24+
with:
25+
script: |
26+
const { data } = await github.rest.repos.createRelease({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
tag_name: `v${{ inputs.version }}`,
30+
name: `OCPP CP Simulator v${{ inputs.version }}`,
31+
draft: true,
32+
prerelease: false,
33+
generate_release_notes: true
34+
});
35+
return data.id;
36+
37+
build-tauri:
38+
needs: create-release
39+
permissions:
40+
contents: write
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
include:
45+
- platform: 'macos-latest'
46+
args: '--target aarch64-apple-darwin'
47+
- platform: 'macos-latest'
48+
args: '--target x86_64-apple-darwin'
49+
- platform: 'ubuntu-22.04'
50+
args: ''
51+
- platform: 'windows-latest'
52+
args: ''
53+
54+
runs-on: ${{ matrix.platform }}
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- name: Setup Node
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: lts/*
62+
63+
- name: Install Rust stable
64+
uses: dtolnay/rust-toolchain@stable
65+
with:
66+
targets: ${{ matrix.args && (matrix.args | regex_replace('.*--target\s+(\S+).*', '\1')) || '' }}
67+
68+
- name: Install dependencies (Ubuntu only)
69+
if: matrix.platform == 'ubuntu-22.04'
70+
run: |
71+
sudo apt-get update
72+
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
73+
74+
- name: Install frontend dependencies
75+
run: npm install
76+
77+
- name: Build Tauri app
78+
uses: tauri-apps/tauri-action@v0
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
with:
82+
releaseId: ${{ needs.create-release.outputs.release_id }}
83+
args: ${{ matrix.args }}

.github/workflows/release.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Release Desktop App
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
release:
11+
permissions:
12+
contents: write
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- platform: 'macos-latest'
18+
args: '--target aarch64-apple-darwin'
19+
target: 'aarch64-apple-darwin'
20+
- platform: 'macos-latest'
21+
args: '--target x86_64-apple-darwin'
22+
target: 'x86_64-apple-darwin'
23+
- platform: 'ubuntu-22.04'
24+
args: ''
25+
target: 'x86_64-unknown-linux-gnu'
26+
- platform: 'windows-latest'
27+
args: ''
28+
target: 'x86_64-pc-windows-msvc'
29+
30+
runs-on: ${{ matrix.platform }}
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Setup Node
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: lts/*
38+
39+
- name: Install Rust stable
40+
uses: dtolnay/rust-toolchain@stable
41+
with:
42+
targets: ${{ matrix.target }}
43+
44+
- name: Install dependencies (Ubuntu only)
45+
if: matrix.platform == 'ubuntu-22.04'
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
49+
50+
- name: Install frontend dependencies
51+
run: npm install
52+
53+
- name: Generate app icon
54+
run: |
55+
cd src-tauri
56+
npx @tauri-apps/cli icon icons/icon.svg
57+
58+
- name: Build Tauri app
59+
uses: tauri-apps/tauri-action@v0
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
with:
63+
tagName: ${{ github.ref_name }}
64+
releaseName: 'OCPP CP Simulator ${{ github.ref_name }}'
65+
releaseBody: |
66+
See the assets to download this version and install.
67+
68+
## What's Changed
69+
70+
### Desktop App Downloads
71+
- **macOS (Apple Silicon)**: `OCPP.CP.Simulator_*_aarch64.dmg`
72+
- **macOS (Intel)**: `OCPP.CP.Simulator_*_x64.dmg`
73+
- **Windows**: `OCPP.CP.Simulator_*_x64-setup.exe` or `.msi`
74+
- **Linux**: `ocpp-cp-simulator_*_amd64.AppImage` or `.deb`
75+
76+
### Web Version
77+
The web version is available at: https://shiv3.github.io/ocpp-cp-simulator/
78+
releaseDraft: true
79+
prerelease: false
80+
args: ${{ matrix.args }}
81+
82+
update-release-notes:
83+
needs: release
84+
runs-on: ubuntu-latest
85+
permissions:
86+
contents: write
87+
steps:
88+
- uses: actions/checkout@v4
89+
with:
90+
fetch-depth: 0
91+
92+
- name: Generate release notes
93+
uses: actions/github-script@v7
94+
with:
95+
script: |
96+
const { data: release } = await github.rest.repos.getReleaseByTag({
97+
owner: context.repo.owner,
98+
repo: context.repo.repo,
99+
tag: context.ref.replace('refs/tags/', '')
100+
});
101+
102+
// Get commit history
103+
let body = release.body;
104+
105+
try {
106+
const { data: commits } = await github.rest.repos.compareCommits({
107+
owner: context.repo.owner,
108+
repo: context.repo.repo,
109+
base: 'v0.0.0', // Previous tag - update this
110+
head: context.ref.replace('refs/tags/', '')
111+
});
112+
113+
const commitList = commits.commits
114+
.map(c => `- ${c.commit.message.split('\n')[0]} (${c.sha.substring(0, 7)})`)
115+
.join('\n');
116+
117+
body = body.replace('## What\'s Changed', `## What's Changed\n\n### Commits\n${commitList}\n`);
118+
} catch (e) {
119+
console.log('Failed to get commit history:', e.message);
120+
}
121+
122+
await github.rest.repos.updateRelease({
123+
owner: context.repo.owner,
124+
repo: context.repo.repo,
125+
release_id: release.id,
126+
body: body
127+
});

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ dist-ssr
2222
*.njsproj
2323
*.sln
2424
*.sw?
25+
26+
# Tauri
27+
src-tauri/target/
28+
src-tauri/Cargo.lock
29+
src-tauri/gen/

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,72 @@
11
# OCPP Simulator
22

3-
OCPP charger simulator written in react that works stand-alone
3+
OCPP charger simulator written in React that works as a standalone web app or desktop application.
44

5+
## Web Version
56
https://shiv3.github.io/ocpp-cp-simulator/#config=%7B"wsURL"%3A"wss%3A%2F%2Flocalhost%3A8080%2F"%2C"connectorNumber"%3A2%2C"ChargePointID"%3A"test-cp"%2C"tagID"%3A"test-tag"%2C"ocppVersion"%3A"OCPP-1.6J"%2C"Experimental"%3Anull%7D
67

8+
## Desktop Application
9+
10+
### Download
11+
Download the latest desktop version from the [Releases](https://github.com/shiv3/ocpp-cp-simulator/releases) page.
12+
13+
Available for:
14+
- **macOS**:
15+
- Apple Silicon: `OCPP.CP.Simulator_*_aarch64.dmg`
16+
- Intel: `OCPP.CP.Simulator_*_x64.dmg`
17+
- **Windows**: `OCPP.CP.Simulator_*_x64-setup.exe` or `.msi`
18+
- **Linux**:
19+
- AppImage: `ocpp-cp-simulator_*_amd64.AppImage` (recommended)
20+
- Debian/Ubuntu: `ocpp-cp-simulator_*_amd64.deb`
21+
22+
### Installation
23+
24+
#### macOS
25+
1. Download the appropriate `.dmg` file for your processor
26+
2. Open the downloaded file
27+
3. Drag the OCPP CP Simulator app to your Applications folder
28+
4. First time opening: Right-click and select "Open" to bypass Gatekeeper
29+
30+
#### Windows
31+
1. Download the `.exe` or `.msi` installer
32+
2. Run the installer
33+
3. Follow the installation wizard
34+
4. The app will be available in your Start Menu
35+
36+
#### Linux
37+
**AppImage (Recommended)**
38+
1. Download the `.AppImage` file
39+
2. Make it executable: `chmod +x ocpp-cp-simulator_*.AppImage`
40+
3. Run: `./ocpp-cp-simulator_*.AppImage`
41+
42+
**Debian/Ubuntu**
43+
1. Download the `.deb` file
44+
2. Install: `sudo dpkg -i ocpp-cp-simulator_*.deb`
45+
3. Or double-click to install with Software Center
46+
47+
### Development
48+
49+
To run the desktop app in development mode:
50+
51+
```bash
52+
# Install dependencies
53+
npm install
54+
55+
# Run in development mode
56+
npm run tauri:dev
57+
58+
# Build for production
59+
npm run tauri:build
60+
```
61+
62+
#### Prerequisites for Development
63+
- Node.js (v18 or later)
64+
- Rust (latest stable)
65+
- Platform-specific dependencies:
66+
- **Linux**: `libwebkit2gtk-4.1-dev`, `libappindicator3-dev`, `librsvg2-dev`, `patchelf`
67+
- **macOS**: Xcode Command Line Tools
68+
- **Windows**: Microsoft Visual Studio C++ Build Tools
69+
770
<img width="1532" alt="image" src="https://github.com/user-attachments/assets/480f6e76-a426-4f0c-b133-a62a03f0847e">
871

972

0 commit comments

Comments
 (0)