Skip to content

Commit de493da

Browse files
ci: streamline CI workflow and upgrade GitHub Actions dependencies
1 parent 75fcbd3 commit de493da

File tree

5 files changed

+95
-252
lines changed

5 files changed

+95
-252
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 192 deletions
Original file line numberDiff line numberDiff line change
@@ -25,142 +25,57 @@ concurrency:
2525
group: ${{ github.workflow }}-${{ github.ref }}
2626
cancel-in-progress: true
2727

28+
env:
29+
NODE_VERSION: 20
30+
2831
jobs:
2932
test:
3033
if: github.event_name == 'push' || github.event.pull_request.draft == false
3134
timeout-minutes: 15
3235
runs-on: ubuntu-latest
3336
steps:
34-
<<<<<<< HEAD
37+
- name: Harden runner
38+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7
39+
with:
40+
egress-policy: audit
41+
3542
- name: ⬇️ Checkout code
3643
uses: actions/checkout@v4
3744
with:
3845
persist-credentials: false
3946
fetch-depth: 1
47+
4048
- name: 🟢 Setup Node.js
4149
uses: actions/setup-node@v4
4250
with:
4351
node-version: ${{ env.NODE_VERSION }}
4452
cache: npm
4553
registry-url: https://registry.npmjs.org/
4654
cache-dependency-path: package-lock.json
55+
4756
- name: 📦 Install dependencies
4857
run: npm ci
4958
shell: bash
50-
- name: 🔧 Fix Node.js module exports
51-
shell: bash
52-
run: |
53-
set -e
54-
set -o pipefail
55-
set -Eeuo pipefail
56-
echo "Fixing Node.js module export issues..."
57-
# Safe file processing without shell injection risks
58-
find src/ -name "*.js" -exec grep -l "module.exports" {} \; | while IFS= read -r file; do
59-
if [[ -f "$file" ]] && [[ ! $(tail -1 "$file") =~ module\.exports ]]; then
60-
echo "// Ensure module.exports is properly defined" >> "$file"
61-
echo "Fixed exports in: $file"
62-
fi
63-
done
64-
- name: 🧹 Lint (Resilient)
65-
id: lint
66-
shell: bash
67-
env:
68-
EVENT_NAME: "\"${{ github.event_name }}\""
69-
run: |
70-
set -e
71-
set -o pipefail
72-
set -Eeuo pipefail
73-
if [[ ""$EVENT_NAME"" == "pull_request" ]]; then
74-
echo "📝 PR Mode: Warnings allowed, errors reported"
75-
npm run lint:errors-only || echo "::warning::Lint errors found but not blocking PR"
76-
else
77-
echo "🔒 Main branch: Strict linting enforced"
78-
npm run lint:strict
79-
fi
80-
continue-on-error: ${{ github.event_name == 'pull_request' }}
81-
- name: ✅ Core Tests
82-
id: test
83-
shell: bash
84-
run: |
85-
set -e
86-
set -o pipefail
87-
set -Eeuo pipefail
88-
echo "Running critical test suite..."
89-
npm test -- --testPathPattern="(core|pipeline|cli)" --maxWorkers=2
90-
continue-on-error: false
91-
timeout-minutes: 15
92-
diagnostics:
93-
name: 📊 Quality Diagnostics
94-
runs-on: ubuntu-latest
95-
timeout-minutes: 20
96-
needs:
97-
- critical-checks
98-
if: always()
99-
steps:
100-
- name: ⬇️ Checkout code
101-
uses: actions/checkout@v4
102-
with:
103-
persist-credentials: false
104-
fetch-depth: 1
105-
- name: 🟢 Setup Node.js
106-
uses: actions/setup-node@v4
107-
with:
108-
node-version: ${{ env.NODE_VERSION }}
109-
=======
110-
- name: Harden runner
111-
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7
112-
with:
113-
egress-policy: audit
114-
115-
- uses: actions/checkout@v4
116-
- uses: actions/setup-node@v4
117-
with:
118-
node-version: 20
119-
>>>>>>> develop
120-
cache: npm
121-
cache-dependency-path: package-lock.json
12259

