Skip to content

Commit

Permalink
Merge branch 'main' into l10n_main
Browse files Browse the repository at this point in the history
  • Loading branch information
jgresham authored May 9, 2024
2 parents e5a20a5 + 6f20303 commit ceee201
Show file tree
Hide file tree
Showing 63 changed files with 1,402 additions and 561 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/e2e-test-linux-distros.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: e2e-tests-linux-distros

on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
e2e-build-n-test:
environment: staging
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container: [
"ubuntu:24.04",
"ubuntu:23.10",
"debian:12",
"fedora:40",
"fedora:39",
"manjarolinux/base",
"archlinux:latest",
]
container:
image: ${{ matrix.container }}
env:
NODE_ENV: test
TEST: true

steps:
- uses: actions/checkout@v4
- name: 💚 Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: 🧱 Install system dependencies
run: |
# Define the packages needed (git req'd by electron forge)
packagesNeeded="nodejs npm git zip dpkg fakeroot"
# Determine the package manager and install required packages
if command -v apt-get > /dev/null 2>&1; then
apt-get update
apt-get install --no-install-recommends -y $packagesNeeded rpm libarchive-tools
apt-get install -y \
xvfb \
zip \
wget \
ca-certificates \
libnss3-dev \
libasound2t64 \
libxss1 \
libappindicator3-1 \
libindicator7 \
xdg-utils \
fonts-liberation \
libgbm1
elif command -v dnf > /dev/null 2>&1; then
dnf install -y $packagesNeeded rpmdevtools
elif command -v pacman > /dev/null 2>&1; then
pacman -Syu --noconfirm
pacman -S --noconfirm $packagesNeeded
elif command -v zypper > /dev/null 2>&1; then
zypper install -y $packagesNeeded
else
echo "FAILED TO INSTALL PACKAGES: Package manager not found. You must manually install: $packagesNeeded" >&2
exit 1
fi
- name: Install npm dependencies
run: npm ci

- name: 📦 Bundle Application
env:
DEBUG: "*electron*"
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
MP_PROJECT_TOKEN: ${{ secrets.MP_PROJECT_TOKEN }}
MP_PROJECT_ENV: ${{ vars.MP_PROJECT_ENV }}
NICENODE_ENV: ${{ vars.NICENODE_ENV }}
NO_CODE_SIGNING: true
run: |
npm run make
- name: Setup virtual display
run: |
export DISPLAY=':99.0'
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- name: 🧪 Run Tests
run: |
npm run wdio
- name: 🐛 Debug Build
uses: stateful/vscode-server-action@v1
if: failure()
with:
timeout: '120000'
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
# https://github.com/electron/forge/issues/2807
- if: ${{ matrix.os == 'macos-latest' }}
run: python3 -m pip install setuptools
run: python3 -m pip install setuptools --break-system-packages

- uses: actions/checkout@v4
- name: 💚 Use Node.js ${{ matrix.node-version }}
Expand All @@ -43,7 +43,7 @@ jobs:
ls -al
- name: 🧪 Run Tests
uses: coactions/setup-xvfb@v1
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
with:
run: npm run wdio
- name: 🐛 Debug Build
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/e2e-test-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ jobs:

- name: 🧱 Install Dependencies
run: |
npm ci
sudo apt-get update
sudo apt-get install --no-install-recommends -y rpm libarchive-tools
npm ci
- name: 📦 Bundle Application
env:
Expand All @@ -39,9 +40,10 @@ jobs:
npm run make
- name: 🧪 Run Tests
uses: coactions/setup-xvfb@v1
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
with:
run: npm run wdio

- name: 🐛 Debug Build
uses: stateful/vscode-server-action@v1
if: failure()
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/e2e-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ jobs:
run: npm run make

- name: 🧪 Run Tests
uses: coactions/setup-xvfb@v1
uses: coactions/setup-xvfb@6b00cf1889f4e1d5a48635647013c0508128ee1a
with:
run: npm run wdio

- name: 🐛 Debug Build
uses: stateful/vscode-server-action@v1
if: failure()
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
# https://github.com/electron/forge/issues/2807
- if: ${{ matrix.os == 'macos-latest' }}
run: python3 -m pip install setuptools
run: python3 -m pip install setuptools --break-system-packages

- name: Check out Git repository
uses: actions/checkout@v4
Expand All @@ -35,7 +35,7 @@ jobs:

