Define the CI workflow that runs precommit (#16)

This commit is contained in:
Kerem Yilmaz 2024-03-03 23:20:37 -08:00 committed by GitHub
parent dc8d0550b7
commit 6c57829d54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 144 additions and 6 deletions

View file

@ -17,6 +17,6 @@ MAX_STEPS_PER_RUN = 50
# Control log level # Control log level
LOG_LEVEL=INFO LOG_LEVEL=INFO
# Database connection string # 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 to run the agent on
PORT=8000 PORT=8000

94
.github/workflows/ci.yml vendored Normal file
View file

@ -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/action@v3.0.0

View file

@ -78,6 +78,7 @@ repos:
rev: v2.2.0 rev: v2.2.0
hooks: hooks:
- id: doctoc - id: doctoc
exclude: 'README.md'
- repo: local - repo: local
hooks: hooks:
- id: alembic-check - id: alembic-check

View file

@ -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 # Code of Conduct - Skyvern
## Our Pledge ## Our Pledge

View file

@ -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 --> <!-- omit in toc -->
# Contributing to Skyvern # Contributing to Skyvern

View file

@ -61,7 +61,7 @@ version_path_separator = os # Use os.pathsep. Default configuration used for ne
# output_encoding = utf-8 # output_encoding = utf-8
; sqlalchemy.url = driver://user:pass@localhost/dbname ; 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] [post_write_hooks]

View file

@ -55,11 +55,11 @@ setup_postgresql() {
brew install postgresql@14 brew install postgresql@14
brew services start 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." echo "Connection successful. Database and user exist."
else else
createuser skyvern-open-source createuser skyvern
createdb skyvern-open-source -O skyvern-open-source createdb skyvern -O skyvern
echo "Database and user created successfully." echo "Database and user created successfully."
fi fi
} }
@ -87,7 +87,7 @@ create_organization() {
fi fi
# Update the secrets-open-source.toml file # 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." echo ".streamlit/secrets.toml file updated with organization details."
} }