Files
2026-07-13 13:09:14 +08:00

249 lines
6.9 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
RUSTFLAGS: -C debuginfo=line-tables-only
jobs:
frontend:
needs: changes
if: needs.changes.outputs.frontend == 'true'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22.13.0
cache: pnpm
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev libsecret-1-dev
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Frontend check
run: pnpm check
- name: Node package tests
run: pnpm test:packages
- name: Node package publish dry run
run: pnpm publish:dry-run
rust-fmt-clippy:
needs: changes
if: needs.changes.outputs.rust == 'true'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android /usr/local/.ghcup || true
docker system prune -af || true
df -h
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev libsecret-1-dev
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./ -> target"
shared-key: ci-rust-fmt-clippy-x86_64-unknown-linux-gnu
- name: Cargo fmt check
run: cargo fmt --check
- name: Cargo clippy
run: cargo clippy --workspace --locked --all-targets
rust-test:
needs: changes
if: needs.changes.outputs.rust == 'true'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android /usr/local/.ghcup || true
docker system prune -af || true
df -h
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev libsecret-1-dev
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./ -> target"
shared-key: ci-rust-test-x86_64-unknown-linux-gnu
- name: Cargo test
run: cargo test --workspace --locked
rust:
needs: [changes, rust-fmt-clippy, rust-test]
if: always() && needs.changes.outputs.rust == 'true'
runs-on: ubuntu-22.04
steps:
- name: Check Rust jobs
run: |
if [ "${{ needs.rust-fmt-clippy.result }}" != "success" ]; then
echo "rust-fmt-clippy result: ${{ needs.rust-fmt-clippy.result }}"
exit 1
fi
if [ "${{ needs.rust-test.result }}" != "success" ]; then
echo "rust-test result: ${{ needs.rust-test.result }}"
exit 1
fi
jdbc:
needs: changes
if: needs.changes.outputs.jdbc == 'true'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "17"
cache: maven
- name: JDBC plugin version guard
env:
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
run: |
if [ -z "$BASE_SHA" ] || echo "$BASE_SHA" | grep -Eq '^0+$'; then
BASE_SHA="HEAD~1"
fi
node .github/scripts/check-jdbc-plugin-version.mjs "$BASE_SHA" HEAD
- name: JDBC plugin package check
run: ./plugins/jdbc/package.sh
changes:
runs-on: ubuntu-22.04
outputs:
frontend: ${{ steps.filter.outputs.frontend }}
rust: ${{ steps.filter.outputs.rust }}
jdbc: ${{ steps.filter.outputs.jdbc }}
agents: ${{ steps.filter.outputs.agents }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Detect changed areas
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
frontend:
- 'apps/desktop/**'
- 'packages/**'
- 'pnpm-lock.yaml'
- 'package.json'
- '.oxfmtrc.json'
- 'scripts/run-check.mjs'
- '.github/workflows/ci.yml'
rust:
- 'crates/**'
- 'src-tauri/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain*'
- '.github/workflows/ci.yml'
jdbc:
- 'plugins/jdbc/**'
agents:
- 'agents/**'
agents:
needs: changes
if: needs.changes.outputs.agents == 'true'
runs-on: ubuntu-22.04
defaults:
run:
working-directory: agents
steps:
- uses: actions/checkout@v5
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: |
8
21
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22.x"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Agent script tests
run: python3 -m unittest discover -s scripts -p '*_test.py'
- name: Agent validation
run: python3 scripts/validate_agents.py
- name: Oracle native agent tests
run: go test ./...
working-directory: agents/drivers/oracle-go
- name: Xugu native agent tests
run: GONOSUMDB=gitee.com/XuguDB/go-xugu-driver go test ./...
working-directory: agents/drivers/xugu
- name: Oracle native agent build
run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o /tmp/dbx-agent-oracle-linux-x64 .
working-directory: agents/drivers/oracle-go
- name: Xugu native agent build
run: GONOSUMDB=gitee.com/XuguDB/go-xugu-driver CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o /tmp/dbx-agent-xugu-linux-x64 .
working-directory: agents/drivers/xugu
- name: Java agent tests and packages
run: ./gradlew test shadowJar --continue
- name: Agent jar validation
run: python3 scripts/validate_agent_jars.py