Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> Co-authored-by: stas <stas@skyvern.com>
118 lines
4.1 KiB
YAML
118 lines
4.1 KiB
YAML
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:
|
|
workflow_call:
|
|
pull_request:
|
|
push:
|
|
branches: [main]
|
|
jobs:
|
|
test:
|
|
name: Run tests and pre-commit hooks
|
|
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@v6
|
|
with:
|
|
python-version: "3.11"
|
|
# Install uv (fast, single-file binary)
|
|
- name: Install uv
|
|
run: |
|
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
# Cache uv's download/resolve cache to speed up CI (optional but nice)
|
|
- name: Cache uv global cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/uv
|
|
key: uv-cache-${{ runner.os }}-${{ hashFiles('**/pyproject.toml', '**/uv.lock') }}
|
|
# Cache the project virtualenv (keyed by Python version + lockfile)
|
|
- name: Cache venv
|
|
id: cache-venv
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: .venv
|
|
key: venv-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version || '3.11' }}-${{ hashFiles('**/uv.lock') }}
|
|
# Create/refresh the environment (installs main + dev groups)
|
|
- name: Sync deps with uv
|
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
run: |
|
|
uv lock
|
|
uv sync --group dev
|
|
# Ensure venv is current even on cache hit (cheap no-op if up to date)
|
|
- name: Ensure environment is up to date
|
|
if: steps.cache-venv.outputs.cache-hit == 'true'
|
|
run: |
|
|
uv sync --group dev
|
|
# Finally, run pre-commit.
|
|
- name: Run all pre-commit hooks
|
|
uses: pre-commit/action@v3.0.0
|
|
env:
|
|
ENABLE_OPENAI: "true"
|
|
OPENAI_API_KEY: "sk-dummy"
|
|
ENABLE_AZURE_GPT4O_MINI: "true"
|
|
AZURE_GPT4O_MINI_DEPLOYMENT: "dummy"
|
|
AZURE_GPT4O_MINI_API_KEY: "dummy"
|
|
AZURE_GPT4O_MINI_API_BASE: "dummy"
|
|
AZURE_GPT4O_MINI_API_VERSION: "dummy"
|
|
AWS_REGION: "us-east-1"
|
|
ENABLE_BEDROCK: "true"
|
|
- name: Run alembic check
|
|
env:
|
|
ENABLE_OPENAI: "true"
|
|
OPENAI_API_KEY: "sk-dummy"
|
|
ENABLE_AZURE_GPT4O_MINI: "true"
|
|
AZURE_GPT4O_MINI_DEPLOYMENT: "dummy"
|
|
AZURE_GPT4O_MINI_API_KEY: "dummy"
|
|
AZURE_GPT4O_MINI_API_BASE: "dummy"
|
|
AZURE_GPT4O_MINI_API_VERSION: "dummy"
|
|
AWS_REGION: "us-east-1"
|
|
ENABLE_BEDROCK: "true"
|
|
run: uv run ./run_alembic_check.sh
|
|
- name: trigger tests
|
|
env:
|
|
ENABLE_OPENAI: "true"
|
|
OPENAI_API_KEY: "sk-dummy"
|
|
AWS_ACCESS_KEY_ID: "dummy"
|
|
AWS_SECRET_ACCESS_KEY: "dummy"
|
|
run: uv run pytest
|
|
fe-lint-build:
|
|
name: Frontend Lint and Build
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ./skyvern-frontend
|
|
steps:
|
|
- name: Check out Git repository
|
|
uses: actions/checkout@v4
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: .nvmrc
|
|
- name: Install Node.js dependencies
|
|
run: npm ci
|
|
- name: Run linter
|
|
run: npm run lint
|
|
- name: Run build
|
|
run: npm run build
|