mirror of
https://github.com/iflytek/skillhub.git
synced 2026-11-15 09:11:18 +00:00
146 lines
3.9 KiB
YAML
146 lines
3.9 KiB
YAML
name: PR Tests
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
- ready_for_review
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: pr-tests-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
web-tests:
|
|
name: Web Build And Test (Node ${{ matrix.node }})
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node: [22, 24]
|
|
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
package_json_file: web/package.json
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
cache: pnpm
|
|
cache-dependency-path: web/pnpm-lock.yaml
|
|
|
|
- name: Build frontend
|
|
run: make build-frontend
|
|
|
|
- name: Run frontend unit tests
|
|
run: make test-frontend
|
|
|
|
web-tests-gate:
|
|
name: Web Build And Test
|
|
needs: web-tests
|
|
if: ${{ always() && (github.event_name != 'pull_request' || !github.event.pull_request.draft) }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Require both supported Node.js versions
|
|
env:
|
|
WEB_TESTS_RESULT: ${{ needs.web-tests.result }}
|
|
run: test "$WEB_TESTS_RESULT" = success
|
|
|
|
server-tests:
|
|
name: Server Unit Tests
|
|
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: 21
|
|
cache: maven
|
|
|
|
- name: Set up Go for integration tests
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: github-sync-go/go.mod
|
|
cache-dependency-path: github-sync-go/go.mod
|
|
|
|
- name: Compile Go integration test dependencies
|
|
working-directory: github-sync-go
|
|
run: go test ./internal/worker -run '^$'
|
|
|
|
- name: Ensure Maven wrapper is executable
|
|
run: chmod +x server/mvnw
|
|
|
|
- name: Validate built-in Skill packages
|
|
run: make test-builtin-skills
|
|
|
|
- name: Run backend unit tests
|
|
run: make test-backend
|
|
|
|
docs-build:
|
|
name: Docs Build
|
|
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Detect docs changes
|
|
id: changed
|
|
uses: dorny/paths-filter@v3
|
|
with:
|
|
filters: |
|
|
docs:
|
|
- 'docs/skillhub/**'
|
|
- 'weekly/**'
|
|
- '.github/workflows/pr-tests.yml'
|
|
- '.github/workflows/deploy-docs.yml'
|
|
|
|
- name: Set up Node.js
|
|
if: steps.changed.outputs.docs == 'true'
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
cache-dependency-path: docs/skillhub/package-lock.json
|
|
|
|
- name: Install docs dependencies
|
|
if: steps.changed.outputs.docs == 'true'
|
|
run: cd docs/skillhub && npm ci
|
|
|
|
- name: Build VitePress site
|
|
if: steps.changed.outputs.docs == 'true'
|
|
run: cd docs/skillhub && npm run build
|
|
|
|
- name: Build and validate weekly reports
|
|
if: steps.changed.outputs.docs == 'true'
|
|
run: |
|
|
python3 weekly/scripts/build_site.py \
|
|
--source weekly/site \
|
|
--output docs/skillhub/.vitepress/dist/weekly
|
|
python3 weekly/scripts/validate_site.py \
|
|
docs/skillhub/.vitepress/dist/weekly
|