name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ubuntu-latest
services:
mongo1:
image: mongo:latest
ports:
- 27017:27017
mongo2:
image: mongo:latest
ports:
- 27018:27017
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install MongoDB tools
run: |
sudo apt-get update
# Download and install MongoDB Database Tools directly
wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.8.0.deb
sudo apt install -y ./mongodb-database-tools-ubuntu2204-x86_64-100.8.0.deb
# Verify installation
mongodump --version
mongorestore --version
- name: Check formatting
run: cargo fmt --all -- --check
- name: Lint
run: cargo clippy -- -D warnings
- name: Run tests
env:
TEST_MONGO_SOURCE_URI: mongodb://localhost:27017
TEST_MONGO_TARGET_URI: mongodb://localhost:27018
run: cargo test --verbose