chore: Rework bundling #1481
This file contains 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: CI/CD | |
on: | |
push: | |
branches: | |
- master | |
- beta | |
- next | |
pull_request: | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: | |
env: | |
FORCE_COLOR: 3 # Diplay chalk colors | |
jobs: | |
lint: | |
name: Linting | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --ignore-scripts --frozen-lockfile --workspace-root | |
- name: Check monorepo with Sherif | |
run: pnpm run lint:sherif | |
- name: Check source code formatting | |
run: | | |
set +e # Allow Prettier to fail, but capture the error code | |
output=$(./node_modules/.bin/prettier --list-different ./packages/nuqs 2>&1) | |
exit_code=$? | |
set -e | |
if [ $exit_code -ne 0 ]; then | |
echo "$output" | while IFS= read -r file; do | |
echo "::warning file=$file::Prettier detected formatting issues in $file" | |
done | |
exit $exit_code | |
else | |
echo "No formatting issues found" | |
fi | |
ci-core: | |
name: CI (core) | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --ignore-scripts --frozen-lockfile --filter nuqs... | |
- name: Run tests | |
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter nuqs | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }} | |
e2e-next: | |
# Watch out! When changing the job name, | |
# update the required checks in GitHub | |
# branch protection settings for `next`. | |
name: E2E (next@${{ matrix.next-version }}${{ matrix.base-path && ' basePath' || ''}}) | |
runs-on: ubuntu-24.04 | |
needs: [ci-core] | |
strategy: | |
fail-fast: false | |
matrix: | |
# Watch out! When changing the compat grid, | |
# update the required checks in GitHub | |
# branch protection settings for `next`. | |
base-path: [false, '/base'] | |
next-version: | |
# Only keep versions where there were relevant changes in the app router core, | |
# and the previous one to use as a baseline. | |
- '14.2.0' | |
- '14.2.3' # before vercel/next.js#66755 | |
- '14.2.4' # after vercel/next.js#66755 | |
- '14.2.7' # before vercel/next.js#69509 | |
- '14.2.8' # after vercel/next.js#69509 | |
- '15.0.0' | |
- latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile ${{ matrix.next-version != 'latest' && '--filter e2e-next...' || '' }} | |
- name: Install Next.js version ${{ matrix.next-version }} | |
if: ${{ matrix.next-version != 'local' }} | |
run: pnpm add --filter e2e-next --filter nuqs next@${{ matrix.next-version }} | |
- name: Run integration tests | |
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter e2e-next | |
env: | |
BASE_PATH: ${{ matrix.base-path && matrix.base-path || '/' }} | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }} | |
- name: Save Cypress artifacts | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | |
if: failure() | |
with: | |
path: packages/e2e/next/cypress/screenshots | |
name: ci-${{ matrix.next-version }}${{ matrix.base-path && '-basePath' || ''}} | |
- uses: 47ng/actions-slack-notify@main | |
name: Notify on Slack | |
if: always() | |
with: | |
status: ${{ job.status }} | |
jobName: next@${{ matrix.next-version }}${{ matrix.base-path && ' basePath' || ''}} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
e2e-react: | |
name: E2E (react) | |
runs-on: ubuntu-24.04 | |
needs: [ci-core] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --filter e2e-react... | |
- name: Run tests | |
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter e2e-react | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }} | |
- name: Save Cypress artifacts | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | |
if: failure() | |
with: | |
path: packages/e2e/react/cypress/screenshots | |
name: ci-react | |
- uses: 47ng/actions-slack-notify@main | |
name: Notify on Slack | |
if: always() | |
with: | |
status: ${{ job.status }} | |
jobName: react | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
e2e-react-router: | |
name: E2E (react-router ${{ matrix.react-router-version }}) | |
runs-on: ubuntu-24.04 | |
needs: [ci-core] | |
strategy: | |
fail-fast: false | |
matrix: | |
react-router-version: | |
- 'v6' | |
- 'v7' | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --filter e2e-react-router-${{ matrix.react-router-version }}... | |
- name: Run tests | |
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter e2e-react-router-${{ matrix.react-router-version }} | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }} | |
- name: Save Cypress artifacts | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | |
if: failure() | |
with: | |
path: packages/e2e/react-router/${{ matrix.react-router-version }}/cypress/screenshots | |
name: ci-react-router-${{ matrix.react-router-version }} | |
- uses: 47ng/actions-slack-notify@main | |
name: Notify on Slack | |
if: always() | |
with: | |
status: ${{ job.status }} | |
jobName: react-router-${{ matrix.react-router-version }} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
e2e-remix: | |
name: E2E (remix) | |
runs-on: ubuntu-24.04 | |
needs: [ci-core] | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --filter e2e-remix... | |
- name: Run tests | |
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter e2e-remix | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }} | |
- name: Save Cypress artifacts | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 | |
if: failure() | |
with: | |
path: packages/e2e/remix/cypress/screenshots | |
name: ci-remix | |
- uses: 47ng/actions-slack-notify@main | |
name: Notify on Slack | |
if: always() | |
with: | |
status: ${{ job.status }} | |
jobName: remix | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
cd: | |
name: Deployment | |
runs-on: ubuntu-24.04 | |
needs: | |
- lint | |
- ci-core | |
- e2e-next | |
- e2e-react | |
- e2e-react-router | |
- e2e-remix | |
if: ${{ github.ref_name == 'master' || github.ref_name == 'beta' }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
# Note: we do not use an external Turbo cache for publishing | |
# to prevent against possible cache collision attacks. | |
- name: Install dependencies | |
run: pnpm install --ignore-scripts --frozen-lockfile --filter nuqs... | |
- name: Build package | |
run: pnpm build --filter nuqs | |
- name: Semantic Release | |
run: ../../node_modules/.bin/semantic-release | |
working-directory: packages/nuqs | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Invalidate ISR cache for NPM in the docs | |
run: curl -s "https://nuqs.47ng.com/api/isr?tag=npm&token=${{ secrets.ISR_TOKEN }}" |