name: Rust CI
on:
push:
branches: [ "**" ]
pull_request:
env:
RUST_BACKTRACE: full
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Set up protoc
uses: arduino/setup-protoc@v3
with:
version: "33.2"
- name: Start test server
shell: bash
run: |
set -euo pipefail
python -m pip install --upgrade pip
python -m pip install -r tests/server/requirements.txt
TEKHSI_DATA_DIR="$GITHUB_WORKSPACE/tests/data" bash ./tests/server/run-server.sh --verbose | tee tests/server/server.log 2>&1 &
echo "SERVER_PID=$!" >> $GITHUB_ENV
timeout 30s bash -c 'until nc -z 127.0.0.1 5000; do sleep 1; echo -n "#"; done'
echo -e "\nServer ready!"
- name: Build
run: |
cargo build --no-default-features
cargo build --no-default-features --features fft
cargo build --no-default-features --features client-id-header
cargo build --no-default-features --features client-id-header,fft
- name: Run tests
run: |
cargo test --lib --no-default-features -- --test-threads 8
cargo test --lib --no-default-features --features fft -- --test-threads 8
cargo test --no-default-features --features client-id-header -- --test-threads 8
cargo test --no-default-features --features client-id-header,fft -- --test-threads 8
- name: Stop test server
if: always()
run: |
if [ -n "${SERVER_PID:-}" ]; then
kill "$SERVER_PID" || true
fi