Skip to content

Test new runner

Test new runner #77

Workflow file for this run

name: Test new runner
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
pull_request_review_comment:
types: [created]
issue_comment:
types: [created]
jobs:
get-runner-labels:
name: Get Runner Labels
uses: ./.github/workflows/get-runner-labels.yml
build:
name: Build
needs: [get-runner-labels]
uses: ./.github/workflows/reusable-build.yml
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') && contains(github.event.comment.body, '!test-ng')
with:
profile: "debug"
ref: ${{ (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') && format('refs/pull/{0}/merge', github.event.issue.number || github.event.pull_request.number) || '' }}
target: x86_64-unknown-linux-gnu
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
test: false
test:
name: Test by new runner
needs: [build, get-runner-labels]
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
outputs:
testng: ${{ env.RESULT }}
steps:
- name: Checkout Branch
uses: actions/checkout@v4
with:
ref: ${{ (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment') && format('refs/pull/{0}/merge', github.event.issue.number || github.event.pull_request.number) || '' }}
- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache
- name: Download bindings
uses: ./.github/actions/download-artifact
with:
name: bindings-x86_64-unknown-linux-gnu
path: crates/node_binding/
try-local-cache: true
link-when-local: true
- name: Build node packages
run: pnpm run build:js
- name: Test diff
id: testdiff
run: pnpm run test:diff
- name: Test Hot
id: testhot
run: pnpm run test:hot
- name: Test new runner
run: |
set -e;
OUTPUT=$((pnpm run test --no-colors --silent=true --force-exit 2>&1 && echo "Test new runner successed" || echo "Test new runner failed") | tail --bytes=50000)
echo 'RESULT<<EOF' >> $GITHUB_ENV
echo "$OUTPUT" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo ${OUTPUT}
comment_success:
name: Write success comment
needs: [test, get-runner-labels]
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
if: success() && (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment')
steps:
- name: Write comment
uses: peter-evans/create-or-update-comment@v4
continue-on-error: true
with:
issue-number: ${{ github.event.issue.number || github.event.pull_request.number }}
body: |
**${{ contains(needs.test.outputs.testng, 'Test new runner failed') && 'πŸ”΄πŸ”΄πŸ”΄ Test new runner failed' || '🟒🟒🟒 Test new runner successed' }}**
> Task: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
```
${{ needs.test.outputs.testng }}
```
comment_fail:
name: Write failed comment
needs: [test, get-runner-labels]
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
if: failure() && !cancelled()
steps:
- name: Write comment
uses: peter-evans/create-or-update-comment@v4
continue-on-error: true
with:
issue-number: ${{ github.event.issue.number || github.event.pull_request.number }}
body: |
**πŸ”΄πŸ”΄πŸ”΄ Test new runner failed**
> Task: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
notify:
name: Notify
needs: [test, get-runner-labels]
runs-on: ${{ fromJSON(needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS) }}
if: ${{ github.event_name == 'schedule' && github.repository_owner == 'web-infra-dev' && (contains(needs.test.outputs.testng, 'Test new runner failed') || (failure() && !cancelled())) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- shell: bash
run: ./scripts/alert/lark.js
env:
TITLE: New Runner Failed
DESCRIPTION: |
commitID: [${{github.sha}}](${{github.server_url}}/${{github.repository}}/commit/${{github.sha}})
URL: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
LARK_WEBHOOK_URL: ${{secrets.LARK_WEBHOOK_URL}}