Skip to content

GPUI Compatibility #126

GPUI Compatibility

GPUI Compatibility #126

# =============================================================================
# GPUI Compatibility Check Workflow
# GPUI 兼容性检查工作流
# =============================================================================
#
# English:
# Monitors compatibility with the latest GPUI version. Performs:
# - Daily Checks: Automatically runs at 00:00 UTC every day
# - Manual Trigger: Can be manually triggered via workflow_dispatch
# - Version Detection: Checks for GPUI version updates
# - Build & Test: Builds and tests with the latest GPUI version
# - Issue Creation: Automatically creates GitHub issues if incompatibilities
# are detected
# - Issue Resolution: Automatically closes issues when compatibility is restored
#
# 中文:
# 监控与最新 GPUI 版本的兼容性。执行:
# - 每日检查:每天 UTC 时间 00:00 自动运行
# - 手动触发:可通过 workflow_dispatch 手动触发
# - 版本检测:检查 GPUI 版本更新
# - 构建和测试:使用最新 GPUI 版本进行构建和测试
# - Issue 创建:检测到不兼容时自动创建 GitHub issue
# - Issue 解决:恢复兼容性时自动关闭 issue
# =============================================================================
name: GPUI Compatibility
on:
schedule:
# Run daily at 00:00 UTC
- cron: '0 0 * * *'
workflow_dispatch: # Allow manual trigger
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
DEMO_MANIFEST: demo/Cargo.toml
jobs:
check-latest-gpui:
name: Test with Latest GPUI
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install Linux GPUI dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev libwayland-dev libx11-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Get current GPUI version
id: current-version
run: |
META=$(cargo metadata --manifest-path "$DEMO_MANIFEST" --format-version 1)
VERSION=$(echo "$META" | jq -r '.packages[] | select(.name == "gpui") | .version')
SOURCE=$(echo "$META" | jq -r '.packages[] | select(.name == "gpui") | .source')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "source=$SOURCE" >> $GITHUB_OUTPUT
echo "Current GPUI version: $VERSION"
echo "Current GPUI source: $SOURCE"
- name: Update GPUI to latest
run: |
echo "Updating GPUI to latest version..."
cargo update --manifest-path "$DEMO_MANIFEST" --recursive gpui gpui_platform gpui-component
- name: Get new GPUI version
id: new-version
run: |
META=$(cargo metadata --manifest-path "$DEMO_MANIFEST" --format-version 1)
VERSION=$(echo "$META" | jq -r '.packages[] | select(.name == "gpui") | .version')
SOURCE=$(echo "$META" | jq -r '.packages[] | select(.name == "gpui") | .source')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "source=$SOURCE" >> $GITHUB_OUTPUT
echo "New GPUI version: $VERSION"
echo "New GPUI source: $SOURCE"
- name: Build with latest GPUI
id: build
run: |
cargo check --manifest-path "$DEMO_MANIFEST" --bins
continue-on-error: true
- name: Run tests with latest GPUI
id: test
run: |
cargo test --all-features
continue-on-error: true
- name: Check if update is needed
id: check-update
run: |
if [ "${{ steps.current-version.outputs.source }}" != "${{ steps.new-version.outputs.source }}" ]; then
echo "needs_update=true" >> $GITHUB_OUTPUT
echo "GPUI source changed: ${{ steps.current-version.outputs.source }} -> ${{ steps.new-version.outputs.source }}"
else
echo "needs_update=false" >> $GITHUB_OUTPUT
echo "GPUI source unchanged"
fi
- name: Create issue if incompatible
if: steps.build.outcome == 'failure' || steps.test.outcome == 'failure'
uses: actions/github-script@v7
with:
script: |
const title = `GPUI Compatibility Issue: v${{ steps.new-version.outputs.version }}`;
const body = `## GPUI Compatibility Check Failed
**Current GPUI version:** ${{ steps.current-version.outputs.version }}
**New GPUI version:** ${{ steps.new-version.outputs.version }}
**Current GPUI source:** ${{ steps.current-version.outputs.source }}
**New GPUI source:** ${{ steps.new-version.outputs.source }}
**Platform:** ${{ matrix.os }}
### Build Status
${{ steps.build.outcome == 'failure' && '❌ Build failed' || '✅ Build succeeded' }}
### Test Status
${{ steps.test.outcome == 'failure' && '❌ Tests failed' || '✅ Tests passed' }}
### Action Required
The project may need updates to remain compatible with the latest GPUI version.
### Next Steps
1. Review the failed workflow run
2. Update code to fix compatibility issues
3. Test locally with the new GPUI version
4. Update documentation if needed
**Workflow Run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
`;
// Check if issue already exists
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'gpui-compatibility'
});
const existingIssue = issues.data.find(issue => issue.title === title);
if (!existingIssue) {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['gpui-compatibility', 'bug']
});
console.log('Created new compatibility issue');
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: existingIssue.number,
body: `Update: Compatibility issue still exists.\n\n${body}`
});
console.log('Updated existing compatibility issue');
}
- name: Report success
if: steps.build.outcome == 'success' && steps.test.outcome == 'success' && steps.check-update.outputs.needs_update == 'true'
uses: actions/github-script@v7
with:
script: |
// Close any open compatibility issues
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'gpui-compatibility'
});
for (const issue of issues.data) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: `✅ Compatibility restored with GPUI v${{ steps.new-version.outputs.version }}`
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed'
});
}
console.log('All compatibility issues resolved');