Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.2 update #80

Merged
merged 14 commits into from
Apr 7, 2024
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
74 changes: 63 additions & 11 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
name: Build And Test Extensions

on:
push:
branches:
- 'develop'
push:
branches: [develop]
paths:
- 'src/**'
- 'tests/**'
- 'playwright.config.ts'
- 'pnpm-lock.yaml'
- '.github/workflows/build-test.yml'
pull_request:
branches: [develop]
branches: [develop, master]
types:
- opened
- reopened
- ready_for_review
- review_requested
paths:
- 'src/**'
- 'tests/**'
- 'playwright.config.ts'
- 'pnpm-lock.yaml'
- '.github/workflows/build-test.yml'
workflow_dispatch:
inputs:
debug:
Expand All @@ -27,13 +30,14 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && contains(github.event.head_commit.message, '[run ci]')) }}
strategy:
fail-fast: false
matrix:
browser: [chrome, edge, chromium]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node.js
Expand All @@ -45,15 +49,63 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Build And Package Extensions
run: pnpm build --zip --target=${{ matrix.browser }}-mv3
env:
DEBUG: true
# upload to github artifacts for each browser with matrix
- name: Upload to GitHub Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.browser }}-mv3
path: build/
test:
test: # non-e2e test no need upload to r2
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
project: [integrations, units]
steps:
- uses: actions/checkout@v4
- name: Ensure No @Scoped Test
run: grep -r --include "*.spec.ts" "@scoped" && echo "please remove @scoped from tests" && exit 1 || echo "No @scoped tests found"
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Test
id: test
run: |
if [ "${{ inputs.debug }}" == "true" ]; then
echo "Enabled Debug Mode"
export DEBUG=true
fi
pnpm test -- --project=${{ matrix.project }} --max-failures=5
- name: Upload Test Results
if: always() && steps.test.conclusion != 'skipped'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.project }}-test-results
path: |
test-results/
playwright-report/
if-no-files-found: ignore
e2e-test:
runs-on: ubuntu-latest
needs: build
needs: [build, test]
strategy:
fail-fast: false
matrix:
Expand All @@ -71,7 +123,7 @@ jobs:
path: build/
- name: Unzip artifacts
run: unzip build/${{ matrix.browser }}-mv3-prod.zip -d build/extension
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node.js
Expand Down Expand Up @@ -100,7 +152,7 @@ jobs:
run: |
if [ "${{ inputs.debug }}" == "true" ]; then
echo "Enabled Debug Mode"
export DEBUG="pw:api"
export DEBUG=true
fi
pnpm test -- --project=${{ steps.project.outputs.project }}
- name: Upload Test Results
Expand Down
53 changes: 50 additions & 3 deletions .github/workflows/partial-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
- 'tests/**'
- 'playwright.config.ts'
- 'pnpm-lock.yaml'
- '.github/workflows/build-test.yml'
workflow_dispatch:
inputs:
debug:
Expand All @@ -21,13 +20,50 @@ on:
jobs:
fast-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: [units, integrations]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
- run: pnpm exec playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
- name: Test
id: test
run: |
pnpm test -- --project=${{ matrix.project }} \
--grep=@scoped \
--pass-with-no-tests \
--global-timeout=3600000 \
--max-failures=2
env:
DEBUG: true
fast-e2e-test:
runs-on: ubuntu-latest
needs: fast-test
strategy:
fail-fast: false
matrix:
browser: [chrome, edge]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node.js
Expand All @@ -39,6 +75,8 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Build Extension and Prepare Tests
run: pnpm test:rebuild
env:
DEBUG: true
- name: Cache playwright binaries
uses: actions/cache@v3
id: playwright-cache
Expand All @@ -57,4 +95,13 @@ jobs:
--timeout=60000 \
--max-failures=5
env:
DEBUG: true
DEBUG: true
- name: Upload Test Results
if: failure() && steps.test.conclusion != 'skipped'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.browser }}-test-results
path: |
test-results/
playwright-report/
if-no-files-found: ignore
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
browser: [chrome, edge]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8
- name: Setup Node.js
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ npm-debug.log*

# local env files
.env*
.vscode/

out/
build/
Expand Down
17 changes: 11 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

