ci(check): filter jobs by changes #1
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
| # This workflow runs for every pull request, filtering jobs by changed paths. | |
| # For push to master/renovate, see check.yaml which runs everything. | |
| name: "PR Check" | |
| on: | |
| pull_request: | |
| branches: [master] | |
| env: | |
| LATEST_NODE_VERSION: 24 | |
| APIFY_CLI_DISABLE_TELEMETRY: 1 | |
| concurrency: | |
| cancel-in-progress: true | |
| group: checks-${{ github.ref }} | |
| jobs: | |
| changes: | |
| name: Detect changes | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| outputs: | |
| source: ${{ steps.filter.outputs.source }} | |
| docs: ${{ steps.filter.outputs.docs }} | |
| bundles: ${{ steps.filter.outputs.bundles }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| source: | |
| - 'src/**' | |
| - 'test/**' | |
| - 'package.json' | |
| - 'pnpm-lock.yaml' | |
| - 'pnpm-workspace.yaml' | |
| - 'tsconfig*.json' | |
| - 'tsdown.config.*' | |
| - 'vitest.config.*' | |
| docs: | |
| - 'website/**' | |
| - 'docs/**' | |
| - 'src/**' | |
| - 'pnpm-workspace.yaml' | |
| bundles: | |
| - 'src/**' | |
| - 'scripts/**' | |
| - 'package.json' | |
| - 'pnpm-lock.yaml' | |
| - 'pnpm-workspace.yaml' | |
| - 'tsdown.config.*' | |
| - '.bun-version' | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js ${{ env.LATEST_NODE_VERSION }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.LATEST_NODE_VERSION }} | |
| - name: Install pnpm and dependencies | |
| uses: apify/workflows/pnpm-install@main | |
| - name: Run TSC | |
| run: pnpm run build | |
| - name: Ensure the reference documentation builds | |
| run: pnpm run update-docs | |
| lint: | |
| name: Lint & Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js ${{ env.LATEST_NODE_VERSION }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.LATEST_NODE_VERSION }} | |
| - name: Install pnpm and dependencies | |
| uses: apify/workflows/pnpm-install@main | |
| - name: Run lint checks | |
| run: pnpm run lint | |
| - name: Run format checks | |
| run: pnpm run format | |
| test_local: | |
| if: ${{ needs.changes.outputs.source == 'true' }} | |
| name: Local Tests | |
| needs: [build, changes] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-2025] | |
| node-version: [20, 22, 24] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Mask secrets | |
| run: | | |
| echo "::add-mask::${{ secrets.APIFY_TEST_USER_API_TOKEN }}" | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install pnpm and dependencies | |
| uses: apify/workflows/pnpm-install@main | |
| - name: Setup Python 3.12 (Windows) | |
| if: ${{ matrix.os == 'windows-2025' }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.14 | |
| - name: Run local tests | |
| run: pnpm run test:local | |
| test_api: | |
| if: ${{ needs.changes.outputs.source == 'true' }} | |
| name: API Tests | |
| needs: [build, changes] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Mask secrets | |
| run: | | |
| echo "::add-mask::${{ secrets.APIFY_TEST_USER_API_TOKEN }}" | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js ${{ env.LATEST_NODE_VERSION }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.LATEST_NODE_VERSION }} | |
| - name: Install pnpm and dependencies | |
| uses: apify/workflows/pnpm-install@main | |
| - name: Run API tests | |
| env: | |
| TEST_USER_TOKEN: ${{ secrets.APIFY_TEST_USER_API_TOKEN }} | |
| run: pnpm run test:api | |
| test_python_support: | |
| if: ${{ needs.changes.outputs.source == 'true' }} | |
| name: Python Support | |
| needs: [build, changes] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-2025] | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Mask secrets | |
| run: | | |
| echo "::add-mask::${{ secrets.APIFY_TEST_USER_API_TOKEN }}" | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js ${{ env.LATEST_NODE_VERSION }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.LATEST_NODE_VERSION }} | |
| - name: Install pnpm and dependencies | |
| uses: apify/workflows/pnpm-install@main | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Run Python tests | |
| env: | |
| TEST_USER_TOKEN: ${{ secrets.APIFY_TEST_USER_API_TOKEN }} | |
| run: pnpm run test:python | |
| docs: | |
| if: ${{ needs.changes.outputs.docs == 'true' }} | |
| name: Docs build | |
| needs: [changes] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js ${{ env.LATEST_NODE_VERSION }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.LATEST_NODE_VERSION }} | |
| - name: Install pnpm and dependencies | |
| uses: apify/workflows/pnpm-install@main | |
| - name: Build & deploy docs | |
| run: | | |
| cd website | |
| pnpm install | |
| pnpm run build | |
| build_bundles: | |
| if: ${{ needs.changes.outputs.bundles == 'true' }} | |
| name: Bundles (${{ matrix.label }}) | |
| needs: [build, changes] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| label: unix | |
| - os: windows-latest | |
| label: windows-x64 | |
| - os: windows-11-arm | |
| label: windows-arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js ${{ env.LATEST_NODE_VERSION }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.LATEST_NODE_VERSION }} | |
| - name: Install pnpm and dependencies | |
| uses: apify/workflows/pnpm-install@main | |
| - name: Install bun | |
| uses: oven-sh/setup-bun@v2 | |
| if: ${{ matrix.os != 'windows-11-arm' }} | |
| with: | |
| bun-version-file: .bun-version | |
| no-cache: true | |
| - name: Install bun (Windows ARM) | |
| if: ${{ matrix.os == 'windows-11-arm' }} | |
| run: | | |
| $bunVersion = (Get-Content .bun-version).Trim() | |
| irm bun.sh/install.ps1 -OutFile install.ps1 | |
| # Bun doesn't have Windows ARM64 builds, so the setup-bun action fails. The install script however, | |
| # does "support" it. | |
| .\install.ps1 -Version $bunVersion | |
| Join-Path (Resolve-Path ~).Path ".bun\bin" >> $env:GITHUB_PATH | |
| # https://github.com/oven-sh/bun/issues/11198 | |
| - name: Fix cross-platform building on Actions | |
| if: ${{ matrix.os != 'ubuntu-latest' }} | |
| run: | | |
| mkdir C:\test | |
| cd C:\test | |
| bun init -y | |
| bun build --compile --target=bun-windows-x64 --outfile test index.ts | |
| bun build --compile --target=bun-windows-x64-baseline --outfile test index.ts | |
| - name: Build Bundles | |
| run: pnpm run insert-cli-metadata && pnpm run build-bundles | |
| - name: Upload Bundles | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: apify-cli-bundles-${{ matrix.label }} | |
| path: bundles/** |