mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
180 lines
No EOL
5.1 KiB
YAML
180 lines
No EOL
5.1 KiB
YAML
name: 'Build'
|
|
description: 'Builds, tests, and packages the app for release'
|
|
inputs:
|
|
node-version:
|
|
description: 'Node.js version to use'
|
|
required: true
|
|
matrix-name:
|
|
description: 'Matrix Name'
|
|
required: true
|
|
matrix-os:
|
|
description: 'Matrix OS'
|
|
required: true
|
|
upload-artifact:
|
|
description: 'Whether to upload artifacts'
|
|
required: false
|
|
default: 'true'
|
|
runs:
|
|
using: 'composite'
|
|
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: Set up Python 3.10
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Fix node-gyp and Python
|
|
shell: bash
|
|
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
|
|
shell: bash
|
|
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
|
|
shell: bash
|
|
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
|
|
shell: bash
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install libarchive-tools
|
|
|
|
- name: Rebuild native modules for Electron
|
|
shell: bash
|
|
run: npx electron-rebuild
|
|
|
|
- name: Lint and Run Unit Tests
|
|
shell: bash
|
|
run: yarn run test
|
|
|
|
- name: Getting Build Icon
|
|
shell: bash
|
|
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
|
|
shell: bash
|
|
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
|
|
|
|
# Retry if there's a fetch failure
|
|
yarn run dist || yarn run dist || yarn run dist
|
|
env:
|
|
GH_TOKEN: ${{ env.GH_TOKEN }}
|
|
CSC_LINK: ${{ env.MAC_CERT_P12_BASE64 }}
|
|
CSC_KEY_PASSWORD: ${{ env.MAC_CERT_P12_PASSWORD }}
|
|
WIN_CSC_LINK: ${{ env.WIN_CERT_P12_BASE64 }}
|
|
WIN_CSC_KEY_PASSWORD: ${{ env.WIN_CERT_P12_PASSWORD }}
|
|
APPLE_ID: ${{ env.APPLE_ID }}
|
|
APPLE_APP_SPECIFIC_PASSWORD: ${{ env.APPLE_PASSWORD }}
|
|
|
|
- name: Archive Build Artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hyper-${{ runner.os }}-${{ inputs.matrix-name }}
|
|
path: |
|
|
dist/*.dmg
|
|
dist/*.snap
|
|
dist/*.AppImage
|
|
dist/*.deb
|
|
dist/*.pacman
|
|
dist/*.exe
|
|
|
|
- name: Run E2E Tests
|
|
shell: bash
|
|
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-${{ inputs.matrix-os }}-${{ strategy.job-index }}
|
|
path: dist/tmp/*.png
|
|
|
|
- name: Save the pr number in an artifact
|
|
shell: bash
|
|
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') }}
|
|
|
|
- name: Archive Build Artifacts
|
|
if: ${{ inputs.upload-artifact == 'true' }}
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: hyper-${{ runner.os }}
|
|
path: |
|
|
dist/*.dmg
|
|
dist/*.snap
|
|
dist/*.AppImage
|
|
dist/*.deb
|
|
dist/*.pacman
|
|
dist/*.exe
|
|
|
|
# - name: Run E2E Tests (non-Linux)
|
|
# if: runner.os != 'Linux'
|
|
# shell: bash
|
|
# 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
|
|
# |