Skip to content

Commit 8eb0973

Browse files
committed
Revert "refactor: optimized workflows"
This reverts commit 2877106.
1 parent 2877106 commit 8eb0973

File tree

10 files changed

+93
-375
lines changed

10 files changed

+93
-375
lines changed

.github/WORKFLOWS.md

Lines changed: 21 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,26 @@ This document describes all the GitHub Actions workflows and configurations set
44

55
## Workflows Overview
66

7-
### 1. **Default CI/CD Pipeline** (`.github/workflows/default.yml`)
7+
### 1. **CI Workflow** (`.github/workflows/ci.yml`)
88

9-
**Triggers:** Push to main, Pull requests to main, Manual dispatch
10-
11-
**Optimized Parallel Architecture:**
12-
13-
This is the main orchestrator workflow that runs analysis tasks in parallel, then proceeds with build-dependent tasks sequentially:
14-
15-
**Stage 1: Parallel Analysis** (All run simultaneously, no build required)
16-
17-
- **Lint & Code Style** - XO linting, Markdown linting, Package checks by publint, Prettier checks
18-
- **Quality Analysis** - Test coverage, quality metrics (embedded quality checks)
19-
- **Security Analysis** - CodeQL security scanning (embedded security checks)
20-
21-
**Stage 2: Build & Test** (Requires all Stage 1 to pass)
22-
23-
- **CI Tests & Build** - Calls `ci.yml` for comprehensive testing and building
24-
25-
**Stage 3: Performance Testing** (Conditional, requires build)
26-
27-
- **Performance Tests** - Calls `performance.yml` (only when src/ files change)
28-
29-
**Stage 4: Deploy** (Requires all previous stages, main branch only)
30-
31-
- **GitHub Pages Deploy** - Calls `deploy-pages.yml`
32-
33-
**Stage 5: Release** (Conditional, requires all stages, main branch only)
34-
35-
- **Release Management** - Calls `release.yml` (only for changeset/src/package.json changes)
36-
37-
**Benefits:**
38-
39-
- **Parallel efficiency**: All analysis runs simultaneously (3x faster than sequential)
40-
- **Fast failure**: Any analysis failure stops the pipeline before expensive build operations
41-
- **Resource optimization**: Build-dependent tasks only run after all checks pass
42-
- **Conditional execution**: Performance tests only when source files change
43-
- **Gated releases**: Releases only happen after all quality gates pass
44-
45-
### 2. **CI Workflow** (`.github/workflows/ci.yml`)
46-
47-
**Triggers:** Push to main, Pull requests, Workflow calls from default.yml
9+
**Triggers:** Push to main/develop, Pull requests to main/develop
4810

4911
**Jobs:**
5012

5113
- **Test**: Runs on Node.js 22.x, 24.x
5214
- Checkout repository
5315
- Install dependencies (with npm cache)
54-
- Run tests with Vitest
16+
- Run linting with `xo`
17+
- Run tests with Vite
5518
- Upload test coverage to Codecov
5619
- **Build**: Builds package and uploads artifacts
5720
- Build with `microbundle`
5821
- Upload `dist/` and `examples/` as artifacts
5922
- **Lint Markdown**: Validates all Markdown files
6023

61-
_Note: Linting has been moved to default.yml to avoid duplication_
62-
63-
### 3. **GitHub Pages Deployment** (`.github/workflows/deploy-pages.yml`)
24+
### 2. **GitHub Pages Deployment** (`.github/workflows/deploy-pages.yml`)
6425

65-
**Triggers:** Push to main, Manual dispatch, Workflow calls from default.yml
26+
**Triggers:** Push to main, Manual dispatch
6627

6728
**Features:**
6829

@@ -76,7 +37,7 @@ _Note: Linting has been moved to default.yml to avoid duplication_
7637

7738
**CDN Access:** `https://cdn.jsdelivr.net/npm/css-if-polyfill/dist/index.modern.js`
7839