123-
- name: Install
124-
run: npm ci
125-
<<<<<<< HEAD
126-
shell: bash
127-
- name: 📊 Full Lint Report
128-
shell: bash
129-
run: |
130-
set -e
131-
set -o pipefail
132-
set -Eeuo pipefail
133-
npm run lint:diagnostic
134-
continue-on-error: true
135-
- name: 📈 Coverage Report
136-
shell: bash
137-
run: |
138-
set -e
139-
set -o pipefail
140-
set -Eeuo pipefail
141-
npm test -- --coverage --testPathPattern="(core|pipeline)" || echo "Partial coverage generated"
142-
continue-on-error: true
143-
- name: 📊 Upload Partial Coverage
144-
uses: codecov/codecov-action@v4
145-
=======
146-
- name: Lint
60+
- name: 🧹 Lint
14761
run: npm run lint --if-present
148-
- name: Type check
62+
63+
- name: 🔍 Type check
14964
run: npm run typecheck --if-present
150-
- name: Test
65+
66+
- name: ✅ Test
15167
run: npm test -- --ci --reporters=default --reporters=jest-junit --passWithNoTests
15268

15369
- name: Upload JUnit
154-
>>>>>>> develop
15570
if: always()
156-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
71+
uses: actions/upload-artifact@v4
15772
with:
15873
name: junit
15974
path: junit.xml
16075

