Skip to content

Commit

Permalink
Merge branch 'main' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
SigureMo committed Feb 1, 2025
2 parents 8fb24ca + 44ce598 commit c8d08d1
Show file tree
Hide file tree
Showing 87 changed files with 3,121 additions and 1,352 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ body:
请在这里提供你所使用/调用 yutto 的方式。如果与特定 url 有关,请直接在命令中提供该 url。
为了节省彼此交流的时间,麻烦在提交 issue 前多次测试该命令是能够反复复现的(非网络问题),
如果可以,麻烦在提交 issue 前对其他的情况进行测试,并将相关信息详细描述在问题简述中,
这里仅提供**最小可复现**的命令
这里仅提供**最小可复现**的命令(注意,如果使用了自定义的配置文件,请将配置文件内容一并提供)。
placeholder: "注意在粘贴的命令中隐去所有隐私信息哦(*/ω\*)"
validations:
required: true
Expand Down
62 changes: 54 additions & 8 deletions .github/workflows/biliass-build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@ name: Build and Release (biliass)

on:
push:
branches:
- main
tags:
- "biliass*" # Push events to matching biliass*, i.e. biliass@1.0.0
branches:
- main
paths:
- "packages/biliass/**"
- ".github/**"
pull_request:
paths:
- "packages/biliass/**"
- ".github/**"
merge_group:
paths:
- "packages/biliass/**"
- ".github/**"
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -40,7 +49,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
args: --release --out dist --interpreter '3.13 3.13t'
sccache: "true"
manylinux: auto
working-directory: packages/biliass
Expand Down Expand Up @@ -72,7 +81,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
args: --release --out dist --interpreter '3.13 3.13t'
sccache: "true"
manylinux: musllinux_1_2
working-directory: packages/biliass
Expand All @@ -95,7 +104,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
python-version: "3.13"
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
Expand All @@ -110,12 +119,44 @@ jobs:
name: wheels-windows-${{ matrix.platform.target }}
path: packages/biliass/dist

# Python 3.13 standard and free-threaded versions cannot be
# available at the same time on Windows machines, so we
# split it into two jobs.
# https://github.com/Quansight-Labs/setup-python/issues/5
windows-free-threaded:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
steps:
- uses: actions/checkout@v4
- uses: Quansight-Labs/setup-python@v5
with:
python-version: 3.13t
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: "true"
working-directory: packages/biliass
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-free-threaded-${{ matrix.platform.target }}
path: packages/biliass/dist

macos:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-12
- runner: macos-13
target: x86_64
- runner: macos-14
target: aarch64
Expand All @@ -128,7 +169,7 @@ jobs:
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
args: --release --out dist --interpreter '3.13 3.13t'
sccache: "true"
working-directory: packages/biliass
- name: Upload wheels
Expand Down Expand Up @@ -161,6 +202,7 @@ jobs:
- linux
- musllinux
- windows
- windows-free-threaded
- macos
- sdist
permissions:
Expand All @@ -174,8 +216,11 @@ jobs:
merge-multiple: true
path: dist/

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
run: uv publish -v

publish-release:
runs-on: ubuntu-latest
Expand All @@ -185,6 +230,7 @@ jobs:
- linux
- musllinux
- windows
- windows-free-threaded
- macos
- sdist
permissions:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13-dev"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
architecture: ["x64"]
name: Python ${{ matrix.python-version }} on ${{ matrix.architecture }} e2e test
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5