79-
### 4. **Release Workflow** (`.github/workflows/release.yml`)
40+
### 3. **Release Workflow** (`.github/workflows/release.yml`)
8041

8142
**Triggers:** Git tags starting with `v*`
8243

@@ -86,94 +47,33 @@ _Note: Linting has been moved to default.yml to avoid duplication_
8647
- **GitHub Release**: Creates GitHub release with changelog
8748
- **npm Publish**: Publishes to npm registry (requires `NPM_TOKEN` secret)
8849

89-
### 5. **Code Quality** (`.github/workflows/quality.yml`)
50+
### 4. **Code Quality** (`.github/workflows/quality.yml`)
9051

91-
**Triggers:** Push to main/develop, Pull requests, Workflow calls from default.yml
52+
**Triggers:** Push to main/develop, Pull requests
9253

9354
**Features:**
9455

95-
- Test coverage analysis with detailed reports
96-
- Bundle size analysis
56+
- Comprehensive linting with detailed reports
57+
- Test coverage analysis
58+
- Bundle size reporting
9759
- Security vulnerability scanning
60+
- CodeQL security analysis
9861
- Archives coverage reports as artifacts
9962

100-
_Note: Comprehensive linting has been moved to default.yml to avoid duplication_
101-
102-
### 6. **Performance Testing** (`.github/workflows/performance.yml`)
103-
104-
**Triggers:** Push/PR to main (when src/ changes), Manual dispatch, Workflow calls from default.yml
105-
106-
**Features:**
107-
108-
- Runs performance benchmarks using Playwright
109-
- Tests initialization time and processing speed
110-
- Fails if performance thresholds are exceeded
111-
- Comments benchmark results on PRs
112-
- Uploads performance results as artifacts
113-
114-
### 7. **Security Analysis** (`.github/workflows/codeql.yml`)
63+
### 5. **Documentation Updates** (`.github/workflows/docs.yml`)
11564

116-
**Triggers:** Push to main, Pull requests, Scheduled (weekly), Manual dispatch, Workflow calls from default.yml
65+
**Triggers:** Push to main (when src/, examples/, or README.md changes), Manual dispatch
11766

11867
**Features:**
11968

120-
- Automated CodeQL security scanning for JavaScript
121-
- Detects potential security vulnerabilities
122-
- Integrates with GitHub Security Advisory database
123-
- Runs weekly on schedule for continuous monitoring
124-
125-
### 8. **Release Workflow** (`.github/workflows/release.yml`)
126-
127-
**Triggers:** Push to main (changeset changes), Manual dispatch
128-
129-
**Features:**
130-
131-
- Integrated with Changesets for version management
132-
- Creates version PRs automatically
133-
- Publishes to npm with proper provenance
134-
- Generates GitHub releases with changelogs
135-
136-
_Note: This workflow remains independent as it handles specialized release processes_
69+
- Auto-generates API documentation
70+
- Updates examples with latest syntax
71+
- Commits changes back to repository
72+
- Skips CI on documentation commits
13773

138-
## Workflow Architecture
139-
140-
### Parallel + Sequential Design
141-
142-
The new architecture optimizes for maximum efficiency with parallel analysis followed by sequential build-dependent tasks:
143-
144-
```text
145-
Default.yml (Orchestrator)
146-
├── Stage 1: Parallel Analysis (simultaneous)
147-
│ ├── Lint & Code Style
148-
│ ├── Quality Analysis (with embedded testing)
149-
│ └── Security Analysis (CodeQL)
150-
├── Stage 2: CI Tests & Build (requires all Stage 1)
151-
├── Stage 3: Performance Tests (conditional, requires Stage 2)
152-
├── Stage 4: Deploy (main only, requires Stages 2-3)
153-
└── Stage 5: Release (conditional, requires all previous stages)
154-
```
155-
156-
**Key Optimizations:**
157-
158-
- **3x faster Stage 1**: Parallel execution instead of sequential
159-
- **Embedded quality checks**: Tests run within quality job to avoid duplication
160-
- **Embedded security**: CodeQL runs inline instead of calling separate workflow
161-
- **Smart dependencies**: Build only happens after all analysis passes
162-
163-
### Standalone Workflows
164-
165-
Some workflows remain independent for specific use cases:
166-
167-
- **Release** (`release.yml`) - Handles changesets and publishing (now also integrated into default.yml)
168-
- **Individual workflows** - Can still be triggered independently for debugging
169-
170-
### Removed Duplication
74+
### 6. **Performance Testing** (`.github/workflows/performance.yml`)
17175

