189 lines
5.2 KiB
YAML
189 lines
5.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
frontend:
|
|
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:
|
|
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
|
|
|
|
- name: Rust cache
|
|
uses: swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: "./ -> target"
|
|
shared-key: ci-x86_64-unknown-linux-gnu
|
|
|
|
- name: Cargo fmt check
|
|
run: cargo fmt --check
|
|
|
|
- name: Cargo clippy
|
|
run: cargo clippy --workspace --locked --all-targets
|
|
|
|
- name: Cargo test
|
|
run: cargo test --workspace --locked
|
|
|
|
jdbc:
|
|
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:
|
|
agents: ${{ steps.filter.outputs.agents }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Detect agent changes
|
|
id: filter
|
|
shell: bash
|
|
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+$' || ! git rev-parse --verify "$BASE_SHA^{commit}" >/dev/null 2>&1; then
|
|
if git rev-parse --verify HEAD^ >/dev/null 2>&1; then
|
|
BASE_SHA="HEAD^"
|
|
else
|
|
BASE_SHA="$(git hash-object -t tree /dev/null)"
|
|
fi
|
|
fi
|
|
|
|
if git diff --name-only "$BASE_SHA" HEAD -- agents/ | grep -q .; then
|
|
echo "agents=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "agents=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
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
|