Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/build-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build and Push Container

on:
push:
branches:
- main
- development

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install Poetry
run: pip install poetry==2.1.3

- name: Verify lockfile matches pyproject.toml
run: poetry check --lock

- name: Get version
id: version
run: echo "VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')" >> $GITHUB_OUTPUT

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Build and push Docker image (main)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: |
ghcr.io/lumen-labs/brainapi:v${{ steps.version.outputs.VERSION }}
ghcr.io/lumen-labs/brainapi:latest
build-args: |
BUILD_DATE=${{ github.event.head_commit.timestamp }}
BUILD_SHA=${{ github.sha }}
CACHE_BUST=${{ github.run_number }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push Docker image (development)
if: github.ref == 'refs/heads/development'
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: |
ghcr.io/lumen-labs/brainapi:development
ghcr.io/lumen-labs/brainapi:v${{ steps.version.outputs.VERSION }}-development
build-args: |
BUILD_DATE=${{ github.event.head_commit.timestamp }}
BUILD_SHA=${{ github.sha }}
CACHE_BUST=${{ github.run_number }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Create Git tag (only on main branch)
if: github.ref == 'refs/heads/main'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git tag -a v${{ steps.version.outputs.VERSION }} -m "Release v${{ steps.version.outputs.VERSION }}"
git push origin v${{ steps.version.outputs.VERSION }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://discord.gg/VTngQTaeDf"><img src="https://img.shields.io/badge/Discord-Join%20Lumen%20Brain-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Discord"/></a>
<img src="https://img.shields.io/badge/version-2.11.5--dev-blue?style=for-the-badge" alt="Version"/>
<img src="https://img.shields.io/badge/version-2.11.6--dev-blue?style=for-the-badge" alt="Version"/>
<img src="https://img.shields.io/badge/python-3.11+-green?style=for-the-badge&logo=python&logoColor=white" alt="Python"/>
<img src="https://img.shields.io/badge/license-AGPLv3%20%2B%20Commons%20Clause-purple?style=for-the-badge" alt="License"/>
</p>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "brainapi2"
version = "2.11.5-dev"
version = "2.11.6-dev"
description = "Version 2.x.x of the BrainAPI memory layer."
authors = [
{name = "Christian",email = "alch.infoemail@gmail.com"}
Expand Down
7 changes: 1 addition & 6 deletions src/constants/spacy_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,17 @@
"nl": "nl_core_news_sm",
"pt": "pt_core_news_sm",
"ru": "ru_core_news_sm",
"zh": "zh_core_news_sm",
"zh": "zh_core_web_sm",
"ja": "ja_core_news_sm",
"ko": "ko_core_news_sm",
"ar": "ar_core_news_sm",
"hi": "hi_core_news_sm",
"bn": "bn_core_news_sm",
"pa": "pa_core_news_sm",
"ta": "ta_core_news_sm",
"te": "te_core_news_sm",
"ml": "ml_core_news_sm",
"tr": "tr_core_news_sm",
"vi": "vi_core_news_sm",
"id": "id_core_news_sm",
"ms": "ms_core_news_sm",
"fil": "fil_core_news_sm",
"th": "th_core_news_sm",
"lo": "lo_core_news_sm",
"my": "my_core_news_sm",
"km": "km_core_news_sm",
Expand Down
11 changes: 11 additions & 0 deletions tests/test_spacy_fixes_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ def test_builder_installs_models_via_spacy_model_names(self):
self.assertIn("spacy download", dockerfile)
self.assertIn("src.constants.spacy_models", dockerfile)

def test_chinese_uses_web_pipeline_name(self):
from src.constants.spacy_models import SPACY_MODEL_NAMES

self.assertEqual(SPACY_MODEL_NAMES["zh"], "zh_core_web_sm")

def test_no_languages_without_spacy_3_8_pipelines(self):
from src.constants.spacy_models import SPACY_MODEL_NAMES

for code in ("ta", "te", "th", "tr", "vi"):
self.assertNotIn(code, SPACY_MODEL_NAMES)


class TestFastAPIRedirectSlashes(unittest.TestCase):
def test_app_disables_trailing_slash_redirect(self):
Expand Down
Loading