Skip to content

Commit

Permalink
workflow(ci): optimize ai test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoushaw committed Jan 27, 2025
1 parent 8eacc35 commit 54dd851
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 19 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/ai-unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: AI unit test
on:
push:
branches:
- main
workflow_dispatch:
inputs:
branch:
description: 'Branch to checkout'
required: false
default: 'main'
type: string

jobs:
main:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [18.19.0]

env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
MIDSCENE_MODEL_NAME: gpt-4o-2024-11-20
CI: 1

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch || 'main' }}

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9.3.0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build project
run: pnpm run build

- name: Run tests
run: pnpm run test:ai
id: test-ai
continue-on-error: true

- name: Upload test-ai output
if: always()
uses: actions/upload-artifact@v4
with:
name: test-ai-output
path: ${{ github.workspace }}/packages/web-integration/midscene_run/report
if-no-files-found: ignore

- name: Check if script failed
if: steps.test-ai.outcome == 'failure'
run: exit 1
20 changes: 1 addition & 19 deletions .github/workflows/ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,24 +110,6 @@ jobs:
path: ${{ github.workspace }}/packages/web-integration/midscene_run/report
if-no-files-found: ignore

- name: Run tests
run: pnpm run test:ai
id: test-ai
continue-on-error: true

- name: Upload test-ai output
if: always()
uses: actions/upload-artifact@v4
with:
name: test-ai-output
path: ${{ github.workspace }}/packages/web-integration/midscene_run/report
if-no-files-found: ignore

- name: Check if script failed
if: steps.test-ai.outcome == 'failure' || steps.e2e-tests.outcome == 'failure' || steps.e2e-tests-cache.outcome == 'failure' || steps.e2e-tests-report.outcome == 'failure'
if: steps.e2e-tests.outcome == 'failure' || steps.e2e-tests-cache.outcome == 'failure' || steps.e2e-tests-report.outcome == 'failure'
run: exit 1





0 comments on commit 54dd851

Please sign in to comment.