-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into staging/deploy
- Loading branch information
Showing
145 changed files
with
1,407 additions
and
845 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,33 +3,48 @@ name: Backend unit tests | |
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
paths-ignore: | ||
- src/interfaces/** | ||
pull_request: {} | ||
merge_group: {} | ||
|
||
jobs: | ||
pytest: | ||
permissions: write-all | ||
# environment: development | ||
runs-on: ubuntu-latest | ||
env: | ||
COHERE_API_KEY: fake-test-key | ||
DATABASE_URL: ${{ secrets.DATABASE_URL }} | ||
NEXT_PUBLIC_API_HOSTNAME: ${{ secrets.NEXT_PUBLIC_API_HOSTNAME }} | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
- name: Setup Docker | ||
run: docker compose up test_db -d | ||
- name: Run unit tests | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
cache: 'pip' | ||
- name: Install poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
virtualenvs-path: .venv | ||
installer-parallel: true | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --with dev --no-interaction --no-root | ||
- name: Setup test DB container | ||
run: make test-db | ||
- name: Test with pytest | ||
if: github.actor != 'dependabot[bot]' | ||
run: | | ||
mkdir -p coverage | ||
docker compose build --build-arg INSTALL_COMMUNITY_DEPS=true backend | ||
docker compose run --name backend-container -v $(pwd)/coverage:/app/coverage backend poetry run pytest --cov=src/backend --cov-report=xml:/app/coverage/coverage.xml src/backend/tests/unit | ||
make run-unit-tests | ||
env: | ||
PYTHONPATH: src | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
file: coverage/coverage.xml | ||
file: coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,17 @@ | ||
name: Format | ||
name: Python Lint | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: {} | ||
|
||
jobs: | ||
format: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: psf/[email protected] | ||
- uses: isort/isort-action@v1 | ||
- uses: actions/checkout@v4 | ||
- name: Run lint checks | ||
uses: chartboost/ruff-action@v1 | ||
with: | ||
isort-version: "5.12.0" | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- name: Upgrade pip | ||
run: | | ||
pip install --upgrade --user pip | ||
- name: Install code quality packages | ||
run: | | ||
pip install poetry | ||
poetry env use 3.11 | ||
poetry install --only=dev | ||
- name: Remove unused standard library imports from non-`__init__.py` files | ||
run: | ||
poetry run autoflake --in-place --recursive --ignore-init-module-imports . | ||
src: './src/' | ||
version: 0.6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.