Skip to content

Automate browser based workflows with AI

Define the CI workflow that runs precommit (#16)

Kerem Yilmaz6c57829d5448
diff --git a/.env.example b/.env.example
index 06978e615..2441bcd9b 100644
--- a/.env.example
+++ b/.env.example
@@ -17,6 +17,6 @@ MAX_STEPS_PER_RUN = 50
# Control log level
LOG_LEVEL=INFO
# Database connection string
-DATABASE_STRING="postgresql+psycopg://skyvern-open-source@localhost/skyvern-open-source"
+DATABASE_STRING="postgresql+psycopg://skyvern@localhost/skyvern"
# Port to run the agent on
PORT=8000
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 000000000..d30abad95
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,94 @@
+name: Run tests and pre-commit
+
+# Run this job on pushes to `main`, and for pull requests. If you don't specify
+# `branches: [main], then this actions runs _twice_ on pull requests, which is
+# annoying.
+on:
+ pull_request:
+ push:
+ branches: [main]
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+
+ # Service containers to run with `container-job`
+ services:
+ # Label used to access the service container
+ postgres:
+ # Docker Hub image
+ image: postgres
+ # Provide the password for postgres
+ env:
+ POSTGRES_USER: skyvern
+ POSTGRES_DATABASE: skyvern
+ POSTGRES_HOST_AUTH_METHOD: trust
+ # Set health checks to wait until postgres has started
+ options: >-
+ --health-cmd pg_isready
+ --health-interval 10s
+ --health-timeout 5s
+ --health-retries 5
+ ports:
+ # Maps tcp port 5432 on service container to the host
+ - 5432:5432
+
+ steps:
+ - uses: actions/checkout@v3
+
+ # If you wanted to use multiple Python versions, you'd have specify a matrix in the job and
+ # reference the matrixe python version here.
+ - uses: actions/setup-python@v4
+ with:
+ python-version: "3.11"
+
+ # Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow
+ # from installing Poetry every time, which can be slow. Note the use of the Poetry version
+ # number in the cache key, and the "-0" suffix: this allows you to invalidate the cache
+ # manually if/when you want to upgrade Poetry, or if something goes wrong. This could be
+ # mildly cleaner by using an environment variable, but I don't really care.
+ - name: cache poetry install
+ uses: actions/cache@v3
+ with:
+ path: ~/.local
+ key: poetry-1.7.1
+
+ # Install Poetry. You could do this manually, or there are several actions that do this.
+ # `snok/install-poetry` seems to be minimal yet complete, and really just calls out to
+ # Poetry's default install script, which feels correct. I pin the Poetry version here
+ # because Poetry does occasionally change APIs between versions and I don't want my
+ # actions to break if it does.
+ #
+ # The key configuration value here is `virtualenvs-in-project: true`: this creates the
+ # venv as a `.venv` in your testing directory, which allows the next step to easily
+ # cache it.
+ - uses: snok/install-poetry@v1
+ with:
+ version: 1.7.1
+ virtualenvs-create: true
+ virtualenvs-in-project: true
+
+ # Cache your dependencies (i.e. all the stuff in your `pyproject.toml`). Note the cache
+ # key: if you're using multiple Python versions, or multiple OSes, you'd need to include
+ # them in the cache key. I'm not, so it can be simple and just depend on the poetry.lock.
+ - name: cache deps
+ id: cache-deps
+ uses: actions/cache@v3
+ with:
+ path: .venv
+ key: pydeps-${{ hashFiles('**/poetry.lock') }}
+
+ # Install dependencies. `--no-root` means "install all dependencies but not the project
+ # itself", which is what you want to avoid caching _your_ code. The `if` statement
+ # ensures this only runs on a cache miss.
+ - run: poetry install --no-interaction --no-root
+ if: steps.cache-deps.outputs.cache-hit != 'true'
+
+ # Now install _your_ project. This isn't necessary for many types of projects -- particularly
+ # things like Django apps don't need this. But it's a good idea since it fully-exercises the
+ # pyproject.toml and makes that if you add things like console-scripts at some point that
+ # they'll be installed and working.
+ - run: poetry install --no-interaction
+
+ # Finally, run pre-commit.
+ - uses: pre-commit/[email protected]
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index eaea5ffdf..607ecb884 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -78,6 +78,7 @@ repos:
rev: v2.2.0
hooks:
- id: doctoc
+ exclude: 'README.md'
- repo: local
hooks:
- id: alembic-check
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 6787d51e0..ff12ebf6b 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -1,3 +1,22 @@
+<!-- START doctoc generated TOC please keep comment here to allow auto update -->
+<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
+**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
+
+- [Code of Conduct - Skyvern](#code-of-conduct---skyvern)
+ - [Our Pledge](#our-pledge)
+ - [Our Standards](#our-standards)
+ - [Our Responsibilities](#our-responsibilities)
+ - [Scope](#scope)
+ - [Enforcement](#enforcement)
+ - [Enforcement Guidelines](#enforcement-guidelines)
+ - [1. Correction](#1-correction)
+ - [2. Warning](#2-warning)
+ - [3. Temporary Ban](#3-temporary-ban)
+ - [4. Permanent Ban](#4-permanent-ban)
+ - [Attribution](#attribution)
+
+<!-- END doctoc generated TOC please keep comment here to allow auto update -->
+
# Code of Conduct - Skyvern
## Our Pledge
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index cdd48a990..2b9578c2e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,3 +1,27 @@
+<!-- START doctoc generated TOC please keep comment here to allow auto update -->
+<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
+**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
+
+- [Contributing to Skyvern](#contributing-to-skyvern)
+ - [Table of Contents](#table-of-contents)
+ - [Code of Conduct](#code-of-conduct)
+ - [I Have a Question](#i-have-a-question)
+ - [I Want To Contribute](#i-want-to-contribute)
+ - [Reporting Bugs](#reporting-bugs)
+ - [Before Submitting a Bug Report](#before-submitting-a-bug-report)
+ - [How Do I Submit a Good Bug Report?](#how-do-i-submit-a-good-bug-report)
+ - [Suggesting Enhancements](#suggesting-enhancements)
+ - [Before Submitting an Enhancement](#before-submitting-an-enhancement)
+ - [How Do I Submit a Good Enhancement Suggestion?](#how-do-i-submit-a-good-enhancement-suggestion)
+ - [Your First Code Contribution](#your-first-code-contribution)
+ - [Improving The Documentation](#improving-the-documentation)
+ - [Styleguides](#styleguides)
+ - [Commit Messages](#commit-messages)
+ - [Join The Project Team](#join-the-project-team)
+ - [Attribution](#attribution)
+
+<!-- END doctoc generated TOC please keep comment here to allow auto update -->
+
<!-- omit in toc -->
# Contributing to Skyvern
diff --git a/alembic.ini b/alembic.ini
index c7ba48fe5..354fc01bc 100644
--- a/alembic.ini
+++ b/alembic.ini
@@ -61,7 +61,7 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne
# output_encoding = utf-8
; sqlalchemy.url = driver://user:pass@localhost/dbname
-sqlalchemy.url = postgresql+psycopg://skyvern-open-source-@localhost/skyvern-open-source
+sqlalchemy.url = postgresql+psycopg://skyvern@localhost/skyvern
[post_write_hooks]
diff --git a/setup.sh b/setup.sh
index 3a3f47d57..fd32f39aa 100755
--- a/setup.sh
+++ b/setup.sh
@@ -55,11 +55,11 @@ setup_postgresql() {
brew install postgresql@14
brew services start postgresql@14
- if psql skyvern-open-source -U skyvern-open-source -c '\q'; then
+ if psql skyvern -U skyvern -c '\q'; then
echo "Connection successful. Database and user exist."
else
- createuser skyvern-open-source
- createdb skyvern-open-source -O skyvern-open-source
+ createuser skyvern
+ createdb skyvern -O skyvern
echo "Database and user created successfully."
fi
}
@@ -87,7 +87,7 @@ create_organization() {
fi
# Update the secrets-open-source.toml file
- echo -e "[skyvern]\nconfigs = [\n {\"env\" = \"local\", \"host\" = \"http://0.0.0.0:8000/api/v1\", \"orgs\" = [{name=\"Skyvern-Open-Source\", cred=\"$api_token\"}]}\n]" > .streamlit/secrets.toml
+ echo -e "[skyvern]\nconfigs = [\n {\"env\" = \"local\", \"host\" = \"http://0.0.0.0:8000/api/v1\", \"orgs\" = [{name=\"Skyvern\", cred=\"$api_token\"}]}\n]" > .streamlit/secrets.toml
echo ".streamlit/secrets.toml file updated with organization details."
}