Skip to content

Commit 2953044

Browse files
Merge pull request #16 from no-witness-labs/fix/simplify-workflows
Revert to simple working workflows
2 parents d1094e5 + ddb46a6 commit 2953044

File tree

2 files changed

+117
-158
lines changed

2 files changed

+117
-158
lines changed

.github/workflows/ci.yml

Lines changed: 84 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -12,122 +12,108 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15-
setup:
16-
name: Setup
15+
lint:
16+
name: ⬣ ESLint
1717
runs-on: ubuntu-latest
18-
outputs:
19-
cache-hit: ${{ steps.cache-node-modules.outputs.cache-hit }}
2018
steps:
21-
- uses: actions/checkout@v4
22-
with:
23-
fetch-depth: 2
19+
- name: ⬇️ Checkout repo
20+
uses: actions/checkout@v4
2421

25-
- uses: pnpm/action-setup@v4
22+
- name: 📦 Install pnpm
23+
uses: pnpm/action-setup@v4
2624

27-
- uses: actions/setup-node@v4
25+
- name: ⎔ Setup Node.js
26+
uses: actions/setup-node@v4
2827
with:
2928
node-version: 20
3029
cache: 'pnpm'
3130

32-
- id: cache-node-modules
33-
uses: actions/cache@v4
34-
with:
35-
path: |
36-
node_modules
37-
packages/*/node_modules
38-
docs/node_modules
39-
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
40-
restore-keys: |
41-
${{ runner.os }}-modules-
42-
43-
- id: cache-turbo
44-
uses: actions/cache@v4
45-
with:
46-
path: .turbo
47-
key: ${{ runner.os }}-turbo-${{ github.sha }}
48-
restore-keys: |
49-
${{ runner.os }}-turbo-
50-
51-
# Always run install to ensure all dependencies are available
52-
# This ensures workspace packages like docs have their dependencies
53-
- run: pnpm install --frozen-lockfile
54-
55-
validate:
56-
name: Validate
57-
needs: setup
31+
- name: 📦 Install dependencies
32+
run: pnpm install --frozen-lockfile
33+
34+
- name: 🔬 Lint
35+
run: pnpm turbo run lint --affected
36+
37+
typecheck:
38+
name: ʦ TypeScript
5839
runs-on: ubuntu-latest
5940
steps:
60-
- uses: actions/checkout@v4
61-
with:
62-
fetch-depth: 2
41+
- name: ⬇️ Checkout repo
42+
uses: actions/checkout@v4
6343

64-
- uses: pnpm/action-setup@v4
44+
- name: 📦 Install pnpm
45+
uses: pnpm/action-setup@v4
6546

66-
- uses: actions/setup-node@v4
47+
- name: ⎔ Setup Node.js
48+
uses: actions/setup-node@v4
6749
with:
6850
node-version: 20
6951
cache: 'pnpm'
7052

71-
- uses: actions/cache@v4
72-
with:
73-
path: |
74-
node_modules
75-
packages/*/node_modules
76-
docs/node_modules
77-
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
78-
restore-keys: |
79-
${{ runner.os }}-modules-
80-
81-
- uses: actions/cache@v4
82-
with:
83-
path: .turbo
84-
key: ${{ runner.os }}-turbo-${{ github.sha }}
85-
restore-keys: |
86-
${{ runner.os }}-turbo-
87-
88-
- run: pnpm turbo run lint --affected
89-
- run: pnpm turbo run type-check --affected
90-
- run: pnpm turbo run build --affected
91-
- run: pnpm turbo run test --affected
92-
93-
# Debug: Check what was built
94-
- name: Check build output
95-
run: |
96-
echo "Checking packages directory structure:"
97-
find packages -name "dist" -type d || echo "No dist directories found"
98-
ls -la packages/*/dist 2>/dev/null || echo "No dist directories to list"
99-
100-
- uses: actions/upload-artifact@v4
101-
if: success()
102-
with:
103-
name: build-artifacts
104-
path: packages/*/dist
105-
if-no-files-found: warn
53+
- name: 📦 Install dependencies
54+
run: pnpm install --frozen-lockfile
55+
56+
- name: 🔎 Type check
57+
run: pnpm turbo run type-check --affected
10658

