Read-only mirror of github.com/ondeinference/ed.
Mirrored from https://github.com/ondeinference/ed.git
Synced Nov 23, 01:00 UTC
| 1 | name: CI |
| 2 | |
| 3 | # One run per commit: push only fires on the integration branches, and |
| 4 | # pull_request has no branch filter so stacked PRs still run. Every pull |
| 5 | # request starts the workflow, so `CI status` always reports and can be a |
| 6 | # required check. The `changes` job routes the work: docs, skills and agent |
| 7 | # config start nothing but that job and the status check. Pushes to the |
| 8 | # integration branches skip those files outright. |
| 9 | on: |
| 10 | pull_request: |
| 11 | push: |
| 12 | branches: [main, development] |
| 13 | paths-ignore: |
| 14 | - "**/*.md" |
| 15 | - ".agents/**" |
| 16 | - ".claude/**" |
| 17 | - ".sigit/**" |
| 18 | - "LICENSE-*" |
| 19 | workflow_dispatch: |
| 20 | |
| 21 | permissions: |
| 22 | contents: read |
| 23 | |
| 24 | concurrency: |
| 25 | # Keyed on the commit, not the ref: a merge lands the same SHA on development |
| 26 | # and then on main, and keying on the ref put those in separate groups, so one |
| 27 | # commit paid for two full macOS runs of identical code. Pull requests key on |
| 28 | # their number instead, because there `github.sha` is the ephemeral merge |
| 29 | # commit and changes with every push to the branch, which would leave |
| 30 | # superseded runs alive. |
| 31 | group: ci-${{ github.event.pull_request.number || github.sha }} |
| 32 | cancel-in-progress: true |
| 33 | |
| 34 | jobs: |
| 35 | # paths-filter has no base to diff on workflow_dispatch, so a manual run |
| 36 | # forces every concern on instead of skipping everything. |
| 37 | changes: |
| 38 | name: Changes |
| 39 | runs-on: ubuntu-latest |
| 40 | outputs: |
| 41 | rust: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.rust == 'true' }} |
| 42 | workflows: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.workflows == 'true' }} |
| 43 | steps: |
| 44 | - uses: actions/checkout@v6 |
| 45 | - id: filter |
| 46 | uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 |
| 47 | with: |
| 48 | filters: | |
| 49 | rust: |
| 50 | - "crates/**" |
| 51 | - "examples/**" |
| 52 | - "uniffi-bindgen/**" |
| 53 | - "Cargo.toml" |
| 54 | - "Cargo.lock" |
| 55 | - "rust-toolchain.toml" |
| 56 | - ".cargo/**" |
| 57 | - "scripts/**" |
| 58 | - ".github/workflows/ci.yml" |
| 59 | workflows: |
| 60 | - ".github/workflows/**" |
| 61 | - ".github/scripts/**" |
| 62 | |
| 63 | actionlint: |
| 64 | name: Lint workflows |
| 65 | needs: changes |
| 66 | if: needs.changes.outputs.workflows == 'true' |
| 67 | runs-on: ubuntu-latest |
| 68 | steps: |
| 69 | - uses: actions/checkout@v6 |
| 70 | - run: bash <(curl -fsSL https://raw.githubusercontent.com/rhysd/actionlint/914e7df21a07ef503a81201c76d2b11c789d3fca/scripts/download-actionlint.bash) 1.7.12 |
| 71 | - run: ./actionlint -color |
| 72 | |
| 73 | check: |
| 74 | needs: changes |
| 75 | if: needs.changes.outputs.rust == 'true' |
| 76 | runs-on: macos-26 |
| 77 | defaults: |
| 78 | run: |
| 79 | working-directory: ed |
| 80 | steps: |
| 81 | - uses: actions/checkout@v6 |
| 82 | with: |
| 83 | path: ed |
| 84 | - name: Read Rust toolchain |
| 85 | run: | |
| 86 | rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n 1)" |
| 87 | test -n "$rust_toolchain" |
| 88 | echo "RUST_TOOLCHAIN=$rust_toolchain" >> "$GITHUB_ENV" |
| 89 | - uses: dtolnay/rust-toolchain@stable |
| 90 | with: |
| 91 | toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 92 | # The action installs a minimal profile, so the pinned toolchain has |
| 93 | # neither of these unless they are asked for by name. |
| 94 | components: rustfmt, clippy |
| 95 | - uses: Swatinem/rust-cache@v2 |
| 96 | with: |
| 97 | workspaces: ed |
| 98 | - run: cargo fmt --all -- --check |
| 99 | - run: cargo clippy --locked --workspace --all-targets -- -D warnings |
| 100 | - run: cargo test --locked --workspace |
| 101 | |
| 102 | check-wasm32: |
| 103 | name: Check wasm32 |
| 104 | needs: changes |
| 105 | if: needs.changes.outputs.rust == 'true' |
| 106 | runs-on: ubuntu-latest |
| 107 | defaults: |
| 108 | run: |
| 109 | working-directory: ed |
| 110 | steps: |
| 111 | - uses: actions/checkout@v6 |
| 112 | with: |
| 113 | path: ed |
| 114 | - name: Read Rust toolchain |
| 115 | run: | |
| 116 | rust_toolchain="$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml | head -n 1)" |
| 117 | test -n "$rust_toolchain" |
| 118 | echo "RUST_TOOLCHAIN=$rust_toolchain" >> "$GITHUB_ENV" |
| 119 | - uses: dtolnay/rust-toolchain@stable |
| 120 | with: |
| 121 | toolchain: ${{ env.RUST_TOOLCHAIN }} |
| 122 | targets: wasm32-unknown-unknown |
| 123 | components: clippy |
| 124 | - uses: Swatinem/rust-cache@v2 |
| 125 | with: |
| 126 | workspaces: ed |
| 127 | key: wasm32 |
| 128 | - run: cargo check --locked --target wasm32-unknown-unknown -p ed-agent --all-targets |
| 129 | - run: cargo clippy --locked --target wasm32-unknown-unknown -p ed-agent --all-targets -- -D warnings |
| 130 | |
| 131 | ci: |
| 132 | name: CI status |
| 133 | needs: [changes, actionlint, check, check-wasm32] |
| 134 | if: always() |
| 135 | runs-on: ubuntu-latest |
| 136 | steps: |
| 137 | - name: Every needed job succeeded or was skipped |
| 138 | run: | |
| 139 | for result in ${{ join(needs.*.result, ' ') }}; do |
| 140 | case "$result" in success|skipped) ;; *) echo "::error::job result: $result"; exit 1;; esac |
| 141 | done |