Skip to content

Commit

Permalink
chore: refactor and test install podman (#563)
Browse files Browse the repository at this point in the history
* chore: podman install ci tests by container matrix

* feat: use package manager, not distro for installing podman

* add uninstall for distros. ubuntu22 specific install script

* feat: fix app package property tests

* feat: full add node, start node, stop node flow in e2e tests (off for now)

* chore: bump wdio minor versions

* chore: add distro and version to debug info

* chore: add fedora and other linux distros to e2e test containers

* chore: update gha xvfb to use nodejs v20

* chore: bump 6.0.2-alpha

* chore: add podman install verison in ci test
  • Loading branch information
jgresham authored May 9, 2024
1 parent a49819a commit e33a3a1
Show file tree
Hide file tree
Showing 46 changed files with 932 additions and 403 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'
2 changes: 1 addition & 1 deletion .github/workflows/e2e-test-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
2 changes: 2 additions & 0 deletions .github/workflows/staging-publish.yml
Original file line number Diff line number Diff line change
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
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
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 e33a3a1

Please sign in to comment.