-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
828 additions
and
2,366 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
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,38 +1,37 @@ | ||
name: ci | ||
name: test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "master" | ||
push: | ||
branches: | ||
- "master" | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- run: git clone https://github.com/bangumi/dev-env $HOME/dev-env | ||
- run: cd ~/dev-env && docker compose up -d | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: "true" | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- uses: trim21/setup-poetry@dist/v2 | ||
- uses: trim21/install-poetry-project@dist/v2 | ||
python-version-file: ".python-version" | ||
|
||
- uses: astral-sh/setup-uv@v5 | ||
- run: uv sync --frozen | ||
|
||
- run: bash $HOME/dev-env/wait_mysql_ready.sh | ||
|
||
- run: pytest --cov | ||
- run: uv run pytest -rva | ||
timeout-minutes: 10 | ||
env: | ||
MYSQL_HOST: '127.0.0.1' | ||
MYSQL_PORT: '3306' | ||
MYSQL_USER: 'user' | ||
MYSQL_PASS: 'password' | ||
MYSQL_DB: 'bangumi' | ||
|
||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
MYSQL_HOST: "127.0.0.1" | ||
MYSQL_PORT: "3306" | ||
MYSQL_USER: "user" | ||
MYSQL_PASS: "password" | ||
MYSQL_DB: "bangumi" |
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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
3.10 |
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,34 +1,20 @@ | ||
# syntax=docker/dockerfile:1@sha256:865e5dd094beca432e8c0a1d5e1c465db5f998dca4e439981029b3b81fb39ed5 | ||
|
||
### convert poetry.lock to requirements.txt ### | ||
FROM python:3.10-slim@sha256:af6f1b19eae3400ea3a569ba92d4819a527be4662971d51bb798c923bba30a81 AS poetry | ||
FROM ghcr.io/astral-sh/uv:debian-slim@sha256:3ac4e2ef46fd5a0fb0cf5af9a421435513fec1b2a66e1379a7981dc03470fd33 AS build | ||
|
||
WORKDIR /app | ||
|
||
ENV PIP_ROOT_USER_ACTION=ignore | ||
|
||
COPY requirements-poetry.txt ./ | ||
RUN pip install -r requirements-poetry.txt | ||
COPY uv.lock pyproject.toml ./ | ||
|
||
COPY pyproject.toml poetry.lock ./ | ||
RUN poetry export -f requirements.txt --output requirements.txt | ||
|
||
### final image ### | ||
FROM python:3.10-slim@sha256:af6f1b19eae3400ea3a569ba92d4819a527be4662971d51bb798c923bba30a81 | ||
|
||
WORKDIR /app | ||
RUN uv export --no-group dev --frozen --no-emit-project > /app/requirements.txt | ||
|
||
ENV PYTHONPATH=/app | ||
FROM python:3.10-slim@sha256:66aad90b231f011cb80e1966e03526a7175f0586724981969b23903abac19081 | ||
|
||
COPY --from=poetry /app/requirements.txt ./requirements.txt | ||
ENTRYPOINT [ "python", "-m", "start_grpc_server" ] | ||
|
||
ENV PIP_ROOT_USER_ACTION=ignore | ||
|
||
RUN pip install -U pip && \ | ||
pip install -r requirements.txt | ||
|
||
WORKDIR /app | ||
|
||
ENTRYPOINT [ "python", "-m", "start_grpc_server" ] | ||
COPY --from=build /app/requirements.txt . | ||
|
||
RUN pip install --only-binary=:all: --no-cache --no-deps -r requirements.txt | ||
|
||
COPY . ./ | ||
COPY . . |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
from .exceptions import NotFoundError | ||
|
||
__all__ = [ | ||
"count", | ||
"NotFoundError", | ||
"count", | ||
] |
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.