107-
cache-build:
108-
name: Cache Artifacts
109-
needs: validate
59+
test:
60+
name: 🧪 Test
11061
runs-on: ubuntu-latest
111-
if: success()
11262
steps:
113-
- uses: actions/download-artifact@v4
114-
id: download-artifacts
115-
continue-on-error: true
63+
- name: ⬇️ Checkout repo
64+
uses: actions/checkout@v4
65+
66+
- name: 📦 Install pnpm
67+
uses: pnpm/action-setup@v4
68+
69+
- name: ⎔ Setup Node.js
70+
uses: actions/setup-node@v4
11671
with:
117-
name: build-artifacts
118-
path: packages
119-
120-
- name: Check artifact download
121-
run: |
122-
if [[ "${{ steps.download-artifacts.outcome }}" == "success" ]]; then
123-
echo "Artifacts downloaded successfully"
124-
ls -la packages/
125-
else
126-
echo "No artifacts to download - this may be expected if no packages were built"
127-
fi
128-
129-
- uses: actions/cache@v4
130-
if: steps.download-artifacts.outcome == 'success'
72+
node-version: 20
73+
cache: 'pnpm'
74+
75+
- name: 📦 Install dependencies
76+
run: pnpm install --frozen-lockfile
77+
78+
- name: 🧪 Run tests
79+
run: pnpm turbo run test --affected
80+
81+
build:
82+
name: 🏗 Build
83+
runs-on: ubuntu-latest
84+
steps:
85+
- name: ⬇️ Checkout repo
86+
uses: actions/checkout@v4
87+
88+
- name: 📦 Install pnpm
89+
uses: pnpm/action-setup@v4
90+
91+
- name: ⎔ Setup Node.js
92+
uses: actions/setup-node@v4
13193
with:
132-
path: packages/*/dist
133-
key: build-artifacts-${{ github.sha }}
94+
node-version: 20
95+
cache: 'pnpm'
96+
97+
- name: 📦 Install dependencies
98+
run: pnpm install --frozen-lockfile
99+
100+
- name: 🏗 Build packages
101+
run: pnpm turbo run build --affected
102+
103+
- name: 📄 Generate docs (validate examples)
104+
run: pnpm turbo run docgen --affected || echo "No docgen script found, skipping"
105+
106+
# All jobs must pass
107+
ci:
108+
name: ✅ CI
109+
runs-on: ubuntu-latest
110+
if: always()
111+
needs: [lint, typecheck, test, build]
112+
steps:
113+
- name: ✅ All jobs passed
114+
if: ${{ !(contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
115+
run: exit 0
116+
117+
- name: ❌ Some jobs failed
118+
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
119+
run: exit 1

.github/workflows/docs.yml

Lines changed: 33 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -22,81 +22,53 @@ jobs:
2222
runs-on: ubuntu-latest
2323

2424
steps:
25-
- uses: actions/checkout@v4
26-
with:
27-
fetch-depth: 2
28-
29-
- uses: pnpm/action-setup@v4
25+
- name: ⬇️ Checkout
26+
uses: actions/checkout@v4
3027

31-
- uses: actions/setup-node@v4
28+
- name: ⎔ Install Node.js
29+
uses: actions/setup-node@v4
3230
with:
3331
node-version: 20
34-
cache: 'pnpm'
3532

36-
- id: cached-build-artifacts
37-
uses: actions/cache@v4
33+
- name: 📦 Install pnpm
34+
uses: pnpm/action-setup@v4
3835
with:
39-
path: packages/*/dist
40-
key: build-artifacts-${{ github.sha }}
41-
restore-keys: |
42-
build-artifacts-
36+
run_install: false
4337

44-
- id: cache-node-modules
45-
uses: actions/cache@v4
46-
with:
47-
path: |
48-
node_modules
49-
packages/*/node_modules
50-
docs/node_modules
51-
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
52-
restore-keys: |
53-
${{ runner.os }}-modules-
38+
- name: Get pnpm store directory
39+
shell: bash
40+
run: |
41+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
5442
55-
- id: cache-turbo
43+
- name: Setup pnpm cache
5644
uses: actions/cache@v4
5745
with:
58-
path: .turbo
59-
key: ${{ runner.os }}-turbo-${{ github.sha }}
46+
path: ${{ env.STORE_PATH }}
47+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
6048
restore-keys: |
61-
${{ runner.os }}-turbo-
49+
${{ runner.os }}-pnpm-store-
6250
63-
# Always run install to ensure all dependencies are available
64-
# This ensures workspace packages like docs have their dependencies
65-
- run: pnpm install --frozen-lockfile
51+
- name: 📦 Install dependencies
52+
run: pnpm install
6653

67-
# Always build packages to ensure we have the latest changes
68-
# Don't rely solely on cache as it might be stale or missing
69-
- run: pnpm turbo run build
54+
- name: 🏗 Build packages (required for docs)
55+
run: pnpm turbo run build
7056

71-
- run: pnpm turbo run docgen --filter=@evolution-sdk/evolution
57+
- name: 📄 Generate Evolution SDK docs
58+
run: pnpm turbo run docgen
59+
working-directory: packages/evolution
7260

73-
# Build the docs with Next.js static export (output: export in next.config.js)
74-
- run: pnpm --filter=@evolution-sdk/docs run build
61+
- name: 📚 Copy Evolution docs to website
62+
run: node scripts/copy-evolution-docs.mjs
63+
working-directory: docs
7564

76-
- id: cache-docs-output
77-
uses: actions/cache@v4
78-
with:
79-
path: docs/out
80-
key: docs-output-${{ github.sha }}
81-
restore-keys: |
82-
docs-output-
83-
84-
# Add debug step to check if the output directory exists
85-
- name: Debug output directory
65+
- name: 🏗 Build documentation
8666
run: |
87-
echo "Checking docs build output:"
88-
ls -la docs/
89-
if [ -d "docs/out" ]; then
90-
echo "docs/out directory exists:"
91-
ls -la docs/out/
92-
echo "Total files in docs/out:"
93-
find docs/out -type f | wc -l
94-
else
95-
echo "ERROR: docs/out directory does not exist!"
96-
exit 1
97-
fi
98-
99-
- uses: actions/upload-pages-artifact@v3
67+
cd docs
68+
pnpm build
69+
70+
- name: 📤 Upload artifact
71+
uses: actions/upload-pages-artifact@v3
10072
with:
10173
path: docs/out
10274

@@ -108,5 +80,6 @@ jobs:
10880
runs-on: ubuntu-latest
10981
needs: build
11082
steps:
111-
- id: deployment
83+
- name: 🚀 Deploy to GitHub Pages
84+
id: deployment
11285
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)