Skip to content

Commit 2b2248b

Browse files
authored
Merge pull request #59 from shadowfish07/beta
AI 翻译、OpenRouter配置和一批bugfix+重构优化
2 parents 812b55f + 3374152 commit 2b2248b

File tree

65 files changed

+10805
-740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+10805
-740
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,19 @@ on:
1111
branches:
1212
- main
1313
- beta
14-
pull_request:
15-
branches:
16-
- main
17-
- beta
1814

1915
jobs:
2016
test:
21-
name: Test
22-
runs-on: ubuntu-latest
23-
if: github.event_name == 'pull_request'
24-
25-
steps:
26-
- name: Checkout code
27-
uses: actions/checkout@v4
28-
29-
- name: Setup Flutter
30-
uses: subosito/flutter-action@v2
31-
with:
32-
flutter-version: "3.32.2"
33-
channel: "stable"
34-
cache: true
35-
36-
- name: Cache Pub dependencies
37-
uses: actions/cache@v3
38-
with:
39-
path: |
40-
~/.pub-cache
41-
.dart_tool
42-
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
43-
restore-keys: |
44-
${{ runner.os }}-pub-
45-
46-
- name: Get dependencies
47-
run: flutter pub get
48-
49-
- name: Analyze code
50-
run: flutter analyze
51-
52-
- name: Run tests
53-
run: flutter test
54-
55-
- name: Analyze code
56-
run: flutter analyze
17+
uses: ./.github/workflows/test.yml
18+
permissions:
19+
contents: read
20+
pull-requests: write
21+
actions: read
5722

5823
release:
5924
name: Release
6025
runs-on: ubuntu-latest
26+
needs: test
6127
if: |
6228
github.event_name == 'push' &&
6329
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') &&
@@ -139,7 +105,7 @@ jobs:
139105
id: semantic_release_dry
140106
run: |
141107
# Run semantic-release in dry-run mode to get the next version
142-
NEXT_VERSION=$(npx semantic-release --dry-run --no-ci | grep -oP 'The next release version is \K[0-9]+\.[0-9]+\.[0-9]+' || echo "")
108+
NEXT_VERSION=$(npx semantic-release --dry-run --no-ci | grep -oP 'The next release version is \K[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+\.[0-9]+)?' || echo "")
143109
if [ -n "$NEXT_VERSION" ]; then
144110
echo "next_version=$NEXT_VERSION" >> $GITHUB_OUTPUT
145111
echo "has_release=true" >> $GITHUB_OUTPUT

.github/workflows/test.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Test
2+
3+
permissions:
4+
contents: read
5+
pull-requests: write
6+
actions: read
7+
8+
on:
9+
pull_request:
10+
branches:
11+
- main
12+
- beta
13+
push:
14+
branches:
15+
- main
16+
- beta
17+
workflow_call:
18+
19+
jobs:
20+
test:
21+
name: Test
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Flutter
29+
uses: subosito/flutter-action@v2
30+
with:
31+
flutter-version: "3.32.2"
32+
channel: "stable"
33+
cache: true
34+
35+
- name: Cache Pub dependencies
36+
uses: actions/cache@v3
37+
with:
38+
path: |
39+
~/.pub-cache
40+
.dart_tool
41+
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-pub-
44+
45+
- name: Get dependencies
46+
run: flutter pub get
47+
48+
- name: Analyze code
49+
run: flutter analyze
50+
51+
# 生成测试覆盖率报告
52+
- name: Run tests with coverage
53+
run: flutter test --coverage
54+
55+
# 上传覆盖率报告到 Codecov
56+
- name: Upload coverage to Codecov
57+
uses: codecov/codecov-action@v3
58+
with:
59+
token: ${{ secrets.CODECOV_TOKEN }}
60+
file: coverage/lcov.info
61+
flags: unittests
62+
name: codecov-readeck
63+
fail_ci_if_error: false

.releaserc.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
{ "type": "docs", "release": false },
2121
{ "type": "style", "release": false },
2222
{ "type": "chore", "release": false },
23-
{ "type": "refactor", "release": "patch" },
23+
{ "type": "refactor", "release": false },
2424
{ "type": "test", "release": false },
2525
{ "type": "build", "release": false },
2626
{ "type": "ci", "release": false },
@@ -49,12 +49,6 @@
4949
}
5050
}
5151
],
52-
[
53-
"@semantic-release/changelog",
54-
{
55-
"changelogFile": "CHANGELOG.md"
56-
}
57-
],
5852
[
5953
"@semantic-release/exec",
6054
{
@@ -87,4 +81,4 @@
8781
}
8882
]
8983
]
90-
}
84+
}

0 commit comments

Comments
 (0)