[Add] browser-use and main.py
This commit is contained in:
parent
08e64bdf45
commit
96914d44ac
221 changed files with 30952 additions and 1 deletions
28
browser-use/.github/workflows/cloud_evals.yml
vendored
Normal file
28
browser-use/.github/workflows/cloud_evals.yml
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
name: cloud_evals
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- 'releases/*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
commit_hash:
|
||||
description: Commit hash of the library to build the Cloud eval image for
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
trigger_cloud_eval_image_build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.TRIGGER_CLOUD_BUILD_GH_KEY }}
|
||||
script: |
|
||||
const result = await github.rest.repos.createDispatchEvent({
|
||||
owner: 'browser-use',
|
||||
repo: 'cloud',
|
||||
event_type: 'trigger-workflow',
|
||||
client_payload: {"commit_hash": "${{ github.event.inputs.commit_hash || github.sha }}"}
|
||||
})
|
||||
console.log(result)
|
||||
64
browser-use/.github/workflows/docker.yml
vendored
Normal file
64
browser-use/.github/workflows/docker.yml
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
name: docker
|
||||
|
||||
on:
|
||||
push:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build_publish_image:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
attestations: write
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Compute Docker tags based on tag/branch
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
browseruse/browseruse
|
||||
ghcr.io/browser-use/browser-use
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=pep440,pattern={{version}}
|
||||
type=pep440,pattern={{major}}.{{minor}}
|
||||
type=sha
|
||||
|
||||
- name: Build and push Docker image
|
||||
id: push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=registry,ref=browseruse/browseruse:buildcache
|
||||
cache-to: type=registry,ref=browseruse/browseruse:buildcache,mode=max
|
||||
42
browser-use/.github/workflows/lint.yml
vendored
Normal file
42
browser-use/.github/workflows/lint.yml
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
name: lint
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- stable
|
||||
- 'releases/**'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
lint-syntax:
|
||||
name: syntax-errors
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
- run: uv run ruff check --no-fix --select PLE
|
||||
|
||||
lint-style:
|
||||
name: code-style
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
- run: uv run pre-commit run --all-files --show-diff-on-failure
|
||||
|
||||
lint-typecheck:
|
||||
name: type-checker
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v6
|
||||
with:
|
||||
enable-cache: true
|
||||
- run: uv run pyright
|
||||
54
browser-use/.github/workflows/package.yaml
vendored
Normal file
54
browser-use/.github/workflows/package.yaml
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
name: package
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- stable
|
||||
- 'releases/**'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: pip-build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
- run: uv build --python 3.12
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist-artifact
|
||||
path: |
|
||||
dist/*.whl
|
||||
dist/*.tar.gz
|
||||
|
||||
build_test:
|
||||
name: pip-install-on-${{ matrix.os }}-py-${{ matrix.python-version }}
|
||||
needs: build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
python-version: ["3.11", "3.12", "3.13"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: dist-artifact
|
||||
|
||||
- name: Set up venv and test for OS/Python versions
|
||||
shell: bash
|
||||
run: |
|
||||
uv venv /tmp/testenv --python ${{ matrix.python-version }}
|
||||
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
||||
. /tmp/testenv/Scripts/activate
|
||||
else
|
||||
source /tmp/testenv/bin/activate
|
||||
fi
|
||||
uv pip install *.whl
|
||||
python -c 'from browser_use import Agent, Browser, Controller, ActionModel, ActionResult'
|
||||
66
browser-use/.github/workflows/publish.yml
vendored
Normal file
66
browser-use/.github/workflows/publish.yml
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
# This workflow will upload a Python Package using Twine when a release is created
|
||||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
|
||||
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
name: publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published] # publish full release to PyPI when a release is created on Github
|
||||
schedule:
|
||||
- cron: "0 17 * * FRI" # tag a pre-release on Github every Friday at 5 PM UTC
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
tag_pre_release:
|
||||
if: github.event_name == 'schedule'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Create pre-release tag
|
||||
run: |
|
||||
git fetch --tags
|
||||
latest_tag=$(git tag --list --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+rc[0-9]+$' | head -n 1)
|
||||
if [ -z "$latest_tag" ]; then
|
||||
new_tag="v0.1.0rc1"
|
||||
else
|
||||
new_tag=$(echo $latest_tag | awk -F'rc' '{print $1 "rc" $2+1}')
|
||||
fi
|
||||
git tag $new_tag
|
||||
git push origin $new_tag
|
||||
|
||||
publish_to_pypi:
|
||||
if: github.event_name == 'release'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.x"
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
- run: uv run ruff check --no-fix --select PLE # check only for syntax errors
|
||||
- run: uv build
|
||||
- run: uv run --isolated --no-project --with pytest --with dist/*.whl tests/conftest.py
|
||||
- run: uv run --isolated --no-project --with pytest --with dist/*.tar.gz tests/conftest.py
|
||||
- run: uv run --with=dotenv pytest \
|
||||
--ignore=tests/test_dropdown_error.py \
|
||||
--ignore=tests/test_gif_path.py \
|
||||
--ignore=tests/test_models.py \
|
||||
--ignore=tests/test_react_dropdown.py \
|
||||
--ignore=tests/test_save_conversation.py \
|
||||
--ignore=tests/test_vision.py \
|
||||
--ignore=tests/test_wait_for_element.py || true
|
||||
- run: uv publish --trusted-publishing always
|
||||
- name: Push to stable branch (if stable release)
|
||||
if: startsWith(github.ref_name, 'v') && !contains(github.ref_name, 'rc')
|
||||
run: |
|
||||
git checkout -b stable
|
||||
git push origin stable
|
||||
68
browser-use/.github/workflows/test.yaml
vendored
Normal file
68
browser-use/.github/workflows/test.yaml
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
name: test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- stable
|
||||
- 'releases/**'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: ${{matrix.test}}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
test:
|
||||
# TODO:
|
||||
# - browser/patchright
|
||||
# - browser/playwright
|
||||
# - browser/user_binary
|
||||
# - browser/remote_cdp
|
||||
# - models/openai
|
||||
# - models/google
|
||||
# - models/anthropic
|
||||
# - models/azure
|
||||
# - models/deepseek
|
||||
# - models/grok
|
||||
# - functionality/click
|
||||
# - functionality/tabs
|
||||
# - functionality/input
|
||||
# - functionality/scroll
|
||||
# - functionality/upload
|
||||
# - functionality/download
|
||||
# - functionality/save
|
||||
# - functionality/vision
|
||||
# - functionality/memory
|
||||
# - functionality/planner
|
||||
# - functionality/hooks
|
||||
- test_controller
|
||||
- test_tab_management
|
||||
- test_sensitive_data
|
||||
- test_url_allowlist_security
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: astral-sh/setup-uv@v6
|
||||
with:
|
||||
enable-cache: true
|
||||
activate-environment: true
|
||||
|
||||
- run: uv sync
|
||||
|
||||
- name: Detect installed Playwright or Patchright version
|
||||
run: echo "PLAYWRIGHT_VERSION=$(uv pip list --format json | jq -r '.[] | select(.name == "playwright") | .version')" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache playwright binaries
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/ms-playwright
|
||||
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
||||
|
||||
- run: playwright install --no-shell chromium
|
||||
|
||||
- run: pytest tests/${{ matrix.test }}.py
|
||||
Loading…
Add table
Add a link
Reference in a new issue