Code Analysis #4
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
name: Code Analysis | |
# 触发条件:在 PR 请求到 'main' 分支时运行 | |
on: | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
analyze: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout codebase | |
uses: actions/checkout@v4 | |
# 检查敏感信息 | |
- name: Install git-secrets | |
run: | | |
git clone https://github.com/awslabs/git-secrets.git | |
sudo make install -C git-secrets | |
git secrets --install | |
git secrets --scan | |
- name: Install Flutter | |
run: | | |
sudo apt-get update | |
sudo snap install flutter --classic | |
export PATH="$PATH:/snap/bin" | |
flutter doctor | |
# 运行 Flutter 的静态分析 | |
- name: Run flutter analyze | |
run: | | |
flutter analyze | |
# 运行 Flutter 单元测试 | |
- name: Run Flutter tests | |
run: | | |
flutter test --reporter expanded |