Skip to content
Merged
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
63 changes: 63 additions & 0 deletions .github/workflows/api-extractor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 'API: Extract Public Typings'

# 📘 This workflow verifies that API typings can be generated and rolled up cleanly.
# It runs on:
# - Pushes to `main` or `next` (validate committed state)
# - PRs to any branch (validate incoming changes)

on:
push:
branches:
- main
- next
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
extract-api-typings:
name: Extract API Typings
runs-on: ubuntu-latest

steps:
- name: ✅ Checkout Repository
uses: actions/checkout@v4

- name: 🔍 Check if API directory exists
id: check-dir
run: |
if [ ! -d "./api" ]; then
echo "::notice::API directory not found - skipping API extraction"
echo "api_exists=false" >> $GITHUB_OUTPUT
else
echo "✅ API directory found"
echo "api_exists=true" >> $GITHUB_OUTPUT
fi

- name: 🛠 Setup Node.js Environment
if: steps.check-dir.outputs.api_exists == 'true'
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'npm'

- name: 💾 Restore npm Cache
if: steps.check-dir.outputs.api_exists == 'true'
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: 📦 Install Dependencies (npm ci)
if: steps.check-dir.outputs.api_exists == 'true'
working-directory: './api'
run: npm ci

- name: 🧬 Run API Extractor
if: steps.check-dir.outputs.api_exists == 'true'
working-directory: './api'
run: npm run api-extractor
29 changes: 18 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,33 @@ name: Node PR Lint, Build and Test

# This workflow handles three scenarios:
#
# 1. Push to `dev/*` branches:
# 1. Push to `next`, `dev/*`, or `feature/*` branches:
# - Runs `code-quality-and-tests` and `integration-tests`
# - Skips `build-and-package` to save time
# - Skips `build-and-package` to save resources and focus on code quality
#
# 2. Pull Requests to `main` (or rel/*):
# 2. Pull Requests to `main` or `next`:
# - Runs all jobs: code checks, tests, and packaging
# - Used for full validation before merge
# - Ensures complete validation including artifact generation before merge
#
# 3. Push to `main` or `rel/*`:
# - Runs full workflow (same as PRs)
# 3. Push to `main`:
# - Runs full workflow for release validation and artifact generation

on:
workflow_dispatch:

push:
branches:
- main
- rel/*
- next
- dev/*
- feature/*

pull_request:
branches:
- main
- rel/*
- next
- dev/*
- feature/*

concurrency:
group: ${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -102,14 +104,19 @@ jobs:
- name: 🔄 Run Integration Tests (Headless UI)
run: xvfb-run -a npm test

# Run only on push to `main` or for any PR (to any branch)
# Skip on direct pushes to `dev/*` branches
# Run only on push to `main` or for PRs to main or next
# Skip on direct pushes to `next`, `dev/*`, and `feature/*` branches
build-and-package:
name: Build & Package Artifacts
runs-on: ubuntu-latest
needs: [code-quality-and-tests, integration-tests]

if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/pull/')
if: |
github.ref == 'refs/heads/main' ||
(startsWith(github.ref, 'refs/pull/') && (
github.base_ref == 'main' ||
github.base_ref == 'next'
))

defaults:
run:
Expand Down
Loading