Regular push/PR runs the test job only. workflow_dispatch and v* tags then build linux-amd64, windows-amd64, and macos-arm64 as separate jobs. Windows is cargo-xwin from Ubuntu (MSVC ABI, Unix-host protoc) instead of native windows-latest. Registry/git cache is shared on Ubuntu; release target/ is not cached; xwin splat has its own cache.
287 lines
8.0 KiB
YAML
287 lines
8.0 KiB
YAML
# CI for the patched grok binary.
|
|
#
|
|
# Regular push / pull_request: test job only.
|
|
# workflow_dispatch or a v* tag: test, then the three release builds.
|
|
# Tags also publish the artifacts as a GitHub Release.
|
|
#
|
|
# Windows is cross-compiled from Ubuntu (cargo-xwin → x86_64-pc-windows-msvc),
|
|
# in its own job — not mixed into the native linux-amd64 build. Official proto
|
|
# codegen is Unix-host-only (/dev/stdout, Linux protoc); native windows-latest
|
|
# is the path that broke.
|
|
#
|
|
# Cache budget (GitHub's repo cap is 10 GB):
|
|
# - cargo registry/git is shared across the Ubuntu jobs (no target/)
|
|
# - test keeps a separate debug work/target (small crates only)
|
|
# - xwin's MSVC splat is cached on its own
|
|
# - release target/ is never cached (multi-GB)
|
|
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
# Distinguish test-only runs from dispatch/tag builds so a release does not
|
|
# cancel an in-flight PR test on the same branch name, and vice versa.
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) }}
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_INCREMENTAL: "0"
|
|
RUST_BACKTRACE: "1"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
name: test
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Disable CRLF conversion
|
|
run: git config --global core.autocrlf false
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@1.94.0
|
|
|
|
- uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "29.3"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Apply patches onto pinned upstream
|
|
run: ./scripts/ci-apply.sh
|
|
|
|
- name: Export PROTOC
|
|
run: echo "PROTOC=$(command -v protoc)" >> "$GITHUB_ENV"
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: work
|
|
shared-key: ubuntu-cargo
|
|
cache-targets: false
|
|
save-if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
|
|
|
- name: Restore test target cache
|
|
id: test-target
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: work/target
|
|
key: test-target-1.94-${{ hashFiles('work/Cargo.lock') }}
|
|
restore-keys: |
|
|
test-target-1.94-
|
|
|
|
- name: Test
|
|
working-directory: work
|
|
# make test default + the proto crate (exercises protoc / build.rs).
|
|
# pager/shell stay off this job: their debug target/ would blow the
|
|
# 10 GB cache budget and the runner disk.
|
|
run: cargo test --locked -p xai-grok-version -p xai-grok-tools-api
|
|
|
|
- name: Save test target cache
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && steps.test-target.outputs.cache-hit != 'true'
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: work/target
|
|
key: test-target-1.94-${{ hashFiles('work/Cargo.lock') }}
|
|
|
|
build-linux-amd64:
|
|
name: grok-linux-amd64
|
|
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 180
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
TARGET: x86_64-unknown-linux-gnu
|
|
ARTIFACT: grok-linux-amd64
|
|
EXE: xai-grok-pager
|
|
steps:
|
|
- name: Disable CRLF conversion
|
|
run: git config --global core.autocrlf false
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@1.94.0
|
|
with:
|
|
targets: x86_64-unknown-linux-gnu
|
|
|
|
- uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "29.3"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Apply patches onto pinned upstream
|
|
run: ./scripts/ci-apply.sh
|
|
|
|
- name: Export PROTOC
|
|
run: echo "PROTOC=$(command -v protoc)" >> "$GITHUB_ENV"
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: work
|
|
shared-key: ubuntu-cargo
|
|
cache-targets: false
|
|
|
|
- name: Release build
|
|
working-directory: work
|
|
run: cargo build --release --locked -p xai-grok-pager-bin --target "$TARGET"
|
|
|
|
- name: Package
|
|
run: ./scripts/ci-package.sh
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: grok-linux-amd64
|
|
path: dist/*
|
|
if-no-files-found: error
|
|
|
|
build-windows-amd64:
|
|
name: grok-windows-amd64
|
|
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 180
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
TARGET: x86_64-pc-windows-msvc
|
|
ARTIFACT: grok-windows-amd64
|
|
EXE: xai-grok-pager.exe
|
|
XWIN_CACHE_DIR: ${{ github.workspace }}/.xwin-cache
|
|
steps:
|
|
- name: Disable CRLF conversion
|
|
run: git config --global core.autocrlf false
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@1.94.0
|
|
with:
|
|
targets: x86_64-pc-windows-msvc
|
|
|
|
- uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "29.3"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Apply patches onto pinned upstream
|
|
run: ./scripts/ci-apply.sh
|
|
|
|
- name: Export PROTOC
|
|
run: echo "PROTOC=$(command -v protoc)" >> "$GITHUB_ENV"
|
|
|
|
- name: Install clang / lld / llvm
|
|
run: sudo apt-get update && sudo apt-get install -y clang lld llvm
|
|
|
|
- uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: cargo-xwin
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: work
|
|
shared-key: ubuntu-cargo
|
|
cache-targets: false
|
|
|
|
- name: Cache xwin MSVC splat
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ env.XWIN_CACHE_DIR }}
|
|
key: xwin-x86_64-msvc-v1
|
|
|
|
- name: Release build (cross)
|
|
working-directory: work
|
|
run: cargo xwin build --release --locked -p xai-grok-pager-bin --target "$TARGET"
|
|
|
|
- name: Package
|
|
run: ./scripts/ci-package.sh
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: grok-windows-amd64
|
|
path: dist/*
|
|
if-no-files-found: error
|
|
|
|
build-macos-arm64:
|
|
name: grok-macos-arm64
|
|
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
|
|
needs: test
|
|
runs-on: macos-14
|
|
timeout-minutes: 180
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
env:
|
|
TARGET: aarch64-apple-darwin
|
|
ARTIFACT: grok-macos-arm64
|
|
EXE: xai-grok-pager
|
|
steps:
|
|
- name: Disable CRLF conversion
|
|
run: git config --global core.autocrlf false
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: dtolnay/rust-toolchain@1.94.0
|
|
with:
|
|
targets: aarch64-apple-darwin
|
|
|
|
- uses: arduino/setup-protoc@v3
|
|
with:
|
|
version: "29.3"
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Apply patches onto pinned upstream
|
|
run: ./scripts/ci-apply.sh
|
|
|
|
- name: Export PROTOC
|
|
run: echo "PROTOC=$(command -v protoc)" >> "$GITHUB_ENV"
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: work
|
|
key: macos-arm64
|
|
cache-targets: false
|
|
|
|
- name: Release build
|
|
working-directory: work
|
|
run: cargo build --release --locked -p xai-grok-pager-bin --target "$TARGET"
|
|
|
|
- name: Package
|
|
run: ./scripts/ci-package.sh
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: grok-macos-arm64
|
|
path: dist/*
|
|
if-no-files-found: error
|
|
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
needs: [build-linux-amd64, build-windows-amd64, build-macos-arm64]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
path: dist
|
|
merge-multiple: true
|
|
|
|
- uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: dist/*
|
|
generate_release_notes: true
|
|
fail_on_unmatched_files: true
|