172-
- **Linting**: Centralized in default.yml Stage 1
173-
- **Setup/Dependencies**: Managed per workflow but coordinated
174-
- **Build**: Streamlined through CI workflow
175-
- **Security**: Dedicated stage in pipeline
176-
- **Changeset workflow**: Removed duplicate `changeset.yml` (functionality preserved in `release.yml`)
76+
**Triggers:** Push/PR to main (when src/ changes), Manual dispatch
17777

17878
**Features:**
17979

.github/workflows/release.yml renamed to .github/workflows/changeset.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: Release
1+
name: Changeset
22

33
on:
44
push:
5-
branches: [main]
5+
branches:
6+
- main
67
paths:
78
- ".changeset/**"
89
- "src/**"
@@ -17,23 +18,18 @@ on:
1718
options:
1819
- version
1920
- release
20-
workflow_call: # Allow this workflow to be called by other workflows
2121

2222
concurrency: ${{ github.workflow }}-${{ github.ref }}
2323

2424
jobs:
25-
# Only run release process after main CI/CD pipeline passes
2625
version-or-release:
2726
name: Create Version PR or Release
2827
runs-on: ubuntu-24.04
29-
timeout-minutes: 10
30-
3128
permissions:
3229
contents: write # to create release (changesets/action)
3330
issues: write # to post issue comments (changesets/action)
3431
pull-requests: write # to create pull request (changesets/action)
3532
id-token: write # to use OpenID Connect token for provenance (changesets/action)
36-
3733
steps:
3834
- name: Checkout repository
3935
uses: actions/checkout@v4
@@ -48,12 +44,13 @@ jobs:
4844
run: npm ci
4945

5046
- name: Create Release Pull Request or Publish to npm
51-
# https://github.com/changesets/action
5247
id: changesets
48+
# https://github.com/changesets/action
5349
uses: changesets/action@v1
5450
with:
55-
# this expects you to have a script called changeset:release which does a build for your packages and calls changeset publish
51+
# this expects you to have a script called release which does a build for your packages and calls changeset publish
5652
publish: npm run changeset:release
53+
commit: "chore: version packages"
5754
env:
5855
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5956
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, develop]
66
pull_request:
7-
branches: [main]
8-
workflow_call: # Allow this workflow to be called by other workflows
7+
branches: [main, develop]
98

109
jobs:
1110
test:
@@ -32,6 +31,9 @@ jobs:
3231
- name: Install dependencies
3332
run: npm ci
3433

34+
- name: Run linting
35+
run: npm run lint
36+
3537
- name: Run tests
3638
run: npm test
3739

.github/workflows/codeql.yml

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ name: "CodeQL Advanced"
1313

1414
on:
1515
push:
16-
branches: ["main"]
16+
branches: [ "main" ]
1717
pull_request:
18-
branches: ["main"]
18+
branches: [ "main" ]
1919
schedule:
20-
- cron: "18 7 * * 4"
20+
- cron: '18 7 * * 4'
2121
workflow_dispatch:
22-
workflow_call: # Allow this workflow to be called by other workflows
2322

