feat: implement dual CI architecture - comprehensive on fork, lightwe… #61
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Development CI (Nx Cloud) | |
| # Comprehensive CI for development fork with Nx Cloud integration | |
| # Full testing suite for development iteration and feedback | |
| # NOTE: Preview repo uses separate lightweight preview-ci.yml | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| workflow_dispatch: | |
| inputs: | |
| skip_nx_cache: | |
| description: 'Skip Nx cache (force fresh builds)' | |
| required: false | |
| default: 'false' | |
| type: boolean | |
| env: | |
| NX_BRANCH: ${{ github.event.number || github.ref_name }} | |
| NX_RUN_GROUP: ${{ github.run_id }} | |
| HUSKY: 0 | |
| # Set DOCS_ENV based on branch/event type for proper environment detection | |
| DOCS_ENV: ${{ github.event_name == 'pull_request' && 'preview' || github.ref_name == 'main' && 'production' || github.ref_name == 'dev' && 'development' || 'development' }} | |
| # Fallback environment variables for sites that need them | |
| SITE_TITLE: IFLA Standards Portal | |
| SITE_TAGLINE: International Federation of Library Associations and Institutions | |
| # Skip Nx cache if requested via workflow dispatch | |
| NX_SKIP_NX_CACHE: ${{ inputs.skip_nx_cache == 'true' && 'true' || '' }} | |
| jobs: | |
| ci: | |
| name: CI Pipeline | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout [Pull Request] | |
| uses: actions/checkout@v4 | |
| if: ${{ github.event_name == 'pull_request' }} | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Checkout [Default Branch] | |
| uses: actions/checkout@v4 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Derive appropriate SHAs for base and head for `nx affected` commands | |
| uses: nrwl/nx-set-shas@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Development CI - Comprehensive Testing with Nx Cloud | |
| run: | | |
| echo "🚀 Development CI with Nx Cloud - Comprehensive Testing" | |
| echo "Running on development fork for full feedback loop" | |
| # Group 5: Environment-specific validation only | |
| echo "🌐 Running CI connectivity tests..." | |
| pnpm test:ci:connectivity | |
| echo "⚙️ Running CI configuration validation..." | |
| pnpm test:ci:config | |
| echo "🏗️ Running deployment build validation..." | |
| CACHE_FLAG="" | |
| if [ "$NX_SKIP_NX_CACHE" = "true" ]; then | |
| echo "Skipping Nx cache for fresh builds" | |
| CACHE_FLAG="--skip-nx-cache" | |
| fi | |
| npx nx affected --target=build --parallel=3 $CACHE_FLAG | |