Add yamlfmt precommit hook (#2584)

Co-authored-by: Shuchang Zheng <wintonzheng0325@gmail.com>
This commit is contained in:
Asher Foa
2025-06-05 15:34:20 -04:00
committed by GitHub
parent 4f0eecc181
commit 721ed50116
15 changed files with 219 additions and 1372 deletions

View File

@@ -1,5 +1,4 @@
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.
@@ -8,12 +7,10 @@ on:
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
@@ -27,23 +24,17 @@ jobs:
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
--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
@@ -54,7 +45,6 @@ jobs:
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
@@ -69,7 +59,6 @@ jobs:
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.
@@ -79,19 +68,16 @@ jobs:
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.
- name: Run all pre-commit hooks
uses: pre-commit/action@v3.0.0
@@ -105,7 +91,6 @@ jobs:
AZURE_GPT4O_MINI_API_VERSION: "dummy"
AWS_REGION: "us-east-1"
ENABLE_BEDROCK: "true"
- name: Run alembic check
env:
ENABLE_OPENAI: "true"
@@ -123,7 +108,6 @@ jobs:
ENABLE_OPENAI: "true"
OPENAI_API_KEY: "sk-dummy"
run: poetry run pytest tests
fe-lint-build:
name: Frontend Lint and Build
runs-on: ubuntu-latest
@@ -133,17 +117,13 @@ jobs:
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