firecrawl/.github/workflows/fly.yml

302 lines
9.0 KiB
YAML
Raw Normal View History

2024-04-16 05:01:47 +08:00
name: Fly Deploy
on:
push:
branches:
- main
2024-04-19 04:44:33 +08:00
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
BULL_AUTH_KEY: ${{ secrets.BULL_AUTH_KEY }}
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
HOST: ${{ secrets.HOST }}
LLAMAPARSE_API_KEY: ${{ secrets.LLAMAPARSE_API_KEY }}
LOGTAIL_KEY: ${{ secrets.LOGTAIL_KEY }}
2024-05-03 03:30:22 +08:00
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
2024-04-19 04:44:33 +08:00
NUM_WORKERS_PER_QUEUE: ${{ secrets.NUM_WORKERS_PER_QUEUE }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
PLAYWRIGHT_MICROSERVICE_URL: ${{ secrets.PLAYWRIGHT_MICROSERVICE_URL }}
PORT: ${{ secrets.PORT }}
REDIS_URL: ${{ secrets.REDIS_URL }}
SCRAPING_BEE_API_KEY: ${{ secrets.SCRAPING_BEE_API_KEY }}
SUPABASE_ANON_TOKEN: ${{ secrets.SUPABASE_ANON_TOKEN }}
SUPABASE_SERVICE_TOKEN: ${{ secrets.SUPABASE_SERVICE_TOKEN }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
TEST_API_KEY: ${{ secrets.TEST_API_KEY }}
2024-06-07 02:36:20 +08:00
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2024-08-22 01:15:25 +08:00
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
2024-04-19 04:44:33 +08:00
2024-04-16 05:01:47 +08:00
jobs:
2024-06-07 02:36:20 +08:00
pre-deploy-e2e-tests:
2024-04-19 04:44:33 +08:00
name: Pre-deploy checks
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
2024-05-03 03:30:22 +08:00
node-version: "20"
2024-04-19 04:44:33 +08:00
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
working-directory: ./apps/api
- name: Start the application
run: npm start &
working-directory: ./apps/api
id: start_app
- name: Start workers
run: npm run workers &
working-directory: ./apps/api
id: start_workers
- name: Run E2E tests
run: |
2024-04-22 03:05:30 +08:00
npm run test:prod
2024-04-19 04:44:33 +08:00
working-directory: ./apps/api
2024-05-09 03:50:02 +08:00
pre-deploy-test-suite:
name: Test Suite
2024-06-07 02:36:20 +08:00
needs: pre-deploy-e2e-tests
2024-05-09 03:50:02 +08:00
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
working-directory: ./apps/api
- name: Start the application
run: npm start &
working-directory: ./apps/api
id: start_app
- name: Start workers
run: npm run workers &
working-directory: ./apps/api
id: start_workers
- name: Install dependencies
run: pnpm install
working-directory: ./apps/test-suite
- name: Run E2E tests
run: |
2024-06-19 01:34:44 +08:00
npm run test:suite
2024-05-09 03:50:02 +08:00
working-directory: ./apps/test-suite
2024-06-07 02:36:20 +08:00
python-sdk-tests:
name: Python SDK Tests
needs: pre-deploy-e2e-tests
runs-on: ubuntu-latest
2024-06-07 04:36:48 +08:00
services:
redis:
image: redis
ports:
- 6379:6379
2024-06-07 02:36:20 +08:00
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
2024-06-07 04:00:28 +08:00
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
working-directory: ./apps/api
- name: Start the application
run: npm start &
working-directory: ./apps/api
id: start_app
- name: Start workers
run: npm run workers &
working-directory: ./apps/api
id: start_workers
2024-06-07 02:36:20 +08:00
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
2024-05-28 02:54:09 +08:00
pip install -r requirements.txt
working-directory: ./apps/python-sdk
- name: Run E2E tests for Python SDK
2024-06-07 02:36:20 +08:00
run: |
pytest firecrawl/__tests__/e2e_withAuth/test.py
2024-05-28 02:54:09 +08:00
working-directory: ./apps/python-sdk
2024-06-07 02:36:20 +08:00
js-sdk-tests:
name: JavaScript SDK Tests
needs: pre-deploy-e2e-tests
runs-on: ubuntu-latest
2024-06-07 04:36:48 +08:00
services:
redis:
image: redis
ports:
- 6379:6379
2024-06-07 02:36:20 +08:00
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
2024-06-07 04:00:28 +08:00
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
working-directory: ./apps/api
- name: Start the application
run: npm start &
working-directory: ./apps/api
id: start_app
- name: Start workers
run: npm run workers &
working-directory: ./apps/api
id: start_workers
2024-05-28 03:01:48 +08:00
- name: Install dependencies for JavaScript SDK
run: pnpm install
working-directory: ./apps/js-sdk/firecrawl
2024-05-28 02:54:09 +08:00
- name: Run E2E tests for JavaScript SDK
2024-05-28 02:55:48 +08:00
run: npm run test
2024-05-28 02:54:09 +08:00
working-directory: ./apps/js-sdk/firecrawl
2024-05-09 03:50:02 +08:00
2024-08-04 17:15:31 +08:00
go-sdk-tests:
name: Go SDK Tests
needs: pre-deploy-e2e-tests
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
working-directory: ./apps/api
- name: Start the application
run: npm start &
working-directory: ./apps/api
id: start_app
- name: Start workers
run: npm run workers &
working-directory: ./apps/api
id: start_workers
- name: Install dependencies for Go SDK
run: go mod tidy
working-directory: ./apps/go-sdk
- name: Run tests for Go SDK
run: go test -v ./... -timeout 180s
2024-08-04 17:15:31 +08:00
working-directory: ./apps/go-sdk/firecrawl
2024-04-16 05:01:47 +08:00
deploy:
name: Deploy app
runs-on: ubuntu-latest
2024-06-07 02:36:20 +08:00
needs: [pre-deploy-test-suite, python-sdk-tests, js-sdk-tests]
2024-04-16 05:01:47 +08:00
steps:
2024-04-16 05:31:31 +08:00
- uses: actions/checkout@v3
2024-04-16 05:29:55 +08:00
- uses: superfly/flyctl-actions/setup-flyctl@master
2024-08-22 01:15:25 +08:00
- run: flyctl deploy --remote-only -a firecrawl-scraper-js --build-secret SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN
2024-07-12 05:56:36 +08:00
working-directory: ./apps/api
2024-04-16 05:01:47 +08:00
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
2024-07-12 05:56:36 +08:00
BULL_AUTH_KEY: ${{ secrets.BULL_AUTH_KEY }}
2024-08-22 01:15:25 +08:00
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
2024-06-07 02:36:20 +08:00
build-and-publish-python-sdk:
2024-06-07 20:40:40 +08:00
name: Build and publish Python SDK
2024-06-07 02:36:20 +08:00
runs-on: ubuntu-latest
needs: deploy
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine build requests packaging
- name: Run version check script
id: version_check_script
run: |
PYTHON_SDK_VERSION_INCREMENTED=$(python .github/scripts/check_version_has_incremented.py python ./apps/python-sdk/firecrawl firecrawl-py)
echo "PYTHON_SDK_VERSION_INCREMENTED=$PYTHON_SDK_VERSION_INCREMENTED" >> $GITHUB_ENV
- name: Build the package
if: ${{ env.PYTHON_SDK_VERSION_INCREMENTED == 'true' }}
run: |
python -m build
working-directory: ./apps/python-sdk
- name: Publish to PyPI
2024-06-07 20:35:56 +08:00
if: ${{ env.PYTHON_SDK_VERSION_INCREMENTED == 'true' }}
2024-06-07 02:36:20 +08:00
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*
working-directory: ./apps/python-sdk
build-and-publish-js-sdk:
2024-06-07 20:40:40 +08:00
name: Build and publish JavaScript SDK
2024-06-07 02:36:20 +08:00
runs-on: ubuntu-latest
needs: deploy
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'
scope: '@mendable'
always-auth: true
- name: Install pnpm
run: npm install -g pnpm
- name: Install python for running version check script
run: |
python -m pip install --upgrade pip
pip install setuptools wheel requests packaging
- name: Install dependencies for JavaScript SDK
run: pnpm install
working-directory: ./apps/js-sdk/firecrawl
- name: Run version check script
id: version_check_script
run: |
VERSION_INCREMENTED=$(python .github/scripts/check_version_has_incremented.py js ./apps/js-sdk/firecrawl @mendable/firecrawl-js)
echo "VERSION_INCREMENTED=$VERSION_INCREMENTED" >> $GITHUB_ENV
- name: Build and publish to npm
if: ${{ env.VERSION_INCREMENTED == 'true' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm run build-and-publish
working-directory: ./apps/js-sdk/firecrawl