- if: ${{ matrix.os == 'macos-latest' }}
name: Import Certs
uses: apple-actions/import-codesign-certs@v2
uses: slidoapp/import-codesign-certs@node20
with:
p12-file-base64: ${{ secrets.CSC_LINK }}
p12-password: ${{ secrets.CSC_KEY_PASSWORD }}
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/podman-install-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Podman Install on Linux Distros
on:
push:
# branches: [ main ]
workflow_dispatch:

jobs:
container-test-job:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container: [
"ubuntu:24.04",
"ubuntu:23.10",
"debian:12",
"fedora:40",
"fedora:39",
"manjarolinux/base",
"archlinux:latest",
]

container:
image: ${{ matrix.container }}
env:
NODE_ENV: test
steps:
- name: print os version details
run: cat /etc/os-release

- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- name: 🧱 Install Dependencies
run: |
npm ci
- name: 🧱 Run tests
run: |
npm run testCi
4 changes: 2 additions & 2 deletions .github/workflows/prod-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# https://github.com/electron/forge/issues/2807
- if: ${{ matrix.os == 'macos-latest' }}
run: python3 -m pip install setuptools
run: python3 -m pip install setuptools --break-system-packages

- name: Used variables
run: |
Expand All @@ -47,7 +47,7 @@ jobs:
- if: ${{ matrix.os == 'macos-latest' }}
name: Import Certs
uses: apple-actions/import-codesign-certs@v2
uses: slidoapp/import-codesign-certs@node20
with:
p12-file-base64: ${{ secrets.CSC_LINK }}
p12-password: ${{ secrets.CSC_KEY_PASSWORD }}
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/staging-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
# https://github.com/electron/forge/issues/2807
- if: ${{ matrix.os == 'macos-latest' }}
run: python3 -m pip install setuptools
run: python3 -m pip install setuptools --break-system-packages

- if: matrix.os == 'ubuntu-latest'
name: Install packages for building
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:

- if: ${{ matrix.os == 'macos-latest' }}
name: Import Certs
uses: apple-actions/import-codesign-certs@v2
uses: slidoapp/import-codesign-certs@node20
with:
p12-file-base64: ${{ secrets.CSC_LINK }}
p12-password: ${{ secrets.CSC_KEY_PASSWORD }}
Expand Down Expand Up @@ -78,6 +78,8 @@ jobs:
# This is used for uploading release assets to github
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

versionPostfix: '-staging'

run: |
npm run publish -- --arch=x64
npm run publish -- --arch=arm64
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env sh

npm run safeFix
npm run lint
# npm exec tsc
npm run package
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,16 @@ arch options include: ia32, x64, armv7l, arm64, mips64el, universal

Unit tests with `npm run test`

### Frontend (React) tests
`npm run test -- --config vite.renderer.config.ts --dir src/__tests__/react`

### Backend (Nodejs) tests
`npm run test -- --config vite.main.config.ts --dir src/__tests__/node`

### End-to-end (e2e) tests

For e2e tests, we use webdriver and an electron plugin to automate testing.
It requires a packaged build to complete the tests.
**It requires a packaged build to run the tests!**

To run them locally, package the source first (and after making any changes to anything other than `tests`), then run the e2e tests with `wdio`

Expand Down
66 changes: 35 additions & 31 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noImplicitAnyLet": "off",
"noExplicitAny": "off"
},
"complexity": {
"noForEach": "off"
},
"correctness": {
"useExhaustiveDependencies": "off"
}
}
},
"formatter": {
"indentStyle": "space"
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"files": {
"ignore": ["src/renderer/ethers.js", "src/main/util/*.js"]
}
"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noImplicitAnyLet": "off",
"noExplicitAny": "off"
},
"complexity": {
"noForEach": "off"
},
"correctness": {
"useExhaustiveDependencies": "off"
}
}
},
"formatter": {
"indentStyle": "space"
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"files": {
"ignore": [
"src/renderer/ethers.js",
"src/main/util/*.js",
"*genesis-l2.json"
]
}
}
4 changes: 3 additions & 1 deletion forge.config.cts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as path from 'node:path';
import packageJson from './package.json';

const { version } = packageJson;
const { versionPostfix } = process.env;

const iconDir = path.resolve('assets', 'icons');
console.log("forge.config.ts iconDir: ", iconDir);
Expand All @@ -25,7 +26,8 @@ const packagerConfig: ForgePackagerOptions = {
name: 'NiceNode Protocol',
schemes: ['nice-node'],
}
]
],
appVersion: versionPostfix ? `${version}${versionPostfix}` : version
// unsure if this is needed below:
// ignore: [ /stories/, /__tests__/, /.storybook/, /storybook/, /storybook-static/ ],
};
Expand Down
Loading

0 comments on commit ceee201

Please sign in to comment.