From 946091dd0c6c2fd19fa2d67d0c6eabaac8044a1e Mon Sep 17 00:00:00 2001 From: nullPointerEnjoyer Date: Thu, 17 Sep 2026 17:45:53 +0400 Subject: [PATCH 1/2] ci: add test matrix and AI code review workflows --- .github/workflows/ci.yml | 86 +++++++++++++++++++++++++++++++ .github/workflows/code-review.yml | 36 +++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/code-review.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..88ef851 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + fmt: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - run: cargo fmt --all --check + + clippy: + name: Clippy (${{ matrix.features }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + features: ["--no-default-features", "--no-default-features --features node", "--no-default-features --features indexer", "--no-default-features --features wallet", "--no-default-features --features crypto", "--all-features"] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.92.0 + with: + components: clippy + - run: cargo clippy ${{ matrix.features }} --all-targets -- -D warnings + + test: + name: Test (${{ matrix.features }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + features: ["--no-default-features", "--no-default-features --features node", "--no-default-features --features indexer", "--no-default-features --features wallet", "--no-default-features --features crypto", "--all-features"] + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.92.0 + - run: cargo test ${{ matrix.features }} --locked + + # Cross-platform test gate, mirroring mintlayer-core's build.yml: the full + # suite runs on every supported OS with the lockfile held fixed. + platform-tests: + name: Test (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Shorten CARGO_HOME on Windows + if: runner.os == 'Windows' + shell: bash + # The default path blows past the Windows MAX_PATH limit inside the + # mintlayer-core git checkouts (same reason mintlayer-core's own + # build.yml does this). + run: echo "CARGO_HOME=C:\crg" >> "$GITHUB_ENV" + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.92.0 + - run: cargo build --all-features --locked --examples + - run: cargo test --all-features --locked + + doc: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@1.92.0 + - run: cargo doc --all-features --no-deps + env: + RUSTDOCFLAGS: -D warnings + + license: + name: License headers + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: ./scripts/check-license.sh diff --git a/.github/workflows/code-review.yml b/.github/workflows/code-review.yml new file mode 100644 index 0000000..b2802e3 --- /dev/null +++ b/.github/workflows/code-review.yml @@ -0,0 +1,36 @@ +name: AI Code Review + +on: + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: write + +concurrency: + group: ocr-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + review: + # Fork PRs cannot read secrets; skip them cleanly. + if: github.event.pull_request.head.repo.fork == false + runs-on: ubuntu-latest + timeout-minutes: 40 + steps: + - uses: alibaba/open-code-review@494bf1c8d7a19196ab166960a06fef38d69a1d16 # v1.12.0 + with: + llm_url: https://api.z.ai/api/coding/paas/v4 + llm_auth_token: ${{ secrets.OCR_LLM_TOKEN }} + llm_model: glm-5.3-flash + llm_use_anthropic: false + # GLM-5.3 family rejects thinking.type=disabled, which is the + # action's default extra_body — this override is required. + llm_extra_body: '{"thinking": {"type": "enabled"}}' + llm_reasoning_effort: low + incremental: 'true' + route_severity_below: 'low' + max_tokens_budget: '500000' + review_task_timeout: '15' + stream_progress: 'true' From 9c715df99a0f4398e0c64e6db28c60b48683153a Mon Sep 17 00:00:00 2001 From: nullPointerEnjoyer Date: Thu, 17 Sep 2026 18:00:39 +0400 Subject: [PATCH 2/2] ci: path filters, permissions, timeouts, pinned toolchains, caching (OCR review fixes) --- .github/workflows/ci.yml | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88ef851..e857678 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,14 @@ name: CI on: push: branches: [main] + paths-ignore: [".github/**"] pull_request: branches: [main] + paths-ignore: [".github/**"] + +# The crate jobs never need more than read access. +permissions: + contents: read env: CARGO_TERM_COLOR: always @@ -13,9 +19,11 @@ jobs: fmt: name: Format runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@stable + # Pinned to the MSRV so rustfmt matches the version clippy/test use. + - uses: dtolnay/rust-toolchain@ffaa7fb73f2b6e3c49bc425913220fa3d71c3ee5 # 1.92.0 with: components: rustfmt - run: cargo fmt --all --check @@ -23,27 +31,35 @@ jobs: clippy: name: Clippy (${{ matrix.features }}) runs-on: ubuntu-latest + timeout-minutes: 45 strategy: fail-fast: false matrix: features: ["--no-default-features", "--no-default-features --features node", "--no-default-features --features indexer", "--no-default-features --features wallet", "--no-default-features --features crypto", "--all-features"] steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.92.0 + - uses: dtolnay/rust-toolchain@ffaa7fb73f2b6e3c49bc425913220fa3d71c3ee5 # 1.92.0 with: components: clippy - - run: cargo clippy ${{ matrix.features }} --all-targets -- -D warnings + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 + with: + key: ${{ matrix.features }} + - run: cargo clippy ${{ matrix.features }} --all-targets --locked -- -D warnings test: name: Test (${{ matrix.features }}) runs-on: ubuntu-latest + timeout-minutes: 45 strategy: fail-fast: false matrix: features: ["--no-default-features", "--no-default-features --features node", "--no-default-features --features indexer", "--no-default-features --features wallet", "--no-default-features --features crypto", "--all-features"] steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.92.0 + - uses: dtolnay/rust-toolchain@ffaa7fb73f2b6e3c49bc425913220fa3d71c3ee5 # 1.92.0 + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 + with: + key: ${{ matrix.features }} - run: cargo test ${{ matrix.features }} --locked # Cross-platform test gate, mirroring mintlayer-core's build.yml: the full @@ -55,6 +71,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} + timeout-minutes: 60 steps: - name: Shorten CARGO_HOME on Windows if: runner.os == 'Windows' @@ -64,23 +81,29 @@ jobs: # build.yml does this). run: echo "CARGO_HOME=C:\crg" >> "$GITHUB_ENV" - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.92.0 + - uses: dtolnay/rust-toolchain@ffaa7fb73f2b6e3c49bc425913220fa3d71c3ee5 # 1.92.0 + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 + with: + key: ${{ matrix.os }} - run: cargo build --all-features --locked --examples - run: cargo test --all-features --locked doc: name: Documentation runs-on: ubuntu-latest + timeout-minutes: 30 steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.92.0 - - run: cargo doc --all-features --no-deps + - uses: dtolnay/rust-toolchain@ffaa7fb73f2b6e3c49bc425913220fa3d71c3ee5 # 1.92.0 + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2 + - run: cargo doc --all-features --locked --no-deps env: RUSTDOCFLAGS: -D warnings license: name: License headers runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@v4 - run: ./scripts/check-license.sh