Skip to content

refactor(proxy-ui): 优化会话详情页面布局和日志表格交互 #68

refactor(proxy-ui): 优化会话详情页面布局和日志表格交互

refactor(proxy-ui): 优化会话详情页面布局和日志表格交互 #68

Workflow file for this run

name: PR Check
on:
pull_request:
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
check:
name: Check (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: ubuntu-22.04
os: ubuntu-22.04
- name: windows-latest
os: windows-latest
- name: macos-arm64
os: macos-14
- name: macos-x64
os: macos-15
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libjavascriptcoregtk-4.1-dev \
build-essential \
curl \
wget \
file \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
patchelf
- name: Ensure WebView2 runtime (Windows)
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$exists = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\EdgeUpdate\Clients' -ErrorAction SilentlyContinue |
Where-Object { (Get-ItemProperty $_.PSPath).name -match 'WebView2 Runtime' }
if ($exists) {
Write-Host 'WebView2 Runtime already installed.'
return
}
Write-Host 'WebView2 Runtime not found, try winget...'
try {
winget install --id Microsoft.EdgeWebView2Runtime --exact --accept-package-agreements --accept-source-agreements --silent
return
} catch {
Write-Host 'winget failed, fallback to offline installer...'
}
$tmp = Join-Path $env:TEMP 'MicrosoftEdgeWebview2Setup.exe'
Invoke-WebRequest 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile $tmp
& $tmp /silent /install
$exists = Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\EdgeUpdate\Clients' -ErrorAction SilentlyContinue |
Where-Object { (Get-ItemProperty $_.PSPath).name -match 'WebView2 Runtime' }
if (-not $exists) { throw 'WebView2 Runtime install failed' }
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.19.0
cache: npm
cache-dependency-path: package-lock.json
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: 'src-tauri -> target'
cache-on-failure: true
- name: Install JS dependencies
run: npm ci
- name: npm run check
id: check
shell: bash
run: |
npm run check 2>&1 | tee check.log
continue-on-error: true
- name: npm run check:fix (diagnostic)
id: check_fix
if: steps.check.outcome == 'failure'
shell: bash
run: |
npm run check:fix 2>&1 | tee check-fix.log
continue-on-error: true
- name: npm run check (post-fix)
id: recheck
if: steps.check.outcome == 'failure'
shell: bash
run: |
npm run check 2>&1 | tee check-recheck.log
continue-on-error: true
- name: Collect logs
if: always()
shell: bash
run: |
[ -f check.log ] || echo 'log not generated' > check.log
[ -f check-fix.log ] || echo 'log not generated' > check-fix.log
[ -f check-recheck.log ] || echo 'log not generated' > check-recheck.log
- name: Upload logs
if: always()
uses: actions/upload-artifact@v4
with:
name: pr-check-${{ matrix.name }}
path: |
check.log
check-fix.log
check-recheck.log
- name: Save state for comment
if: always()
shell: bash
run: |
cat > state.json <<'EOF'
{
"platform": "${{ matrix.name }}",
"check": "${{ steps.check.outcome }}",
"fix": "${{ steps.check_fix.outcome }}",
"recheck": "${{ steps.recheck.outcome }}",
"artifact": "pr-check-${{ matrix.name }}",
"run_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"status": "${{ steps.check.outcome == 'success' && 'success' || (steps.check.outcome == 'failure' && steps.recheck.outcome == 'success' && 'fix_pass' || 'failed') }}",
"pr_number": "${{ github.event.pull_request.number }}"
}
EOF
cat state.json
- name: Upload state
if: always()
uses: actions/upload-artifact@v4
with:
name: pr-check-state-${{ matrix.name }}
path: state.json
- name: Fail if initial check failed
if: steps.check.outcome == 'failure'
run: exit 1