From ddb46a6aa7763f4d9046694bdbd570d0167c879b Mon Sep 17 00:00:00 2001 From: solidsnakedev Date: Thu, 31 Jul 2025 15:41:08 -0600 Subject: [PATCH] Revert to simple working workflows - Restore CI workflow to simple parallel jobs structure - Restore docs workflow to the working configuration from commit 922f24b - Remove complex caching and debugging that was causing issues - Use proven workflow structure that successfully deployed GitHub Pages --- .github/workflows/ci.yml | 182 +++++++++++++++++-------------------- .github/workflows/docs.yml | 93 +++++++------------ 2 files changed, 117 insertions(+), 158 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b69bde4..1ab59ce4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,122 +12,108 @@ concurrency: cancel-in-progress: true jobs: - setup: - name: Setup + lint: + name: โฌฃ ESLint runs-on: ubuntu-latest - outputs: - cache-hit: ${{ steps.cache-node-modules.outputs.cache-hit }} steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 + - name: ๐Ÿ“ฆ Install pnpm + uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 + - name: โŽ” Setup Node.js + uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - - id: cache-node-modules - uses: actions/cache@v4 - with: - path: | - node_modules - packages/*/node_modules - docs/node_modules - key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-modules- - - - id: cache-turbo - uses: actions/cache@v4 - with: - path: .turbo - key: ${{ runner.os }}-turbo-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-turbo- - - # Always run install to ensure all dependencies are available - # This ensures workspace packages like docs have their dependencies - - run: pnpm install --frozen-lockfile - - validate: - name: Validate - needs: setup + - name: ๐Ÿ“ฆ Install dependencies + run: pnpm install --frozen-lockfile + + - name: ๐Ÿ”ฌ Lint + run: pnpm turbo run lint --affected + + typecheck: + name: สฆ TypeScript runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 + - name: ๐Ÿ“ฆ Install pnpm + uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 + - name: โŽ” Setup Node.js + uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' - - uses: actions/cache@v4 - with: - path: | - node_modules - packages/*/node_modules - docs/node_modules - key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-modules- - - - uses: actions/cache@v4 - with: - path: .turbo - key: ${{ runner.os }}-turbo-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-turbo- - - - run: pnpm turbo run lint --affected - - run: pnpm turbo run type-check --affected - - run: pnpm turbo run build --affected - - run: pnpm turbo run test --affected - - # Debug: Check what was built - - name: Check build output - run: | - echo "Checking packages directory structure:" - find packages -name "dist" -type d || echo "No dist directories found" - ls -la packages/*/dist 2>/dev/null || echo "No dist directories to list" - - - uses: actions/upload-artifact@v4 - if: success() - with: - name: build-artifacts - path: packages/*/dist - if-no-files-found: warn + - name: ๐Ÿ“ฆ Install dependencies + run: pnpm install --frozen-lockfile + + - name: ๐Ÿ”Ž Type check + run: pnpm turbo run type-check --affected - cache-build: - name: Cache Artifacts - needs: validate + test: + name: ๐Ÿงช Test runs-on: ubuntu-latest - if: success() steps: - - uses: actions/download-artifact@v4 - id: download-artifacts - continue-on-error: true + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v4 + + - name: ๐Ÿ“ฆ Install pnpm + uses: pnpm/action-setup@v4 + + - name: โŽ” Setup Node.js + uses: actions/setup-node@v4 with: - name: build-artifacts - path: packages - - - name: Check artifact download - run: | - if [[ "${{ steps.download-artifacts.outcome }}" == "success" ]]; then - echo "Artifacts downloaded successfully" - ls -la packages/ - else - echo "No artifacts to download - this may be expected if no packages were built" - fi - - - uses: actions/cache@v4 - if: steps.download-artifacts.outcome == 'success' + node-version: 20 + cache: 'pnpm' + + - name: ๐Ÿ“ฆ Install dependencies + run: pnpm install --frozen-lockfile + + - name: ๐Ÿงช Run tests + run: pnpm turbo run test --affected + + build: + name: ๐Ÿ— Build + runs-on: ubuntu-latest + steps: + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v4 + + - name: ๐Ÿ“ฆ Install pnpm + uses: pnpm/action-setup@v4 + + - name: โŽ” Setup Node.js + uses: actions/setup-node@v4 with: - path: packages/*/dist - key: build-artifacts-${{ github.sha }} + node-version: 20 + cache: 'pnpm' + + - name: ๐Ÿ“ฆ Install dependencies + run: pnpm install --frozen-lockfile + + - name: ๐Ÿ— Build packages + run: pnpm turbo run build --affected + + - name: ๐Ÿ“„ Generate docs (validate examples) + run: pnpm turbo run docgen --affected || echo "No docgen script found, skipping" + + # All jobs must pass + ci: + name: โœ… CI + runs-on: ubuntu-latest + if: always() + needs: [lint, typecheck, test, build] + steps: + - name: โœ… All jobs passed + if: ${{ !(contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }} + run: exit 0 + + - name: โŒ Some jobs failed + if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} + run: exit 1 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 86c81b82..1f5a8918 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,81 +22,53 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - uses: pnpm/action-setup@v4 + - name: โฌ‡๏ธ Checkout + uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: โŽ” Install Node.js + uses: actions/setup-node@v4 with: node-version: 20 - cache: 'pnpm' - - id: cached-build-artifacts - uses: actions/cache@v4 + - name: ๐Ÿ“ฆ Install pnpm + uses: pnpm/action-setup@v4 with: - path: packages/*/dist - key: build-artifacts-${{ github.sha }} - restore-keys: | - build-artifacts- + run_install: false - - id: cache-node-modules - uses: actions/cache@v4 - with: - path: | - node_modules - packages/*/node_modules - docs/node_modules - key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-modules- + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - id: cache-turbo + - name: Setup pnpm cache uses: actions/cache@v4 with: - path: .turbo - key: ${{ runner.os }}-turbo-${{ github.sha }} + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | - ${{ runner.os }}-turbo- + ${{ runner.os }}-pnpm-store- - # Always run install to ensure all dependencies are available - # This ensures workspace packages like docs have their dependencies - - run: pnpm install --frozen-lockfile + - name: ๐Ÿ“ฆ Install dependencies + run: pnpm install - # Always build packages to ensure we have the latest changes - # Don't rely solely on cache as it might be stale or missing - - run: pnpm turbo run build + - name: ๐Ÿ— Build packages (required for docs) + run: pnpm turbo run build - - run: pnpm turbo run docgen --filter=@evolution-sdk/evolution + - name: ๐Ÿ“„ Generate Evolution SDK docs + run: pnpm turbo run docgen + working-directory: packages/evolution - # Build the docs with Next.js static export (output: export in next.config.js) - - run: pnpm --filter=@evolution-sdk/docs run build + - name: ๐Ÿ“š Copy Evolution docs to website + run: node scripts/copy-evolution-docs.mjs + working-directory: docs - - id: cache-docs-output - uses: actions/cache@v4 - with: - path: docs/out - key: docs-output-${{ github.sha }} - restore-keys: | - docs-output- - - # Add debug step to check if the output directory exists - - name: Debug output directory + - name: ๐Ÿ— Build documentation run: | - echo "Checking docs build output:" - ls -la docs/ - if [ -d "docs/out" ]; then - echo "docs/out directory exists:" - ls -la docs/out/ - echo "Total files in docs/out:" - find docs/out -type f | wc -l - else - echo "ERROR: docs/out directory does not exist!" - exit 1 - fi - - - uses: actions/upload-pages-artifact@v3 + cd docs + pnpm build + + - name: ๐Ÿ“ค Upload artifact + uses: actions/upload-pages-artifact@v3 with: path: docs/out @@ -108,5 +80,6 @@ jobs: runs-on: ubuntu-latest needs: build steps: - - id: deployment + - name: ๐Ÿš€ Deploy to GitHub Pages + id: deployment uses: actions/deploy-pages@v4