chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,249 @@
|
||||
name: Pack Web CLI
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ref:
|
||||
description: 'Git ref to checkout (leave empty to use the triggering commit)'
|
||||
type: string
|
||||
default: ''
|
||||
append_commit_hash:
|
||||
description: 'Append short commit hash to artifact names'
|
||||
type: boolean
|
||||
default: false
|
||||
skip_code_quality:
|
||||
description: 'Skip code quality checks (caller already ran them)'
|
||||
type: boolean
|
||||
default: false
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
description: 'Git ref to checkout (leave empty to use the triggering commit)'
|
||||
type: string
|
||||
default: ''
|
||||
skip_code_quality:
|
||||
description: 'Skip code quality checks'
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
BUN_INSTALL_REGISTRY: 'https://registry.npmjs.org/'
|
||||
|
||||
jobs:
|
||||
code-quality:
|
||||
name: Code Quality
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ !inputs.skip_code_quality }}
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Setup bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Run postinstall
|
||||
run: bun run postinstall || true
|
||||
|
||||
- name: Run ESLint
|
||||
run: bun run lint
|
||||
|
||||
- name: Check Prettier formatting
|
||||
run: bun run format:check
|
||||
|
||||
- name: TypeScript type check
|
||||
run: bunx tsc --noEmit
|
||||
|
||||
- name: Run unit tests
|
||||
run: bunx vitest run
|
||||
|
||||
pack-web-cli:
|
||||
name: Pack web-cli ${{ matrix.platform }}-${{ matrix.arch }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: code-quality
|
||||
if: ${{ always() && (inputs.skip_code_quality || needs.code-quality.result == 'success') }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { platform: darwin, arch: arm64, os: macos-14 }
|
||||
- { platform: darwin, arch: x64, os: macos-14 }
|
||||
- { platform: linux, arch: x64, os: ubuntu-latest }
|
||||
- { platform: linux, arch: arm64, os: ubuntu-24.04-arm }
|
||||
- { platform: win32, arch: x64, os: windows-2022 }
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Get commit hash
|
||||
id: commit
|
||||
shell: bash
|
||||
run: |
|
||||
SHORT=$(git rev-parse --short HEAD)
|
||||
echo "short=$SHORT" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Setup bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Build desktop renderer (for static files)
|
||||
run: bunx electron-vite build --config packages/desktop/electron.vite.config.ts
|
||||
env:
|
||||
NODE_OPTIONS: '--max-old-space-size=8192'
|
||||
|
||||
- name: Pack web-cli tarball
|
||||
shell: bash
|
||||
run: node scripts/pack-web-cli.js
|
||||
env:
|
||||
PACK_PLATFORM: ${{ matrix.platform }}
|
||||
PACK_ARCH: ${{ matrix.arch }}
|
||||
# Version is pinned in repo-root package.json (aioncoreVersion).
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload tarball artifact
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: ${{ inputs.append_commit_hash && format('web-cli-{0}-{1}-{2}', matrix.platform, matrix.arch, steps.commit.outputs.short) || format('web-cli-{0}-{1}', matrix.platform, matrix.arch) }}
|
||||
path: |
|
||||
dist-web-cli/*.tar.gz
|
||||
dist-web-cli/*.sha256
|
||||
retention-days: 7
|
||||
|
||||
prepare-install-script:
|
||||
name: Prepare install-web.sh for release
|
||||
runs-on: ubuntu-latest
|
||||
needs: pack-web-cli
|
||||
if: ${{ always() && needs.pack-web-cli.result == 'success' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
|
||||
- name: Get commit hash
|
||||
id: commit
|
||||
shell: bash
|
||||
run: |
|
||||
SHORT=$(git rev-parse --short HEAD)
|
||||
echo "short=$SHORT" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Get version from package.json
|
||||
id: version
|
||||
run: |
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Replace __VERSION__ placeholder in install-web.sh
|
||||
run: |
|
||||
mkdir -p dist-scripts
|
||||
sed "s/__VERSION__/${{ steps.version.outputs.version }}/g" scripts/install-web.sh > dist-scripts/install-web.sh
|
||||
chmod +x dist-scripts/install-web.sh
|
||||
|
||||
- name: Upload install-web.sh artifact
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: ${{ inputs.append_commit_hash && format('install-web-script-{0}', steps.commit.outputs.short) || 'install-web-script' }}
|
||||
path: dist-scripts/install-web.sh
|
||||
retention-days: 7
|
||||
|
||||
smoke-test:
|
||||
name: Smoke test web-cli tarball (Linux x86_64)
|
||||
runs-on: ubuntu-latest
|
||||
needs: pack-web-cli
|
||||
if: ${{ always() && needs.pack-web-cli.result == 'success' }}
|
||||
container:
|
||||
image: debian:bookworm-slim
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y curl tar gzip nodejs
|
||||
|
||||
- name: Download linux-x86_64 tarball
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: web-cli-linux-x64
|
||||
path: dist-web-cli
|
||||
|
||||
- name: Run smoke test
|
||||
shell: bash
|
||||
run: |
|
||||
chmod +x scripts/smoke-test-web-cli.sh
|
||||
TARBALL=$(ls dist-web-cli/*.tar.gz | head -1)
|
||||
bash scripts/smoke-test-web-cli.sh "$TARBALL"
|
||||
|
||||
smoke-test-install:
|
||||
name: Smoke test install-web.sh (Linux x86_64)
|
||||
runs-on: ubuntu-latest
|
||||
needs: [pack-web-cli, prepare-install-script]
|
||||
if: ${{ always() && needs.pack-web-cli.result == 'success' && needs.prepare-install-script.result == 'success' }}
|
||||
container:
|
||||
image: debian:bookworm-slim
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y curl tar gzip nodejs coreutils
|
||||
|
||||
- name: Resolve version
|
||||
id: version
|
||||
shell: bash
|
||||
run: |
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "Resolved version: $VERSION"
|
||||
|
||||
- name: Download linux-x86_64 tarball
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: web-cli-linux-x64
|
||||
path: /tmp/releases/v${{ steps.version.outputs.version }}
|
||||
|
||||
- name: Download install-web.sh
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: install-web-script
|
||||
path: /tmp/releases
|
||||
|
||||
- name: Run smoke test
|
||||
shell: bash
|
||||
run: |
|
||||
chmod +x scripts/smoke-test-install-web.sh
|
||||
bash scripts/smoke-test-install-web.sh file:///tmp/releases ${{ steps.version.outputs.version }}
|
||||
Reference in New Issue
Block a user