Skip to content

refactor: remove outdated test targets and standardize environment setup #42

refactor: remove outdated test targets and standardize environment setup

refactor: remove outdated test targets and standardize environment setup #42

name: Nx Optimized CI
# Optimized CI pipeline for Nx workspace
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:
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
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: Build affected projects for deployment validation
run: npx nx affected --target=build --parallel=3
- name: Run deployment-critical tests
run: npx nx affected --target=test --parallel=3