name: Continuous Integration
on:
push:
branches: [ main, feature/oss-setup, feature/windows-support ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
test:
name: Test Suite
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
rust: stable
- os: macos-latest
rust: stable
- os: windows-latest
rust: stable
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Verify submodule branch
run: |
echo "Checking submodule branch..."
git config -f .gitmodules --get submodule.ht-core.branch
git submodule status
shell: bash
- name: List ht-core contents
run: ls -la ht-core/
shell: bash
- name: Show Rust info
run: |
echo "Rust version:"
rustc --version
echo "Cargo version:"
cargo --version
echo "Targets:"
rustup target list --installed
shell: bash
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.rust }}-
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Lint with clippy
run: cargo clippy --package ht-mcp --all-targets -- -D warnings
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
env:
RUSTFLAGS: "--cfg ci"
- name: Build release binary
run: cargo build --release
quick-test:
name: Quick Build Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-test-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
env:
RUSTFLAGS: "--cfg ci"
- name: Run clippy
run: cargo clippy --package ht-mcp --all-targets -- -D warnings
# TODO: Re-enable after main build is working
# security:
# name: Security Audit
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# submodules: recursive
#
# - name: Install Rust toolchain
# uses: dtolnay/rust-toolchain@stable
#
# - name: Install cargo-audit
# run: cargo install cargo-audit
# - name: Run security audit
# run: cargo audit
# - name: Check licenses
# run: |
# cargo install cargo-license
# cargo license --json | jq -r '.[] | select(.license != "MIT" and .license != "Apache-2.0" and .license != "BSD-3-Clause" and .license != "ISC" and .license != "Unlicense") | "\(.name): \(.license)"' | tee /tmp/incompatible_licenses
# if [ -s /tmp/incompatible_licenses ]; then
# echo "Found incompatible licenses:"
# cat /tmp/incompatible_licenses
# exit 1
# fi
# coverage:
# name: Code Coverage
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# submodules: recursive
#
# - name: Install Rust toolchain
# uses: dtolnay/rust-toolchain@stable
#
# - name: Install cargo-tarpaulin
# run: cargo install cargo-tarpaulin
# - name: Generate coverage report
# run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out Xml
# - name: Upload to codecov.io
# uses: codecov/codecov-action@v4
# with:
# fail_ci_if_error: false