Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
244 changes: 244 additions & 0 deletions .github/workflows/forward-indicator-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
name: Forward Indicator Job (Reusable)

on:
workflow_call:
inputs:
check_name:
required: true
type: string
description: "Name for the GitHub check"
package_to_test:
required: false
type: string
description: "Package to install for testing (e.g., typescript@next)"
node_version:
required: false
type: string
description: "Node version to test (e.g., nightly, latest)"
package_type:
required: true
type: string
description: "Type of package: typescript or nodejs"
working_directory:
required: true
type: string
description: "Working directory for the tests"
tsc_binary:
required: false
type: string
description: "TypeScript compiler binary to use (default: tsc)"
default: "tsc"

jobs:
test:
runs-on: ubuntu-latest
env:
TSC_BIN: ${{ inputs.tsc_binary }}
steps:
- uses: actions/checkout@v4

# Create the check run
- name: Create check run
id: check
uses: actions/github-script@v7
with:
script: |
const check = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: '${{ inputs.check_name }}',
head_sha: context.payload.pull_request?.head.sha || context.sha,
status: 'in_progress',
output: {
title: 'Testing forward compatibility',
summary: 'Running tests...'
}
});
return check.data.id;

# Standard setup and build
- uses: ./.github/actions/setup-and-build

# Node.js setup (custom version if needed)
- name: Setup Node.js
if: inputs.node_version
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node_version }}

- name: Get Node version
id: node_info
run: |
NODE_VERSION=$(node --version)
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
echo "Node.js: $NODE_VERSION"

# Install TypeScript package if specified
- name: Install package
if: inputs.package_to_test && inputs.package_type == 'typescript'
id: install_package
working-directory: ${{ inputs.working_directory }}
continue-on-error: true
run: |
pnpm remove typescript

if pnpm add -D ${{ inputs.package_to_test }}; then
echo "result=success" >> $GITHUB_OUTPUT

echo "Installed package: ${{ inputs.package_to_test }}"
echo "Using TypeScript binary: ${{ inputs.tsc_binary }}"
npx ${{ inputs.tsc_binary }} --version
else
echo "result=failed" >> $GITHUB_OUTPUT
fi

# Run type tests for TypeScript
- name: Run type tests
if: inputs.package_type == 'typescript'
id: type_test
working-directory: ${{ inputs.working_directory }}
continue-on-error: true
run: |
if [[ "${{ steps.install_package.outputs.result }}" == "failed" ]]; then
echo "result=skipped" >> $GITHUB_OUTPUT
elif pnpm run test:types; then
echo "result=pass" >> $GITHUB_OUTPUT
else
echo "result=fail" >> $GITHUB_OUTPUT
fi

# Run dist tests for TypeScript
- name: Run dist tests
if: inputs.package_type == 'typescript'
id: dist_test
working-directory: ${{ inputs.working_directory }}
continue-on-error: true
run: |
if [[ "${{ steps.install_package.outputs.result }}" == "failed" ]]; then
echo "result=skipped" >> $GITHUB_OUTPUT
elif pnpm run test:dist; then
echo "result=pass" >> $GITHUB_OUTPUT
else
echo "result=fail" >> $GITHUB_OUTPUT
fi

# Run standard tests for Node.js
- name: Run tests
if: inputs.package_type == 'nodejs'
id: node_test
working-directory: ${{ inputs.working_directory }}
continue-on-error: true
run: |
if npm run test; then
echo "result=pass" >> $GITHUB_OUTPUT
else
echo "result=fail" >> $GITHUB_OUTPUT
fi

# Update check run with results
- name: Update check run
if: always()
uses: actions/github-script@v7
env:
CHECK_NAME: ${{ inputs.check_name }}
PACKAGE_TYPE: ${{ inputs.package_type }}
PACKAGE_NAME: ${{ inputs.package_to_test }}
NODE_VERSION: ${{ steps.node_info.outputs.version }}
INSTALL_RESULT: ${{ steps.install_package.outputs.result }}
TYPE_TEST: ${{ steps.type_test.outputs.result }}
DIST_TEST: ${{ steps.dist_test.outputs.result }}
NODE_TEST: ${{ steps.node_test.outputs.result }}
RUN_ID: ${{ github.run_id }}
REPO: ${{ github.repository }}
with:
script: |
const { CHECK_NAME, PACKAGE_TYPE, PACKAGE_NAME, NODE_VERSION,
INSTALL_RESULT, TYPE_TEST, DIST_TEST, NODE_TEST, RUN_ID, REPO } = process.env;

const runUrl = `https://github.com/${REPO}/actions/runs/${RUN_ID}`;
let conclusion = 'neutral';
let summary = `## ${CHECK_NAME}\n\n`;
let text = '';

if (PACKAGE_TYPE === 'typescript') {
// Configuration section
text += '### Configuration\n';
text += `- Working Directory: \`${{ inputs.working_directory }}\`\n`;
if (PACKAGE_NAME) {
text += `- Package: \`${PACKAGE_NAME}\`\n`;
text += `- TypeScript Binary: \`${{ inputs.tsc_binary }}\`\n`;
}
text += '\n';

if (INSTALL_RESULT === 'failed') {
summary += '⚠️ **Could not install package** - may not be available\n';
text += '### Installation Failed\n';
text += 'The specified package could not be installed. It may not be available yet.\n';
} else {
// Determine overall status
const allPassed = TYPE_TEST === 'pass' && DIST_TEST === 'pass';

if (allPassed) {
conclusion = 'success';
summary += '✅ **All forward compatibility tests passed**\n';
} else {
summary += '⚠️ **Some forward compatibility tests failed** (non-blocking)\n';
}

// Test Results section - always show all tests with links
text += '### Test Results\n\n';

// test:types - step 9 in the workflow
const typeIcon = TYPE_TEST === 'pass' ? '✅' : TYPE_TEST === 'fail' ? '❌' : '⏭️';
text += `${typeIcon} [\`npm run test:types\`](${runUrl}#step:9:1)\n`;

// test:dist - step 10 in the workflow
const distIcon = DIST_TEST === 'pass' ? '✅' : DIST_TEST === 'fail' ? '❌' : '⏭️';
text += `${distIcon} [\`npm run test:dist\`](${runUrl}#step:10:1)\n`;

// If there were failures, add a section for that
if (!allPassed) {
text += '\n### Failed Tests\n\n';
if (TYPE_TEST === 'fail') {
text += `- [\`test:types\`](${runUrl}#step:9:1) - Type checking failed\n`;
}
if (DIST_TEST === 'fail') {
text += `- [\`test:dist\`](${runUrl}#step:10:1) - Distribution type checking failed\n`;
}
}
}
} else if (PACKAGE_TYPE === 'nodejs') {
// Configuration section
text += '### Configuration\n';
text += `- Working Directory: \`${{ inputs.working_directory }}\`\n`;
text += `- Node.js Version: \`${NODE_VERSION}\`\n\n`;

const passed = NODE_TEST === 'pass';

if (passed) {
conclusion = 'success';
summary += '✅ **All forward compatibility tests passed**\n';
} else {
summary += '⚠️ **Tests failed** (non-blocking)\n';
}

// Test Results section - always show with link
text += '### Test Results\n\n';
const icon = passed ? '✅' : '❌';
// Node test is step 11 in the workflow
text += `${icon} [\`npm run test\`](${runUrl}#step:11:1)\n`;
}

text += '\n---\n_Forward compatibility indicator - informational only, does not block PR._';

await github.rest.checks.update({
owner: context.repo.owner,
repo: context.repo.repo,
check_run_id: ${{ steps.check.outputs.result }},
conclusion: conclusion,
output: {
title: 'Forward compatibility check complete',
summary: summary,
text: text
}
});
47 changes: 47 additions & 0 deletions .github/workflows/forward-indicators.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Run Forward Compatibility Indicators

on:
pull_request:
workflow_dispatch:

permissions:
checks: write
contents: read

jobs:
typescript_next:
name: "TypeScript @next"
uses: ./.github/workflows/forward-indicator-job.yml
with:
check_name: "Forward Compatibility: TypeScript @next"
package_to_test: "typescript@next"
package_type: "typescript"
working_directory: "packages/inngest"
permissions:
checks: write
contents: read

typescript_preview:
name: "TypeScript Native Preview"
uses: ./.github/workflows/forward-indicator-job.yml
with:
check_name: "Forward Compatibility: TypeScript Native Preview"
package_to_test: "@typescript/native-preview"
package_type: "typescript"
working_directory: "packages/inngest"
tsc_binary: "tsgo"
permissions:
checks: write
contents: read

nodejs_nightly:
name: "Node.js Current"
uses: ./.github/workflows/forward-indicator-job.yml
with:
check_name: "Forward Compatibility: Node.js Current"
node_version: "current"
package_type: "nodejs"
working_directory: "packages/inngest"
permissions:
checks: write
contents: read
4 changes: 2 additions & 2 deletions packages/inngest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"test": "vitest run",
"itest": "tsx scripts/integrationTestRunner.ts",
"test:examples": "vitest run --dir src/test/functions",
"test:types": "tsc --noEmit --project tsconfig.types.json --listFiles",
"test:dist": "tsc --noEmit dist/**/*.d.ts",
"test:types": "${TSC_BIN:-tsc} --noEmit --project tsconfig.types.json --listFiles",
"test:dist": "${TSC_BIN:-tsc} --noEmit dist/**/*.d.ts",
"test:deps": "tsx scripts/checkDependencies.ts",
"test:composite": "pnpm run local:pack && (cd test/composite_project && npm i ../../inngest.tgz && npm run test)",
"lint": "biome check",
Expand Down
Loading