mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 12:38:39 -09:00
197 lines
6.8 KiB
YAML
197 lines
6.8 KiB
YAML
name: Node CI
|
|
on:
|
|
push:
|
|
branches:
|
|
workflow_dispatch:
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
NODE_VERSION: 20.x
|
|
jobs:
|
|
build:
|
|
runs-on: ${{matrix.os}}
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- macos-latest
|
|
- ubuntu-latest
|
|
#TODO re-enable these:
|
|
#- windows-latest
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Use Node.js ${{ env.NODE_VERSION }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- name: Fix node-gyp and Python
|
|
run: |
|
|
if [[ "$RUNNER_OS" == "macOS" ]]; then
|
|
brew install python-setuptools python-packaging
|
|
else
|
|
python3 -m pip install $EXTRA_ARGS packaging setuptools
|
|
fi
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
|
- uses: actions/cache/restore@v4
|
|
with:
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'app/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
- name: Install
|
|
run: yarn install
|
|
env:
|
|
npm_config_node_gyp: ${{ github.workspace }}${{ runner.os == 'Windows' && '\node_modules\node-gyp\bin\node-gyp.js' || '/node_modules/node-gyp/bin/node-gyp.js' }}
|
|
- name: Install libarchive-tools
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install libarchive-tools
|
|
- name: Lint and Run Unit Tests
|
|
run: yarn run test
|
|
- name: Getting Build Icon
|
|
if: github.ref == 'refs/heads/canary' || github.base_ref == 'canary'
|
|
run: |
|
|
cp build/canary.ico build/icon.ico
|
|
cp build/canary.icns build/icon.icns
|
|
- name: Build
|
|
run: |
|
|
if [ -z "$CSC_LINK" ] ; then unset CSC_LINK ; fi
|
|
if [ -z "$CSC_KEY_PASSWORD" ] ; then unset CSC_KEY_PASSWORD ; fi
|
|
if [ -z "$WIN_CSC_LINK" ] ; then unset WIN_CSC_LINK ; fi
|
|
if [ -z "$WIN_CSC_KEY_PASSWORD" ] ; then unset WIN_CSC_KEY_PASSWORD ; fi
|
|
if [ -z "$APPLE_ID" ] ; then unset APPLE_ID ; fi
|
|
if [ -z "$APPLE_APP_SPECIFIC_PASSWORD" ] ; then unset APPLE_APP_SPECIFIC_PASSWORD ; fi
|
|
yarn run dist
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
CSC_LINK: ${{ secrets.MAC_CERT_P12_BASE64 }}
|
|
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERT_P12_PASSWORD }}
|
|
WIN_CSC_LINK: ${{ secrets.WIN_CERT_P12_BASE64 }}
|
|
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CERT_P12_PASSWORD }}
|
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
|
- name: Archive Build Artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hyper-${{ runner.os }}-${{ matrix.name }}
|
|
path: |
|
|
dist/*.dmg
|
|
dist/*.snap
|
|
dist/*.AppImage
|
|
dist/*.deb
|
|
dist/*.pacman
|
|
dist/*.exe
|
|
- name: Run E2E Tests
|
|
if: runner.os != 'Linux'
|
|
run: yarn run test:e2e --verbose
|
|
- name: Run E2E Tests on Linux
|
|
if: runner.os == 'Linux'
|
|
uses: GabrielBB/xvfb-action@v1.7
|
|
with:
|
|
run: |
|
|
yarn run test:e2e
|
|
env:
|
|
SHELL: /bin/bash
|
|
DEBUG: "pw:browser*"
|
|
- name: Archive E2E test screenshot
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: e2e-${{ matrix.os }}-${{ strategy.job-index }}
|
|
path: dist/tmp/*.png
|
|
- name: Save the pr number in an artifact
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
PR_NUM: ${{ github.event.number }}
|
|
run: echo $PR_NUM > pr_num.txt
|
|
- name: Upload the pr num
|
|
uses: actions/upload-artifact@v4
|
|
if: github.event_name == 'pull_request'
|
|
with:
|
|
name: pr_num
|
|
path: ./pr_num.txt
|
|
- uses: actions/cache/save@v4
|
|
if: github.event_name == 'push'
|
|
with:
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'app/yarn.lock') }}
|
|
|
|
build-linux-arm:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- name: armv7l
|
|
cpu: cortex-a8
|
|
image: raspios_lite:latest
|
|
- name: arm64
|
|
cpu: cortex-a53
|
|
image: raspios_lite_arm64:latest
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Use Node.js ${{ env.NODE_VERSION }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
- name: Fix node-gyp and Python
|
|
run: python3 -m pip install packaging setuptools
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
|
- uses: actions/cache/restore@v4
|
|
with:
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock', 'app/yarn.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-yarn-
|
|
- name: Install
|
|
run: |
|
|
yarn install
|
|
sudo apt update
|
|
sudo apt install libarchive-tools
|
|
- name: Compile
|
|
run: yarn run build
|
|
- name: rebuild node-pty
|
|
uses: pguyot/arm-runner-action@v2.6.5
|
|
with:
|
|
image_additional_mb: 2000
|
|
base_image: ${{ matrix.image }}
|
|
cpu: ${{ matrix.cpu }}
|
|
shell: bash
|
|
copy_artifact_path: target/node_modules/node-pty
|
|
copy_artifact_dest: target/node_modules
|
|
commands: |
|
|
wget https://nodejs.org/dist/v18.16.0/node-v18.16.0-linux-${{ matrix.name }}.tar.xz
|
|
tar -xJf node-v18.16.0-linux-${{ matrix.name }}.tar.xz
|
|
sudo cp node-v18.16.0-linux-${{ matrix.name }}/* /usr/local/ -R
|
|
npm run rebuild-node-pty
|
|
- name: chown node-pty
|
|
run: |
|
|
sudo chown -R $USER:$USER target/node_modules/node-pty
|
|
- name: Prepare v8 snapshot
|
|
if: matrix.name == 'armv7l'
|
|
run: |
|
|
sudo dpkg --add-architecture i386
|
|
sudo apt update
|
|
sudo apt install -y libglib2.0-0:i386 libexpat1:i386 libgcc-s1:i386
|
|
npm_config_arch=armv7l yarn run v8-snapshot:arch
|
|
- name: Build
|
|
run: yarn run electron-builder -l deb rpm AppImage pacman --${{ matrix.name }} -c electron-builder-linux-ci.json
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Archive Build Artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hyper-${{ runner.os }}-${{ matrix.name }}
|
|
path: |
|
|
dist/*.snap
|
|
dist/*.AppImage
|
|
dist/*.deb
|
|
dist/*.rpm
|
|
dist/*.pacman
|