mirror of
https://github.com/firecrawl/cli.git
synced 2026-09-14 17:30:55 +08:00
175 lines
5.0 KiB
YAML
175 lines
5.0 KiB
YAML
name: Test
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.12.1
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Check formatting
|
|
run: pnpm run format:check
|
|
|
|
- name: Type check
|
|
run: pnpm run type-check
|
|
|
|
- name: Build
|
|
run: pnpm run build
|
|
|
|
- name: Run tests
|
|
run: pnpm run test
|
|
|
|
test-binary:
|
|
if: github.event_name == 'pull_request'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: bun-linux-x64
|
|
binary: firecrawl-linux-x64
|
|
- os: macos-latest
|
|
target: bun-darwin-arm64
|
|
binary: firecrawl-darwin-arm64
|
|
- os: windows-latest
|
|
target: bun-windows-x64
|
|
binary: firecrawl-windows-x64.exe
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
name: Binary test (${{ matrix.os }})
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Compile binary
|
|
run: bun build src/index.ts --compile --target=${{ matrix.target }} --outfile ${{ matrix.binary }}
|
|
|
|
- name: Verify binary runs (Unix)
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
chmod +x ${{ matrix.binary }}
|
|
./${{ matrix.binary }} --version
|
|
./${{ matrix.binary }} --help
|
|
|
|
- name: Verify binary runs (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
.\${{ matrix.binary }} --version
|
|
.\${{ matrix.binary }} --help
|
|
|
|
test-npm-package:
|
|
if: github.event_name == 'pull_request'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
name: npm package smoke test (${{ matrix.os }}, Node 24)
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '24'
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.12.1
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build
|
|
run: pnpm run build
|
|
|
|
- name: Pack npm package
|
|
run: npm pack
|
|
|
|
- name: Verify npx subcommands (Unix)
|
|
if: runner.os != 'Windows'
|
|
run: |
|
|
PACKAGE=$(ls firecrawl-cli-*.tgz | head -n 1)
|
|
if [ -z "$PACKAGE" ]; then
|
|
echo "Packed package not found"
|
|
exit 1
|
|
fi
|
|
|
|
PACKAGE_PATH="$PWD/$PACKAGE"
|
|
npx -y --package "$PACKAGE_PATH" firecrawl --version
|
|
npx -y --package "$PACKAGE_PATH" firecrawl version
|
|
npx -y --package "$PACKAGE_PATH" firecrawl login --help
|
|
npx -y --package "$PACKAGE_PATH" firecrawl setup --help
|
|
npx -y --package "$PACKAGE_PATH" firecrawl help setup
|
|
|
|
- name: Verify npx subcommands (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
$Package = Get-ChildItem .\firecrawl-cli-*.tgz | Select-Object -First 1
|
|
if (-not $Package) {
|
|
throw "Packed package not found"
|
|
}
|
|
|
|
npx -y --package $($Package.FullName) firecrawl --version
|
|
npx -y --package $($Package.FullName) firecrawl version
|
|
npx -y --package $($Package.FullName) firecrawl login --help
|
|
npx -y --package $($Package.FullName) firecrawl setup --help
|
|
npx -y --package $($Package.FullName) firecrawl help setup
|
|
|
|
- name: Verify secure MCP setup through Windows npx.cmd
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
$Package = Get-ChildItem .\firecrawl-cli-*.tgz | Select-Object -First 1
|
|
$TempHome = Join-Path $env:RUNNER_TEMP "firecrawl-mcp-home"
|
|
New-Item -ItemType Directory -Force -Path $TempHome | Out-Null
|
|
$env:HOME = $TempHome
|
|
$env:USERPROFILE = $TempHome
|
|
$env:FIRECRAWL_API_KEY = "fc-windows-smoke-secret"
|
|
|
|
npx -y --package $($Package.FullName) firecrawl setup mcp --agent claude-code --global --yes
|
|
|
|
$ConfigPath = Join-Path $TempHome ".claude.json"
|
|
if (-not (Test-Path $ConfigPath)) {
|
|
throw "Claude Code MCP config was not created"
|
|
}
|
|
$Config = Get-Content $ConfigPath -Raw
|
|
if ($Config.Contains("fc-windows-smoke-secret")) {
|
|
throw "MCP setup persisted the raw environment-backed API key"
|
|
}
|
|
if (-not $Config.Contains('${FIRECRAWL_API_KEY}')) {
|
|
throw "MCP setup did not preserve Claude Code environment expansion"
|
|
}
|