25 lines
914 B
YAML
25 lines
914 B
YAML
name: CI
|
|
on:
|
|
pull_request:
|
|
branches: [develop, main]
|
|
|
|
jobs:
|
|
test:
|
|
name: test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# 不用 actions/checkout: 它需从 github.com 拉取, 本网络不稳, 改为直接 clone Gitea
|
|
- name: 检出代码
|
|
run: |
|
|
REF="${{ github.event.pull_request.head.ref || github.ref_name }}"
|
|
git clone --depth 1 "${{ github.server_url }}/${{ github.repository }}.git" .
|
|
# PR head 可能是完整 ref(AGit 建的 PR 为 refs/pull/N/head),clone --branch 只认分支名,改 fetch 后 checkout
|
|
git fetch --depth 1 origin "$REF"
|
|
git checkout --detach FETCH_HEAD
|
|
- name: 安装 uv
|
|
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
- name: 安装依赖
|
|
run: ~/.local/bin/uv sync --frozen
|
|
- name: 语法与导入检查
|
|
run: ~/.local/bin/uv run python -m compileall -q flows api
|