2423
jobs:
2524
analyze:
@@ -45,10 +44,10 @@ jobs:
4544
fail-fast: false
4645
matrix:
4746
include:
48-
- language: actions
49-
build-mode: none
50-
- language: javascript-typescript
51-
build-mode: none
47+
- language: actions
48+
build-mode: none
49+
- language: javascript-typescript
50+
build-mode: none
5251
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
5352
# Use `c-cpp` to analyze code written in C, C++ or both
5453
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
@@ -58,50 +57,50 @@ jobs:
5857
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
5958
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
6059
steps:
61-
- name: Checkout repository
62-
uses: actions/checkout@v4
60+
- name: Checkout repository
61+
uses: actions/checkout@v4
6362

64-
# Add any setup steps before running the `github/codeql-action/init` action.
65-
# This includes steps like installing compilers or runtimes (`actions/setup-node`
66-
# or others). This is typically only required for manual builds.
67-
# - name: Setup runtime (example)
68-
# uses: actions/setup-example@v1
69-
- name: Setup Node.js
70-
uses: actions/setup-node@v4
71-
with:
72-
node-version-file: ".nvmrc"
73-
cache: "npm"
63+
# Add any setup steps before running the `github/codeql-action/init` action.
64+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
65+
# or others). This is typically only required for manual builds.
66+
# - name: Setup runtime (example)
67+
# uses: actions/setup-example@v1
68+
- name: Setup Node.js
69+
uses: actions/setup-node@v4
70+
with:
71+
node-version-file: ".nvmrc"
72+
cache: "npm"
7473

75-
# Initializes the CodeQL tools for scanning.
76-
- name: Initialize CodeQL
77-
uses: github/codeql-action/init@v3
78-
with:
79-
languages: ${{ matrix.language }}
80-
build-mode: ${{ matrix.build-mode }}
81-
# If you wish to specify custom queries, you can do so here or in a config file.
82-
# By default, queries listed here will override any specified in a config file.
83-
# Prefix the list here with "+" to use these queries and those in the config file.
74+
# Initializes the CodeQL tools for scanning.
75+
- name: Initialize CodeQL
76+
uses: github/codeql-action/init@v3
77+
with:
78+
languages: ${{ matrix.language }}
79+
build-mode: ${{ matrix.build-mode }}
80+
# If you wish to specify custom queries, you can do so here or in a config file.
81+
# By default, queries listed here will override any specified in a config file.
82+
# Prefix the list here with "+" to use these queries and those in the config file.
8483

85-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
86-
# queries: security-extended,security-and-quality
84+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
85+
# queries: security-extended,security-and-quality
8786

88-
# If the analyze step fails for one of the languages you are analyzing with
89-
# "We were unable to automatically build your code", modify the matrix above
90-
# to set the build mode to "manual" for that language. Then modify this step
91-
# to build your code.
92-
# ℹ️ Command-line programs to run using the OS shell.
93-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
94-
- if: matrix.build-mode == 'manual'
95-
shell: bash
96-
run: |
97-
echo 'If you are using a "manual" build mode for one or more of the' \
98-
'languages you are analyzing, replace this with the commands to build' \
99-
'your code, for example:'
100-
echo ' make bootstrap'
101-
echo ' make release'
102-
exit 1
87+
# If the analyze step fails for one of the languages you are analyzing with
88+
# "We were unable to automatically build your code", modify the matrix above
89+
# to set the build mode to "manual" for that language. Then modify this step
90+
# to build your code.
91+
# ℹ️ Command-line programs to run using the OS shell.
92+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
93+
- if: matrix.build-mode == 'manual'
94+
shell: bash
95+
run: |
96+
echo 'If you are using a "manual" build mode for one or more of the' \
97+
'languages you are analyzing, replace this with the commands to build' \
98+
'your code, for example:'
99+
echo ' make bootstrap'
100+
echo ' make release'
101+
exit 1
103102
104-
- name: Perform CodeQL Analysis
105-
uses: github/codeql-action/analyze@v3
106-
with:
107-
category: "/language:${{matrix.language}}"
103+
- name: Perform CodeQL Analysis
104+
uses: github/codeql-action/analyze@v3
105+
with:
106+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)