Skip to content

Clear crates.io guides for embedding Surreal Sync (#141) #203

Clear crates.io guides for embedding Surreal Sync (#141)

Clear crates.io guides for embedding Surreal Sync (#141) #203

Workflow file for this run

name: Test Main
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: test-main-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install system build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake libssl-dev libsasl2-dev pkg-config protobuf-compiler postgresql-client
- name: Install Rust toolchain (from rust-toolchain.toml) + cache
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
components: rustfmt, clippy
cache: true
- name: Format check
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
# Parallel with build/lint — does not extend the build → test critical path
examples:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install system build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake libssl-dev libsasl2-dev pkg-config protobuf-compiler postgresql-client ripgrep
- name: Install Rust toolchain (from rust-toolchain.toml) + cache
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
cache: true
- name: Compile embedder examples
run: make compile-embedder-examples CARGO_PROFILE=ci
- name: Embed dependency tree gates
run: make embed-dependency-tree-gates
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install system build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake libssl-dev libsasl2-dev pkg-config protobuf-compiler postgresql-client
- name: Install Rust toolchain (from rust-toolchain.toml) + cache
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
cache: true
- name: Install cargo-nextest
uses: taiki-e/install-action@c44f6b046f1c29ae5918b1e0bfdbb2f1813836fd # v2.84.1
with:
tool: nextest
- name: Build CLI + all test binaries
run: cargo build --workspace --all-features --profile ci --bins --tests
- name: Archive test binaries
run: cargo nextest archive --workspace --all-features --cargo-profile ci --profile ci --archive-file nextest.tar.zst
- name: Upload nextest archive
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: nextest-archive
path: nextest.tar.zst
retention-days: 1
test:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Download nextest archive
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: nextest-archive
- name: Install cargo-nextest
uses: taiki-e/install-action@c44f6b046f1c29ae5918b1e0bfdbb2f1813836fd # v2.84.1
with:
tool: nextest
- name: Pre-build PostgreSQL (wal2json) test image
run: |
docker build -t postgres-wal2json-test \
-f crates/postgresql/Dockerfile.postgres16.wal2json \
crates/postgresql
- name: Pre-pull MySQL/MariaDB binlog test images
run: make prepull-binlog-images
- name: Export binlog test image tags
run: make print-test-images >> $GITHUB_ENV
- name: Run unit + integration tests (nextest shard ${{ matrix.shard }}/3)
env:
SURREAL_SYNC_BIN: ${{ github.workspace }}/target/ci/surreal-sync
RUST_BACKTRACE: 1
run: |
cargo nextest run --archive-file nextest.tar.zst --profile ci \
--extract-to . --extract-overwrite \
--partition count:${{ matrix.shard }}/3
- name: Clean up leftover test containers
if: always()
run: docker rm -f $(docker ps -aq) 2>/dev/null || true
- name: Upload test results on failure
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-results-shard-${{ matrix.shard }}
path: |
target/nextest/ci/junit.xml
logs/test/
retention-days: 7
if-no-files-found: ignore
doc:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install system build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake libssl-dev libsasl2-dev pkg-config protobuf-compiler postgresql-client
- name: Install Rust toolchain (from rust-toolchain.toml) + cache
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
cache: true
- name: Run documentation tests
run: cargo test --workspace --doc