Add Claude Code workflows for CI integration #149
This file contains hidden or 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: Rust CI | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: ["docs/**", "README.md"] | |
| pull_request: | |
| branches: [main] | |
| paths-ignore: ["docs/**", "README.md"] | |
| jobs: | |
| test_all: | |
| name: Test features | |
| runs-on: ubuntu-latest | |
| env: | |
| FREENET_LOG: error | |
| CARGO_TARGET_DIR: ${{ github.workspace }}/target | |
| steps: | |
| - name: Cancel Previous Runs | |
| uses: styfle/[email protected] | |
| with: | |
| access_token: ${{ github.token }} | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Test - features | |
| run: cargo test --workspace --features contract,net,testing,trace | |
| build_targets: | |
| name: Build targets | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| targets: ["wasm32-unknown-unknown", "x86_64-unknown-linux-gnu"] | |
| env: | |
| FREENET_LOG: error | |
| CARGO_TARGET_DIR: ${{ github.workspace }}/target | |
| steps: | |
| - name: Cancel Previous Runs | |
| uses: styfle/[email protected] | |
| with: | |
| access_token: ${{ github.token }} | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Build - freenet-stdlib | |
| working-directory: rust | |
| run: cargo build --target ${{ matrix.targets }} | |
| clippy_check: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: ["wasm32-unknown-unknown", "x86_64-unknown-linux-gnu"] | |
| env: | |
| FREENET_LOG: error | |
| CARGO_TARGET_DIR: ${{ github.workspace }}/target | |
| steps: | |
| - name: Cancel Previous Runs | |
| uses: styfle/[email protected] | |
| with: | |
| access_token: ${{ github.token }} | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: clippy | |
| targets: wasm32-unknown-unknown | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: clippy - freenet-stdlib | |
| working-directory: rust | |
| run: cargo clippy --target ${{ matrix.target }} -- -D warnings | |
| fmt_check: | |
| name: Fmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: rustfmt | |
| - name: Check code formatting | |
| run: cargo fmt -- --check | |
| claude-ci-analysis: | |
| name: Claude CI Analysis | |
| runs-on: ubuntu-latest | |
| needs: [test_all, build_targets, clippy_check, fmt_check] | |
| if: failure() && contains(github.event.pull_request.labels.*.name, 'claude-debug') | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: read | |
| id-token: write | |
| actions: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Run Claude CI Analysis | |
| uses: anthropics/claude-code-action@v1 | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| with: | |
| prompt: | | |
| REPO: ${{ github.repository }} | |
| PR NUMBER: ${{ github.event.pull_request.number }} | |
| The CI workflow has failed. Please analyze the failure and provide: | |
| 1. Root cause of the failure | |
| 2. Specific steps to fix the issue | |
| 3. Whether this appears to be a flaky test or genuine bug | |
| 4. Any relevant context from the codebase | |
| Use the repository's CLAUDE.md for guidance on testing and debugging. | |
| After your analysis, use `gh pr comment` with your Bash tool to post your findings as a comment on the PR. | |
| claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr view:*),Bash(gh pr list:*),Bash(gh api:*),Bash(gh run view:*)"' |