Skip to content

ci: Add github workflow for nitro node #60

ci: Add github workflow for nitro node

ci: Add github workflow for nitro node #60

name: Test install nitro-node
on:
schedule:
- cron: "0 20 * * *" # At 0:20 UTC, which is 7:20 AM UTC+7
push:
branches:
- main
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
paths:
- ".github/scripts/e2e-test-install-nitro-node.js"
- ".github/workflows/test-install-nitro-node.yml"
- "nitro-node/**"
pull_request:
types: [opened, synchronize, reopened]
paths:
- ".github/scripts/e2e-test-install-nitro-node.js"
- ".github/workflows/test-install-nitro-node.yml"
- "nitro-node/**"
workflow_dispatch:
jobs:
linux-pack-tarball:
runs-on: ubuntu-latest
outputs:
tarball-url: ${{ steps.upload.outputs.artifact-url }}
steps:
- name: Clone
id: checkout
uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Build tarball
id: build
run: |
cd nitro-node
make pack
find . -type f -name 'janhq-nitro-node-*.tgz' -exec mv {} janhq-nitro-node.tgz \;
- name: Upload tarball as artifact
id: upload
uses: actions/upload-artifact@master
with:
name: janhq-nitro-node
path: nitro-node/janhq-nitro-node.tgz
if-no-files-found: error
install:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
needs: [linux-pack-tarball]
if: always() && needs.linux-pack-tarball.result == 'success'
steps:
- name: Clone
id: checkout
uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Enable yarn
run: |
corepack enable
corepack prepare yarn@1 --activate
- name: Download prebuilt tarball
uses: actions/download-artifact@master
with:
name: janhq-nitro-node
path: .github/scripts/
- name: List tarball content
id: tar-tf
run: |
cd .github
cd scripts
tar tf janhq-nitro-node.tgz
- name: Run tests
id: test_install_nitro_node
env:
NITRO_NODE_PKG: ${{ github.workspace }}/.github/scripts/janhq-nitro-node.tgz
run: |
cd .github
cd scripts
node e2e-test-install-nitro-node.js