Skip to content

Migration to oxlint #629

Migration to oxlint

Migration to oxlint #629

Workflow file for this run

name: PR Checks
on:
pull_request:
branches:
- main
- release/*
jobs:
checks-and-tests:
name: Checks and Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Run checks
run: npm run build && npm run check-format && npm run check-exports && npm run lint && npm run type-check
- name: Run tests with coverage
run: npm run test:coverage
- name: Create output directory
run: mkdir -p out
- name: Extract current coverage
run: npm run coverage:extract -- --output out/current-coverage.json
- name: Upload current coverage
uses: actions/upload-artifact@v4
with:
name: current-coverage
path: out/current-coverage.json
retention-days: 1
coverage-compare:
name: Compare Coverage
runs-on: ubuntu-latest
needs: checks-and-tests
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Download current coverage
uses: actions/download-artifact@v4
with:
name: current-coverage
path: out
- name: Check if coverage scripts exist
id: check-scripts
run: |
if [ -f "scripts/compare-coverage.ts" ] && [ -f "scripts/extract-coverage.ts" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Checkout base branch
if: steps.check-scripts.outputs.exists == 'true'
run: |
git fetch origin ${{ github.base_ref }}
git checkout origin/${{ github.base_ref }}
- name: Check if coverage scripts exist in base branch
if: steps.check-scripts.outputs.exists == 'true'
id: check-base-scripts
run: |
if [ -f "scripts/compare-coverage.ts" ] && [ -f "scripts/extract-coverage.ts" ]; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Install dependencies (base)
if: steps.check-scripts.outputs.exists == 'true' && steps.check-base-scripts.outputs.exists == 'true'
run: npm ci --ignore-scripts
- name: Run tests with coverage (base)
if: steps.check-scripts.outputs.exists == 'true' && steps.check-base-scripts.outputs.exists == 'true'
run: npm run test:coverage
- name: Extract base coverage
if: steps.check-scripts.outputs.exists == 'true' && steps.check-base-scripts.outputs.exists == 'true'
run: npm run coverage:extract -- --output out/base-coverage.json
- name: Upload base coverage
if: steps.check-scripts.outputs.exists == 'true' && steps.check-base-scripts.outputs.exists == 'true'
uses: actions/upload-artifact@v4
with:
name: base-coverage
path: out/base-coverage.json
retention-days: 1
- name: Checkout PR branch
if: steps.check-scripts.outputs.exists == 'true'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install dependencies (PR branch)
if: steps.check-scripts.outputs.exists == 'true'
run: npm ci --ignore-scripts
- name: Download current coverage
uses: actions/download-artifact@v4
with:
name: current-coverage
path: out
- name: Download base coverage
uses: actions/download-artifact@v4
with:
name: base-coverage
path: out
continue-on-error: true
- name: Compare coverage
id: compare
run: |
# Run comparison (will handle missing base file gracefully)
npm exec tsx scripts/compare-coverage.ts out/current-coverage.json out/base-coverage.json > out/coverage-report.md 2>&1 || true
# Read the report for the PR comment
REPORT=$(cat out/coverage-report.md)
# Set output for PR comment (escape for GitHub Actions)
echo "report<<EOF" >> $GITHUB_OUTPUT
echo "$REPORT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Post PR comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const report = process.env.COVERAGE_REPORT;
// Find existing comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('📊 Coverage Report')
);
const commentBody = report;
if (botComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: commentBody
});
} else {
// Create new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody
});
}
env:
COVERAGE_REPORT: ${{ steps.compare.outputs.report }}
- name: Upload coverage analysis
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-analysis
path: |
out/current-coverage.json
out/base-coverage.json
out/coverage-report.md
retention-days: 30
deploy-remote-flows:
name: Deploy Remote Flows Preview
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy remote-flows to vercel
id: vercel-remote-flows
uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_REMOTE_FLOWS_PROJECT_ID }}
github-token: ${{ secrets.GITHUB_TOKEN }}
github-comment: true
scope: ${{ secrets.VERCEL_ORG_ID }}
- name: Save deployment URL
run: |
echo "${{ steps.vercel-remote-flows.outputs.preview-url }}" > remote-flows-url.txt
- name: Upload deployment URL
uses: actions/upload-artifact@v4
with:
name: remote-flows-url
path: remote-flows-url.txt
deploy-example-app:
name: Deploy Example App Preview
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy remote-flows-example-app to vercel
id: vercel-example-app
uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_EXAMPLE_APP_PROJECT_ID }}
scope: ${{ secrets.VERCEL_ORG_ID }}
github-token: ${{ secrets.GITHUB_TOKEN }}
github-comment: true
- name: Save deployment URL
run: |
echo "${{ steps.vercel-example-app.outputs.preview-url }}" > example-app-url.txt
- name: Upload deployment URL
uses: actions/upload-artifact@v4
with:
name: example-app-url
path: example-app-url.txt
e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
needs: [checks-and-tests, deploy-remote-flows, deploy-example-app]
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install main package dependencies
run: npm ci --ignore-scripts
- name: Install example/ dependencies
working-directory: ./example
run: npm ci
- name: Install Playwright
working-directory: ./example
run: npx playwright install chromium --with-deps
- name: Download remote-flows URL
uses: actions/download-artifact@v4
with:
name: remote-flows-url
- name: Download example-app URL
uses: actions/download-artifact@v4
with:
name: example-app-url
- name: Set deployment URLs
id: set-urls
run: |
echo "REMOTE_FLOWS_URL=$(cat remote-flows-url.txt)" >> $GITHUB_ENV
echo "EXAMPLE_APP_URL=$(cat example-app-url.txt)" >> $GITHUB_ENV
- name: Run Playwright tests
env:
BASE_URL: ${{ env.REMOTE_FLOWS_URL }}
VERCEL_BYPASS_TOKEN: ${{ secrets.VERCEL_BYPASS_TOKEN }}
DEBUG: pw:api
working-directory: ./example
run: npx playwright test --project=chromium
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30