Add GitHub Actions CI/CD pipeline and test framework

- Add .github/workflows/build-test.yml for automated testing
- Add tests/ directory with TypeScript test runner
- Add docs/CICD.md documentation
- Remove .gitlab-ci.yml (migrated to GitHub Actions)
- Update .gitignore for test artifacts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Shang Chieh Tseng
2025-12-15 14:06:44 +08:00
parent 2b5aeaf86b
commit d11140c016
23 changed files with 3014 additions and 50 deletions

187
.github/workflows/build-test.yml vendored Normal file
View File

@@ -0,0 +1,187 @@
name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
TESTLINK_URL: http://localhost:8090
TESTLINK_PROJECT_ID: "1"
OLLAMA_HOST: http://localhost:11434
jobs:
build:
name: Build Docker Images
runs-on: [self-hosted, k80, cuda11]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install test runner dependencies
run: cd tests && npm ci
- name: Run build tests
id: build-tests
run: |
cd tests
npm run dev -- run --suite build --no-llm --output json > /tmp/build-results.json 2>&1 || true
cat /tmp/build-results.json
# Check if any tests failed
if grep -q '"passed": false' /tmp/build-results.json; then
echo "Some build tests failed"
exit 1
fi
- name: Upload build results
uses: actions/upload-artifact@v4
if: always()
with:
name: build-test-results
path: /tmp/build-results.json
runtime:
name: Runtime Tests
runs-on: [self-hosted, k80, cuda11]
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install test runner dependencies
run: cd tests && npm ci
- name: Start container
run: |
cd docker
docker compose down 2>/dev/null || true
docker compose up -d
sleep 10
- name: Run runtime tests
id: runtime-tests
run: |
cd tests
npm run dev -- run --suite runtime --no-llm --output json > /tmp/runtime-results.json 2>&1 || true
cat /tmp/runtime-results.json
- name: Upload runtime results
uses: actions/upload-artifact@v4
if: always()
with:
name: runtime-test-results
path: /tmp/runtime-results.json
inference:
name: Inference Tests
runs-on: [self-hosted, k80, cuda11]
needs: runtime
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install test runner dependencies
run: cd tests && npm ci
- name: Run inference tests
id: inference-tests
run: |
cd tests
npm run dev -- run --suite inference --no-llm --output json > /tmp/inference-results.json 2>&1 || true
cat /tmp/inference-results.json
- name: Upload inference results
uses: actions/upload-artifact@v4
if: always()
with:
name: inference-test-results
path: /tmp/inference-results.json
llm-judge:
name: LLM Judge Evaluation
runs-on: [self-hosted, k80, cuda11]
needs: [build, runtime, inference]
if: always()
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install test runner dependencies
run: cd tests && npm ci
- name: Download all test results
uses: actions/download-artifact@v4
with:
path: /tmp/results
- name: Run LLM judge on all results
run: |
cd tests
echo "Running LLM judge evaluation..."
# Re-run all tests with LLM judge using local Ollama
npm run dev -- run --output json > /tmp/llm-judged-results.json 2>&1 || true
cat /tmp/llm-judged-results.json
- name: Upload final results
uses: actions/upload-artifact@v4
if: always()
with:
name: llm-judged-results
path: /tmp/llm-judged-results.json
cleanup:
name: Cleanup
runs-on: [self-hosted, k80, cuda11]
needs: [build, runtime, inference, llm-judge]
if: always()
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Stop Container
run: |
cd docker
docker compose down || true
echo "Container stopped"
- name: Summary
run: |
echo "## Build and Test Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Stage | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-------|--------|" >> $GITHUB_STEP_SUMMARY
echo "| Build | ${{ needs.build.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Runtime | ${{ needs.runtime.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Inference | ${{ needs.inference.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| LLM Judge | ${{ needs.llm-judge.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Commit: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY