Skip to content

feat: add CLI chains command #525

feat: add CLI chains command

feat: add CLI chains command #525

Workflow file for this run

---
name: CI
permissions:
contents: read
on:
push:
branches:
- main
pull_request: {}
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v5.0.0
- name: Set up Node.js
uses: actions/setup-node@v6.0.0
with:
node-version: 24
- name: Install dependencies and build
run: npm ci
- name: Run lint
run: npm run check
- name: Validate ccip-sdk package exports
working-directory: ccip-sdk
run: |
# publint - check package.json exports and module format
npx publint
# attw - check TypeScript types resolution (informational)
# Note: CJS resolution warnings are expected for ESM-only packages
npx @arethetypeswrong/cli --pack . --profile esm-only || true
- name: Validate ccip-config package exports
working-directory: ccip-config
run: |
# publint - check package.json exports and module format
npx publint
# attw - check TypeScript types resolution (informational)
# Note: CJS resolution warnings are expected for ESM-only packages
npx @arethetypeswrong/cli --pack . --profile esm-only || true
- name: Run tests with coverage
run: |
set -o pipefail
npm test 2>&1 | tee coverage-summary.txt
- name: Upload coverage report
if: "always() && hashFiles('.coverage/**') != ''"
uses: actions/upload-artifact@v5.0.0
with:
name: coverage-report
path: .coverage
- name: Upload coverage summary
if: always()
uses: actions/upload-artifact@v5.0.0
with:
name: coverage-summary
path: coverage-summary.txt
- name: Smoke test cli
run: npx $PWD/ccip-cli --help
coverage-comment:
needs: build-and-test
runs-on: ubuntu-latest
# This job needs to be able to comment on PRs
permissions:
contents: read
pull-requests: write
# Only run on pull_request events (skip on push to main)
if: github.event_name == 'pull_request'
steps:
- name: Download coverage summary
uses: actions/download-artifact@v5.0.0
with:
name: coverage-summary
path: .
- name: Post or update PR comment with coverage summary
uses: actions/github-script@v8.0.0
with:
script: |
const fs = require('fs');
let coverageSummary = fs.readFileSync('coverage-summary.txt', 'utf8').split('\n');
coverageSummary = coverageSummary.slice(
coverageSummary.findIndex(line => line.match(/^ℹ/))
).join('\n');
if (coverageSummary.trim().length === 0) {
console.log('No coverage data found');
process.exit(1);
}
const prNumber = context.payload.pull_request
? context.payload.pull_request.number
: null;
if (!prNumber) {
console.log('No PR number found, skipping comment.');
return;
}
const commentBody = `## Coverage Report\n\n\`\`\`\n${coverageSummary}\n\`\`\``;
const { data: comments } = await github.rest.issues.listComments({
...context.repo,
issue_number: prNumber,
});
const botComment = comments.find(
comment =>
comment.user.login === 'github-actions[bot]' &&
comment.body.includes('## Coverage Report')
);
if (botComment) {
await github.rest.issues.updateComment({
...context.repo,
comment_id: botComment.id,
body: commentBody,
});
} else {
await github.rest.issues.createComment({
...context.repo,
issue_number: prNumber,
body: commentBody,
});
}