| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| name: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| test: | |
| runs-on: ubuntu-24.04 | |
| # Allow cold compilation and Host fixtures that reserve multiple CPU slots. | |
| timeout-minutes: 180 | |
| env: | |
| MBX_CACHE_EXPORT_GROUP: ci-${{ github.run_id }}-${{ github.run_attempt }}-test | |
| MBX_GC_AUTO: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && '0' || '1' }} | |
| MBX_TARGET_VIEWS: '0' | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: '24' | |
| cache: npm | |
| - name: Install native dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y bubblewrap ripgrep pkg-config libx11-dev libxi-dev libxtst-dev libxext-dev libxcb1-dev libxkbcommon-dev libxkbcommon-x11-dev libfontconfig1-dev libfreetype6-dev libwayland-dev | |
| sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 | |
| - name: Update Rust | |
| run: rustup update stable --no-self-update | |
| # mr-boxington-action is not on the ASF allowlist. Install the immutable | |
| # release directly and transport its cache with GitHub's official actions. | |
| - name: Install mbx | |
| id: mbx | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| release="$RUNNER_TEMP/mbx-release.json" | |
| curl --fail --silent --show-error --location --retry 3 \ | |
| --header "Authorization: Bearer $GH_TOKEN" \ | |
| https://api.github.com/repos/jdx/mr-boxington/releases/latest \ | |
| --output "$release" | |
| jq --exit-status '.immutable == true' "$release" > /dev/null | |
| version=$(jq --exit-status --raw-output '.tag_name | ltrimstr("v")' "$release") | |
| asset='.assets[] | select(.name == "mbx-x86_64-unknown-linux-gnu.tar.gz")' | |
| url=$(jq --exit-status --raw-output "$asset | .browser_download_url" "$release") | |
| digest=$(jq --exit-status --raw-output "$asset | .digest | select(startswith(\"sha256:\")) | ltrimstr(\"sha256:\")" "$release") | |
| archive="$RUNNER_TEMP/mbx.tar.gz" | |
| curl --fail --silent --show-error --location --retry 3 "$url" --output "$archive" | |
| echo "$digest $archive" | sha256sum -c - | |
| mkdir -p "$RUNNER_TEMP/mbx-bin" | |
| tar -xzf "$archive" -C "$RUNNER_TEMP/mbx-bin" | |
| "$RUNNER_TEMP/mbx-bin/mbx" --version | |
| XDG_DATA_HOME="$RUNNER_TEMP/mbx-data" "$RUNNER_TEMP/mbx-bin/mbx" setup --yes | |
| echo "$RUNNER_TEMP/mbx-bin" >> "$GITHUB_PATH" | |
| echo "$RUNNER_TEMP/mbx-data/mbx/bin" >> "$GITHUB_PATH" | |
| echo "key=mbx-${version}-${RUNNER_OS}-${RUNNER_ARCH}-$(rustc -vV | sha256sum | cut -d ' ' -f 1)" >> "$GITHUB_OUTPUT" | |
| - uses: taiki-e/install-action@1ed6d7be6168f6c9046541087ff549b6bc581fdf # v2 | |
| with: | |
| tool: just@1.58.0,cargo-nextest@0.9.146,cargo-deny | |
| - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock', 'third-party/termina/Cargo.lock') }} | |
| restore-keys: cargo-${{ runner.os }}- | |
| - name: Restore compiled Rust cache | |
| id: mbx-cache | |
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ${{ runner.temp }}/mbx-cache | |
| key: ${{ steps.mbx.outputs.key }}-${{ hashFiles('Cargo.lock', 'third-party/termina/Cargo.lock') }}-${{ github.sha }} | |
| restore-keys: | | |
| ${{ steps.mbx.outputs.key }}-${{ hashFiles('Cargo.lock', 'third-party/termina/Cargo.lock') }}- | |
| ${{ steps.mbx.outputs.key }}- | |
| - name: Import compiled Rust cache | |
| if: steps.mbx-cache.outputs.cache-matched-key != '' | |
| run: mbx cache import "$RUNNER_TEMP/mbx-cache" | |
| - name: Select npm | |
| run: npm install --global --no-audit --no-fund "$(node -p 'require("./package.json").packageManager')" | |
| - run: just setup | |
| - name: Verify Computer Use bridge build | |
| run: | | |
| node scripts/rust/check-cua-build.mjs | |
| just product | |
| cargo build --locked -p maka-cli --no-default-features | |
| target/debug/maka --version | |
| cargo test --locked -p maka-computer-use --no-default-features --lib --test native --test repl_contract | |
| - name: Check Termina Windows input | |
| run: | | |
| rustup target add x86_64-pc-windows-msvc | |
| cargo check --locked --manifest-path third-party/termina/Cargo.toml --lib --target x86_64-pc-windows-msvc --target-dir "${CARGO_TARGET_DIR:-target}" | |
| cargo check --locked --manifest-path third-party/termina/Cargo.toml --lib --target x86_64-pc-windows-msvc --target-dir "${CARGO_TARGET_DIR:-target}" --features windows-legacy | |
| - run: just check | |
| - run: just build | |
| - name: Native CLI smoke | |
| run: | | |
| target/debug/maka --version | |
| target/debug/maka desktop --version | |
| target/debug/maka-desktop-shell --version | |
| - name: Export compiled Rust cache | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.mbx-cache.outputs.cache-hit != 'true' | |
| run: mbx cache export --group "$MBX_CACHE_EXPORT_GROUP" --format directory "$RUNNER_TEMP/mbx-cache" | |
| - name: Save compiled Rust cache | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.mbx-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ${{ runner.temp }}/mbx-cache | |
| key: ${{ steps.mbx-cache.outputs.cache-primary-key }} |