Skip to content

Commit

Permalink
Merge pull request #27 from qlrd/main
Browse files Browse the repository at this point in the history
Fixing tests
  • Loading branch information
qlrd authored Sep 16, 2023
2 parents 3e09b37 + 9cf13e6 commit b588ae0
Show file tree
Hide file tree
Showing 25 changed files with 295 additions and 184 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- new-ui
paths-ignore:
- "**.md"
#- "**.spec.js"
Expand Down
257 changes: 190 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,116 +1,239 @@
[![Build new-ui branch](https://github.com/selfcustody/krux-installer/actions/workflows/build.yml/badge.svg?branch=new-ui)](https://github.com/selfcustody/krux-installer/actions/workflows/build.yml)

# Krux Installer

Krux Installer (alpha versions) aims to be a GUI based tool to build, flash and debug [Krux](https://github.com/selfcustody/krux)
[![Build main branch](https://github.com/selfcustody/krux-installer/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/selfcustody/krux-installer/actions/workflows/build.yml)

As it now, the generated application execute, without typing any command in terminal,[flash the firmware onto the device](https://selfcustody.github.io/krux/getting-started/installing/#flash-the-firmware-onto-the-device), for Linux and Windows.
Krux Installer (alpha versions) aims to be a GUI based tool to build,
flash and debug [Krux](https://github.com/selfcustody/krux)

## TODOs
As it now, the generated application execute,
without typing any command in terminal.

For more information, see [flash the firmware onto the device](https://selfcustody.github.io/krux/getting-started/installing/#flash-the-firmware-onto-the-device).

## Tested machines

- Kendryte K210 devices:
- [x] Flash to M5stickV;
- [x] Flash to Sipeed Amigo;
- [x] Flash to Sipeed Bit;
- [x] Flash to Sipeed Dock;
- [ ] Build from source to M5stickV;
- [ ] Build from source to Sipeed Amigo;
- [ ] Build from source to Sipeed Bit;
- [ ] Build from source to Sipeed Dock;
- [ ] Debug for M5stickV;
- [ ] Debug for Sipeed Amigo;
- [ ] Debug for Sipeed Bit;
- [ ] Debug for Sipeed Dock;
- [odudex Android version](https://github.com/odudex/krux_binaries/tree/main/Android):
- [ ] Transfer to device;
- [ ] Build for device;
- [ ] Debug for device.
- Windows:
- [x] Build NSIS installer;
- [ ] Build Portable installer;
- [ ] Build AppX installer;
- Linux:
- [x] Build `AppImage` standalone;
- [ ] Build `deb` package for [apt-get](https://www.debian.org/doc/manuals/apt-howto/);
- [ ] Build `snap` package for [snapcraft](https://snapcraft.io/);
- [ ] Build `pacman` package for [pacman](https://wiki.archlinux.org/title/Pacman).
- MacOS:
- [x] Build DMG installer;
- [ ] Build PKG installer;
- [ ] Build MAS installer;
- Archlinux;
- Ubuntu;
- Windows:
- Windows 10

## Untested machines

- MacOS

**Help Wanted**: we need mac users!

## Install

You can download compiled binaries on [releases page](https://github.com/selfcustody/krux-installer/releases) or Build from source:
- See [releases page](https://github.com/selfcustody/krux-installer/releases);
or

- [Build from source](/#build-from-source)

## Build from source

### Download
### Download nodejs

First of all, you will need [Node.js](https://nodejs.org)
installed in you system. We recommend use the latest LTS version.

#### Download from Node.js binaries

You can install node.js in your system downloading it from official
[nodejs website](https://nodejs.org/en/download) and following
provided instructions.

#### Download from NVM (Node Version Manager)

Alternatively, if you have a linux or macos system,
you can have multiple versions of Node.js using [nvm](https://github.com/nvm-sh/nvm).

To install nvm,
follow the [instructions](https://github.com/nvm-sh/nvm#installing-and-updating).

Once installed,
we recomend to install the latest LTS node:

```bash
nvm install --lts
```

### Download repository

Now you can download the source code:

```bash
git clone https://github.com/qlrd/krux-installer.git
```

### Install dependencies

Install all dependencies:

```bash
yarn install
```

### Develop
Additionaly, you can upgrade dependencies to its latest versions.
Have some caution with this command, once that executing this command
can broke some functionalities, mainly those related to the use of
`google-chrome` and `chromiumdriver` in E2e tests.

**TIP**: Before execute this command, always check the latest supported
`chromium` version at
[Electron Stable Releases page](https://releases.electronjs.org/releases/stable)

When a change is made, we recommend to `lint`, `dev`, `build` and `test` procedures before make a commit or a PR:
```bash
yarn upgrade-interactive --latest
```

#### Lint
### Live compile to development environment

Verify code style and syntax errors:
When a change is made, we recommend to execute `dev` subcommand:

```bash
yarn lint
yarn run dev
```

#### Compiles to a development electron application

Run electron application with the (vite)[https://vitejs.dev/] server:
if you want to show some debug messages:

```bash
yarn dev
DEBUG=krux:* yarn run dev
```

### Compiles and minifies for production
### Test

#### Prepare tests

To test,
you need to write `specification` tests under `pageobjects` definitions:

- You can write your own [E2E](https://webdriver.io)
specification test files on `test/e2e/specs` folder;

Before running build, verify [builder config](electron-builder.json5) to setup the build targets. The `<target>` depends depends on the running platform (i.e., linux, darwin, win32):
- You can define the [PageObjects] on
`test/e2e/pageobjects` folder.

* Linux:
* `AppImage`
* `deb`
* `snap`
Before run tests,
you will need to **build** the application.

* Windows:
* `nsis`
* `portable`
* `AppX`
#### Build

* Mac:
* `dmg`
* `pkg`
* `mas`
Before running build,
verify [builder config](electron-builder.json5)
to setup the build `target` on specific `os` (Operational System).

The `<target>` depends depends on the running platform
(i.e., `linux`, `darwin` -- MacOS, and `win32` -- Windows).

Then run:
For more information,
see [Electron Builder](https://www.electron.build/configuration/configuration)
page.

#### Run all tests

The `wdio.conf.mts` is configured to check
if your system have `krux.zip.*` resources.

- If not, it will, run all tests, including download tests;
- If yes, it will skip tests that download resources.

```bash
yarn run build
```

If you want to build a specific `target`
to a specifi `os`, run

```bash
yarn run build --<os> <target>
```

If you want to debug some messages, add the
`DEBUG` environment variable.

In linux/mac:

```bash
DEBUG=krux:* yarn run build --<os> <target>
```

##### Filter tests

Additionaly, you can filter some tests with
`--filter` option and a based regular expression argument.

For example, if you want to exclude tests until `25th` test,
you can do this:

```bash
yarn run e2e --filter '0([0-1][0-9]|2[0-4]).*.spec.ts'
```

if you want to debug some messages:

```bash
yarn build <target>
DEBUG=krux:* yarn run e2e --filter '0([0-1][0-9]|2[0-4]).*.spec.ts'
```

#### Builtin OpenSSL for windows in KruxInstaller
#### WARNING: Builtin OpenSSL for windows in KruxInstaller

When downloading official krux firmware versions,
it is necessary to verify the signature through the OpenSSL tool,
as a way to verify the authenticity of the downloaded binaries.

When downloading official krux firmware versions, it is necessary to verify the signature through the OpenSSL tool, as a way to verify the authenticity of the downloaded binaries.
On "Unix like" releases (Linux and MacOS),
verification is easily done since such tool
exists natively in operating system.

On Unix like releases (Linux and MacOS), verification is easily done since such tool exists natively in operating system.
In windows release,
we are faced with the peculiarity of the operating system in question
do not have such a tool
(see this [issue](https://github.com/qlrd/krux-installer/issues/2)).

In windows release, we are faced with the peculiarity of the operating system in question not having such a tool (see this [issue](https://github.com/qlrd/krux-installer/issues/2)).
So, we packaged a stable version of OpenSSL, and
compiled it from the [source](https://github.com/openssl/openssl).
The compilation process is done entirely in a reproducible virtual environment and,
therefore, not locally, with the github-action [compile-openssl-windows-action](https://github.com/qlrd/compile-openssl-windows-action/actions).

So, we packaged a stable version of OpenSSL, compiled from the [source](https://github.com/openssl/openssl). The compilation process is done entirely in a reproducible virtual environment and, therefore, not locally, with the github-action [compile-openssl-windows-action](https://github.com/qlrd/compile-openssl-windows-action/actions).
Since it is compiled in a virtual environment on github:

Since it is compiled in a virtual environment on github, it is expected to be fully verifiable and free of malicious code. You can check the build steps in [actions](https://github.com/qlrd/krux-installer/actions).
- it is expected to be fully verifiable and free of malicious code;
- it is expected that, if you're developing in Windows machine,
some difficulties will be appear.
- You can check the build steps in [actions](https://github.com/qlrd/krux-installer/actions).

## TODOs

- Kendryte K210 devices:
- [x] Flash to M5stickV;
- [x] Flash to Sipeed Amigo;
- [x] Flash to Sipeed Bit;
- [x] Flash to Sipeed Dock;
- [ ] Flash to Yahboom Aimotion
- [ ] Build from source to M5stickV;
- [ ] Build from source to Sipeed Amigo;
- [ ] Build from source to Sipeed Bit;
- [ ] Build from source to Sipeed Dock;
- [ ] Debug for M5stickV;
- [ ] Debug for Sipeed Amigo;
- [ ] Debug for Sipeed Bit;
- [ ] Debug for Sipeed Dock;
- [odudex Android version](https://github.com/odudex/krux_binaries/tree/main/Android):
- [ ] Transfer to device;
- [ ] Build for device;
- [ ] Debug for device.
- Windows:
- [x] Build NSIS installer;
- [ ] Build Portable installer;
- [ ] Build AppX installer;
- Linux:
- [x] Build `AppImage` standalone;
- [ ] Build `deb` package for [apt-get](https://www.debian.org/doc/manuals/apt-howto/);
- [ ] Build `snap` package for [snapcraft](https://snapcraft.io/);
- [ ] Build `pacman` package for [pacman](https://wiki.archlinux.org/title/Pacman).
- MacOS:
- [x] Build DMG installer;
- [ ] Build PKG installer;
- [ ] Build MAS installer;
13 changes: 12 additions & 1 deletion electron-builder.json5
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*/
{
"$schema": "https://raw.githubusercontent.com/electron-userland/electron-builder/master/packages/app-builder-lib/scheme.json",
"appId": "YourAppID",
"appId": "org.selfcustody.krux-installer",
"productName": "krux-installer",
"asar": true,
"directories": {
"output": "release/${version}"
Expand All @@ -21,6 +22,16 @@
"dmg"
]
},
"linux": {
"category": "Utility",
"icon": "public/icon.png",
"desktop": {
"Icon": "org.selfcustody.krux-installer",
"Keywords": "electron;krux;vite;vuetify;vue3;vue",
"Terminal": false
},
"target": [ "AppImage" ]
},
"win": {
"target": [
{
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"private": true,
"keywords": [
"electron",
"krux",
"vite",
"vuetify",
"vue3",
Expand All @@ -33,7 +34,8 @@
"dev": "vue-tsc --noEmit && vite",
"build": "vue-tsc --noEmit && vite build && electron-builder",
"preview": "vite preview",
"e2e": "wdio run wdio.conf.mts"
"e2e": "wdio run wdio.conf.mts",
"lint:md": "markdownlint README.md --ignore node_modules"
},
"devDependencies": {
"@babel/cli": "^7.22.9",
Expand All @@ -55,6 +57,7 @@
"electron": "^26.0.0",
"electron-builder": "^24.4.0",
"glob": "^10.3.3",
"markdownlint-cli": "^0.36.0",
"mocha": "^10.2.0",
"os-lang": "^3.1.1",
"rimraf": "^5.0.1",
Expand Down
Loading

0 comments on commit b588ae0

Please sign in to comment.