16176
- name: Upload coverage
16277
if: always()
163-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
78+
uses: actions/upload-artifact@v4
16479
with:
16580
name: coverage
16681
path: coverage
@@ -171,105 +86,20 @@ jobs:
17186
timeout-minutes: 5
17287
runs-on: ubuntu-latest
17388
steps:
174-
<<<<<<< HEAD
175-
- name: ⬇️ Checkout code
176-
uses: actions/checkout@v4
177-
with:
178-
persist-credentials: false
179-
fetch-depth: 1
180-
- name: 🟢 Setup Node.js
181-
uses: actions/setup-node@v4
182-
=======
18389
- name: Harden runner
18490
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7
18591
with:
18692
egress-policy: audit
187-
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
188-
>>>>>>> develop
93+
94+
- name: Download coverage
95+
uses: actions/download-artifact@v4
18996
with:
19097
name: coverage
19198
path: coverage
19299
continue-on-error: true
193-
<<<<<<< HEAD
194-
timeout-minutes: ${{ matrix.test-suite.timeout }}
195-
deploy:
196-
name: 🚀 Deploy & Release
197-
runs-on: ubuntu-latest
198-
timeout-minutes: 45
199-
permissions:
200-
contents: write
201-
packages: write
202-
id-token: write
203-
needs:
204-
- critical-checks
205-
if: |
206-
github.ref == 'refs/heads/main' &&
207-
needs.critical-checks.outputs.lint-status == 'success' &&
208-
needs.critical-checks.outputs.test-status == 'success' &&
209-
github.actor != 'github-actions[bot]'
210-
steps:
211-
- name: ⬇️ Checkout code
212-
uses: actions/checkout@v4
213-
with:
214-
fetch-depth: 0
215-
persist-credentials: false
216-
- name: 🟢 Setup Node.js
217-
uses: actions/setup-node@v4
218-
with:
219-
node-version: ${{ env.NODE_VERSION }}
220-
cache: npm
221-
registry-url: https://registry.npmjs.org/
222-
cache-dependency-path: package-lock.json
223-
- name: 📦 Install dependencies
224-
run: npm ci
225-
shell: bash
226-
- name: ✅ Run tests with coverage
227-
shell: bash
228-
run: |
229-
set -e
230-
set -o pipefail
231-
set -Eeuo pipefail
232-
npm test
233-
timeout-minutes: 20
234-
- name: 🧪 Validate Fixtures (Non-blocking)
235-
shell: bash
236-
run: |
237-
set -e
238-
set -o pipefail
239-
set -Eeuo pipefail
240-
npm run validate-fixtures || echo "Fixtures validation failed but continuing..."
241-
continue-on-error: true
242-
- name: 📊 Upload coverage to Codecov
243-
uses: codecov/codecov-action@v4
244-
=======
100+
245101
- name: Upload to Codecov
246-
uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a
247-
>>>>>>> develop
102+
uses: codecov/codecov-action@v4
248103
with:
249104
token: ${{ secrets.CODECOV_TOKEN }}
250105
fail_ci_if_error: false
251-
<<<<<<< HEAD
252-
- name: 🚀 Semantic Release
253-
shell: bash
254-
env:
255-
GITHUB_TOKEN: "\"${{ secrets.GITHUB_TOKEN }}\""
256-
GH_TOKEN: "\"${{ secrets.GH_TOKEN }}\""
257-
NPM_TOKEN: "\"${{ secrets.NPM_TOKEN }}\""
258-
NODE_AUTH_TOKEN: "\"${{ secrets.NPM_TOKEN }}\""
259-
run: |
260-
set -e
261-
set -o pipefail
262-
set -Eeuo pipefail
263-
npx semantic-release
264-
timeout-minutes: 15
265-
- name: 📋 Upload Release Artifacts
266-
if: failure()
267-
uses: actions/upload-artifact@v4
268-
with:
269-
name: release-failure-logs
270-
path: |
271-
npm-debug.log*
272-
.npm/_logs/*
273-
retention-days: 7
274-
=======
275-
>>>>>>> develop

.github/workflows/docs-build.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Docs Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "docs/**"
8+
- "docs-site/**"
9+
- ".github/workflows/docs-build.yml"
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: pages
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build:
22+
timeout-minutes: 15
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Harden runner
26+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7
27+
with:
28+
egress-policy: audit
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: 20
33+
cache: npm
34+
cache-dependency-path: package-lock.json
35+
- name: Install root deps
36+
run: npm ci
37+
- name: Build Docusaurus
38+
working-directory: docs-site
39+
run: |
40+
npm ci
41+
npm run build
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
44+
with:
45+
path: docs-site/build
46+
47+
deploy:
48+
needs: build
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
runs-on: ubuntu-latest
53+
permissions:
54+
pages: write
55+
id-token: write
56+
steps:
57+
- id: deployment
58+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e

.github/workflows/docs-deploy.yml

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<<<<<<< HEAD
21
name: Deploy Docs to GitHub Pages
32

43
on:
@@ -49,62 +48,3 @@ jobs:
4948
- name: Deploy to GitHub Pages
5049
id: deployment
5150
uses: actions/deploy-pages@v4
52-
=======
53-
name: Docs
54-
on:
55-
push:
56-
branches: [main]
57-
paths:
58-
- "docs/**"
59-
- "docs-site/**"
60-
- ".github/workflows/docs-deploy.yml"
61-
62-
permissions:
63-
contents: read
64-
pages: write
65-
id-token: write
66-
67-
concurrency:
68-
group: pages
69-
cancel-in-progress: true
70-
71-
jobs:
72-
build:
73-
timeout-minutes: 15
74-
runs-on: ubuntu-latest
75-
steps:
76-
- name: Harden runner
77-
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7
78-
with:
79-
egress-policy: audit
80-
- uses: actions/checkout@v4
81-
- uses: actions/setup-node@v4
82-
with:
83-
node-version: 20
84-
cache: npm
85-
cache-dependency-path: package-lock.json
86-
- name: Install root deps
87-
run: npm ci
88-
- name: Build Docusaurus
89-
working-directory: docs-site
90-
run: |
91-
npm ci
92-
npm run build
93-
- name: Upload artifact
94-
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa
95-
with:
96-
path: docs-site/build
97-
98-
deploy:
99-
needs: build
100-
environment:
101-
name: github-pages
102-
url: ${{ steps.deployment.outputs.page_url }}
103-
runs-on: ubuntu-latest
104-
permissions:
105-
pages: write
106-
id-token: write
107-
steps:
108-
- id: deployment
109-
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e
110-
>>>>>>> develop

0 commit comments

Comments
 (0)