1. Fork 本仓库到你的本地仓库
2. 在你的本地仓库中进行修改
3. 如开发新功能,请自行添加合理且可行的端到端测试
4. 完成后,确保你的代码通过所有端到端测试
3. 如开发新功能,请自行添加合理且可行的测试
4. 完成后,确保你的代码通过所有测试
5. 提交 Pull Request 到本仓库的 `develop` 分支

## 程式码规范
Expand All @@ -48,7 +48,9 @@
### 提交规范

- 本项目在 commit message 上没有限制, 清晰明了即可
- PR分支请确保是基于 `develop` 分支创建,且分支名称应该为 `[类型]/[issue号]-[概要]` 的格式;例如 `feature/123-new-feature`
- PR分支请确保是基于 `develop` 分支创建,且分支名称应如下:
- 如果你的分支是基于一个 issue, 请使用 `[类型]/[issue号]-[概要]` 的格式;例如 `feature/123-new-feature`
- 如果你的分支并非基于一个 issue, 请使用 `[类型]/[概要]` 的格式;例如 `feature/new-feature`
- 请确保你的每一条 commits 都有意义,如有必要请使用 `git rebase` 合并 commits
- 如果你的 PR 是为了修复某个 issue,请在 PR 描述中写明 `Fixed|Resolved #issue号`,以便自动连结 issue

Expand All @@ -74,13 +76,13 @@ src/
├── contexts/ # 全局用 React 状态管理。
├── database/ # 数据库相关代码,包括模型定义和数据库迁移操作。
├── features/ # 特性模块,每个特性模块包含一组相关的功能。
├── ffmpeg/ # FFmpeg 相关代码。
├── hooks/ # 全局用的自定义 React Hooks。
├── migrations/ # 设定迁移脚本(从MV2到MV3)。
├── players/ # 直播解析器相关代码。
├── settings/ # 设定库相关代码,包括对设定区块和功能设定区块的定义。
├── options/ # 设定库相关代码,包括对设定区块和功能设定区块的定义。
├── tabs/ # 浏览器扩展页面。
├── types/ # 类型定义文件。
├── updaters/ # 更新器代码,用于处理扩展的更新逻辑。(目前仅限 Chrome)
├── utils/ # 实用工具函数。
├── logger.ts # 日志前缀注入。
├── style.css # 包含 TailwindCSS 的全局样式。
Expand All @@ -96,6 +98,9 @@ tests/
├── features/ # 功能模块的端到端测试代码。
├── fixtures/ # 测试中需要用到的前置依赖。
├── helpers/ # 使用类形式包装的测试辅助工具。
├── integrations/ # 集成测试代码。
├── units/ # 单元测试代码。
├── modules/ # 用于注入到集成测试的模块JS。
├── pages/ # 扩展页面的端到端测试代码。
├── utils/ # 辅助测试的函数和工具。
├── content.spec.ts # 内容脚本的端到端测试代码。
Expand All @@ -112,7 +117,7 @@ tests/
5. 有关如何编写贡献代码,请参阅 [入门指南](#入门指南) 。


#### 如要在本地运行端到端测试:
#### 如要在本地运行测试:
- 请先运行 `pnpm dlx playwright install` 安装 PlayWright 的浏览器引擎
- 完成后,运行 `pnpm build && pnpm test:prepare` 编译并部署测试环境
- 最后,运行 `pnpm test` 运行测试 (或者用 playwright vscode 插件运行测试)
Expand Down
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,18 @@
目前实装功能有:
- 同传字幕
- 醒目留言
- 即时录制/截图

... 以及其他 bilibili-jimaku-filter 原有的功能


预计添加的功能:
- 即时录制/截图
- 高亮用户弹幕/进入直播间
- 开播提醒

## ➵ 使用方式

1. [下载](#-下载)本扩展。
2. 点击扩展图标进入设定页面,并根据你的偏好进入设定。完成后,然后按下保存设定。
3. 进入B站任一直播间即可开始使用。

详情可参阅 [使用指南](https://cdn.jsdelivr.net/gh/eric2788/bilibili-vup-stream-enhancer@web/tutorials/index.md)

## ➵ 贡献

请参阅 [贡献指南](CONTRIBUTING.md)。
Expand Down
Loading
Loading