- name: Install python
uses: actions/setup-python@v5
Expand Down
41 changes: 34 additions & 7 deletions .github/workflows/latest-release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13-dev"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
architecture: ["x64"]
name: Python ${{ matrix.python-version }} on ${{ matrix.architecture }} latest release test
steps:
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install python
uses: actions/setup-python@v5
with:
Expand All @@ -24,12 +27,36 @@ jobs:
sudo apt update
sudo apt install ffmpeg
- name: Install yutto latest
- name: Test yutto from source
run: |
uv cache clean
uvx --no-binary yutto@latest -v
uvx --no-binary yutto@latest -h
uvx --no-binary yutto@latest https://www.bilibili.com/video/BV1AZ4y147Yg -w --no-progress
- name: Test yutto from wheel
run: |
uv cache clean
uvx yutto@latest -v
uvx yutto@latest -h
uvx yutto@latest https://www.bilibili.com/video/BV1AZ4y147Yg -w --no-progress
- name: Prepare data for biliass
run: |
git clone https://github.com/yutto-dev/biliass-corpus.git --depth 1
- name: Test biliass from source
run: |
pip install yutto
uv cache clean
uvx --no-binary biliass@latest -v
uvx --no-binary biliass@latest -h
uvx --no-binary biliass@latest biliass-corpus/corpus/xml/18678311.xml -s 1920x1080 -f xml -o xml.ass
uvx --no-binary biliass@latest biliass-corpus/corpus/protobuf/18678311-0.pb biliass-corpus/corpus/protobuf/18678311-1.pb biliass-corpus/corpus/protobuf/18678311-2.pb biliass-corpus/corpus/protobuf/18678311-3.pb -s 1920x1080 -f protobuf -o protobuf.ass
- name: Test yutto
- name: Test biliass from wheel
run: |
yutto -v
yutto -h
yutto https://www.bilibili.com/video/BV1AZ4y147Yg -w
uv cache clean
uvx biliass@latest -v
uvx biliass@latest -h
uvx biliass@latest biliass-corpus/corpus/xml/18678311.xml -s 1920x1080 -f xml -o xml.ass
uvx biliass@latest biliass-corpus/corpus/protobuf/18678311-0.pb biliass-corpus/corpus/protobuf/18678311-1.pb biliass-corpus/corpus/protobuf/18678311-2.pb biliass-corpus/corpus/protobuf/18678311-3.pb -s 1920x1080 -f protobuf -o protobuf.ass
2 changes: 1 addition & 1 deletion .github/workflows/lint-and-fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5

- name: Install python
uses: actions/setup-python@v5
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5

- name: Install python
uses: actions/setup-python@v5
Expand Down Expand Up @@ -53,8 +53,11 @@ jobs:
name: release-dists
path: dist/

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
run: uv publish -v

publish-release:
runs-on: ubuntu-latest
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13-dev"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
architecture: ["x64"]
name: Python ${{ matrix.python-version }} on ${{ matrix.architecture }} unit test
steps:
Expand All @@ -22,7 +22,7 @@ jobs:
submodules: recursive

- name: Install uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v5

- name: Install python
uses: actions/setup-python@v5
Expand All @@ -39,6 +39,12 @@ jobs:
run: |
just ci-install
- name: unit test
- name: Run unit tests
run: |
just ci-test
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
if: "matrix.python-version == '3.13' && github.event_name != 'merge_group'"
with:
run: uv run pytest --codspeed
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ dmypy.json
.DS_Store

# Media files
*.m4a
*.aac
*.mp3
*.flac
Expand All @@ -141,3 +142,6 @@ log

# test files
__test_files__

# config file
yutto.toml
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
},
"rust-analyzer.linkedProjects": [
"${workspaceFolder}/packages/biliass/rust/Cargo.toml"
]
],
"search.exclude": {
"**/*.ambr": true,
"**/*.xml": true,
"**/*.pb": true
}
}
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@

当然,如果你有更熟悉的编辑器或 IDE 的话,也是完全可以的。

### Rust 开发工具链(可选)

本 repo 是一个 monorepo,同时包含 yutto 和 biliass 两个包,其中 biliass 采用 Rust 编写,如果你有 biliass 联调的需求,则需要安装 Rust 工具链,安装方法请参考 [Rust 官方文档](https://www.rust-lang.org/tools/install)

如果你不需要联调 biliass,那么可以通过注释掉 [pyproject.toml](./pyproject.toml) 中的 `tool.uv.sources``tool.uv.workspace`,避免 uv 将其当作一个子项目来处理。此时 uv 会安装 pypi 上预编译的 biliass wheel 包,而不会编译源码。这在大多数情况下是没有问题的,除非 yutto 使用了 biliass 的最新特性。

## 本地调试

如果你想要本地调试,最佳实践是从 GitHub 上下载最新的源码来运行
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM alpine:3.20
FROM alpine:3.21
LABEL maintainer="siguremo" \
version="2.0.0-rc.1" \
version="2.0.0" \
description="light-weight container based on alpine for yutto"

RUN set -x \
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
&& apk add -q --progress --update --no-cache ffmpeg python3 tzdata \
&& python3 -m venv /opt/venv \
&& /opt/venv/bin/pip install --no-cache-dir --pre --compile yutto \
&& /opt/venv/bin/pip install --no-cache-dir --compile yutto \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

WORKDIR /app
Expand Down
Loading

0 comments on commit c8d08d1

Please sign in to comment.