Skip to content

ts(docs): Add typedoc to client hosted with GHPages #15

ts(docs): Add typedoc to client hosted with GHPages

ts(docs): Add typedoc to client hosted with GHPages #15

Workflow file for this run

name: SDK Smoke Tests & Coverage Check
on:
pull_request:
paths:
- 'src/sdk/**'
- 'tests/smoketests/object-oriented/**'
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
type: choice
default: dev
options:
- dev
- prod
jobs:
smoke-and-coverage:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Build
run: yarn build
- name: Configure environment
env:
DEV_KEY: ${{ secrets.RUNLOOP_SMOKETEST_DEV_API_KEY }}
PROD_KEY: ${{ secrets.RUNLOOP_SMOKETEST_PROD_API_KEY }}
run: |
if [ "${{ github.event.inputs.environment }}" = "prod" ]; then
echo "RUNLOOP_API_KEY=${PROD_KEY}" >> $GITHUB_ENV
echo "RUNLOOP_BASE_URL=https://api.runloop.ai" >> $GITHUB_ENV
else
echo "RUNLOOP_API_KEY=${DEV_KEY}" >> $GITHUB_ENV
echo "RUNLOOP_BASE_URL=https://api.runloop.pro" >> $GITHUB_ENV
fi
echo "DEBUG=false" >> $GITHUB_ENV
echo "RUN_SMOKETESTS=1" >> $GITHUB_ENV
- name: Run smoke tests with coverage
id: tests
continue-on-error: true
run: yarn test:objects-coverage 2>&1 | tee test-output.log
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: coverage-objects/
retention-days: 30
- name: Comment results on PR
if: always() && github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const testsPassed = '${{ steps.tests.outcome }}' === 'success';
// Build workflow run URL
const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
let comment = '';
if (!testsPassed) {
// Try to parse failed tests from the log
let failedTests = '';
try {
const testOutput = fs.readFileSync('test-output.log', 'utf8');
// Extract failed test names using regex
const failedMatches = testOutput.match(/● (.+?)(?:\n|$)/g);
if (failedMatches && failedMatches.length > 0) {
const failedTestList = failedMatches
.map(match => match.replace('● ', '').trim())
.filter(test => test.length > 0)
.slice(0, 10) // Limit to first 10 failures
.map(test => `- ${test}`)
.join('\n');
if (failedTestList) {
failedTests = `\n\n**Failed Tests:**\n${failedTestList}`;
if (failedMatches.length > 10) {
failedTests += `\n- ... and ${failedMatches.length - 10} more`;
}
}
}
} catch (error) {
console.log('Could not read test output:', error.message);
}
comment = `## ❌ Object Smoke Tests Failed
### Test Results
❌ Some smoke tests failed
${failedTests}
**Please fix the failing tests before checking coverage.**
[📋 View full test logs](${runUrl})`;
} else {
let coverageSummary = null;
try {
coverageSummary = JSON.parse(fs.readFileSync('coverage-objects/coverage-summary.json', 'utf8'));
} catch (error) {
console.log('Coverage summary not found:', error.message);
comment = `## ⚠️ Coverage Data Missing
### Test Results
✅ All smoke tests passed
### Coverage Results
⚠️ Coverage data could not be read
[📋 View workflow logs](${runUrl})`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
return;
}
const total = coverageSummary.total;
const functions = total.functions.pct;
const lines = total.lines.pct;
const branches = total.branches.pct;
const statements = total.statements.pct;
const coveragePassed = functions === 100;
const allPassed = testsPassed && coveragePassed;
const statusEmoji = allPassed ? '✅' : '⚠️';
comment = `## ${statusEmoji} Object Smoke Tests & Coverage Report
### Test Results
✅ All smoke tests passed
### Coverage Results
| Metric | Coverage | Required | Status |
|--------|----------|----------|--------|
| **Functions** | **${functions}%** | **100%** | ${coveragePassed ? '✅' : '❌'} |
| Lines | ${lines}% | - | ℹ️ |
| Branches | ${branches}% | - | ℹ️ |
| Statements | ${statements}% | - | ℹ️ |
**Coverage Requirement:** 100% function coverage (all public methods must be called in smoke tests)
${coveragePassed
? '✅ All tests passed and all object methods are covered!'
: '⚠️ Some object methods are not covered in smoke tests. Please add tests that call all public methods.'}
<details>
<summary>View detailed coverage report</summary>
Coverage reports are available in the workflow artifacts. Lines/branches/statements coverage is tracked but not required to be 100%.
</details>
[📋 View workflow run](${runUrl})`;
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});