Skip to content

feat: support image tag format for --mdb-version flag #174

feat: support image tag format for --mdb-version flag

feat: support image tag format for --mdb-version flag #174

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
CARGO_DENY_VERSION: 0.18.9
CARGO_AUDIT_VERSION: 0.22.0
CARGO_LLVM_COV_VERSION: 0.6.19
CARGO_UDEPS_VERSION: 0.1.59
CARGO_ABOUT_VERSION: 0.8.4
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install libdbus-1-dev
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev
- name: Install Rust toolchain
run: |
rustup update stable
rustup default stable
- name: Generate docs
run: cargo run --bin atlas-local-docs-generator
- name: Check for uncommitted files
run: |
FILES=$(git ls-files -o -m --directory --exclude-standard --no-empty-directory)
LINES=$(echo "$FILES" | awk 'NF' | wc -l)
if [ "$LINES" -ne 0 ]; then
echo "Detected files that need to be committed:"
echo "${FILES//^/ }"
echo ""
echo "Try running: cargo run --bin atlas-local-docs-generator"
exit 1
fi
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install libdbus-1-dev
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev
- name: Install Rust toolchain
run: |
rustup update stable
rustup default stable
rustup component add clippy rustfmt
rustup toolchain install nightly
- name: Cache cargo registry
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 cargo-binstall
uses: cargo-bins/cargo-binstall@v1.16.2
- name: Install cargo-deny
run: cargo binstall --no-confirm --locked --version ${{ env.CARGO_DENY_VERSION }} cargo-deny
- name: Install cargo-audit
run: cargo binstall --no-confirm --locked --version ${{ env.CARGO_AUDIT_VERSION }} cargo-audit
- name: Install cargo-udeps
run: cargo binstall --no-confirm --locked --version ${{ env.CARGO_UDEPS_VERSION }} cargo-udeps
- name: Install cargo-about
run: cargo binstall --no-confirm --locked --version ${{ env.CARGO_ABOUT_VERSION }} cargo-about
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Build
run: cargo build --verbose
- name: Run cargo deny
run: cargo deny check
- name: Run cargo audit
run: cargo audit
- name: Run cargo udeps (package dependencies)
run: cargo +nightly udeps
- name: Run cargo udeps (dev dependencies)
run: cargo +nightly udeps --all-features --all-targets
- name: Verify LICENSE-3RD-PARTY.txt is up to date
run: |
cargo about generate --locked about.hbs > LICENSE-3RD-PARTY-generated.txt
if ! diff -q LICENSE-3RD-PARTY.txt LICENSE-3RD-PARTY-generated.txt > /dev/null; then
echo "ERROR: LICENSE-3RD-PARTY.txt is not up to date!"
echo "Please run: cargo about generate about.hbs > LICENSE-3RD-PARTY.txt"
echo "Differences found:"
diff LICENSE-3RD-PARTY.txt LICENSE-3RD-PARTY-generated.txt || true
exit 1
fi
rm LICENSE-3RD-PARTY-generated.txt
echo "LICENSE-3RD-PARTY.txt is up to date"
test-matrix:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable, beta]
exclude:
# Don't run beta on all platforms to save CI time
- os: windows-latest
rust: beta
- os: macos-latest
rust: beta
steps:
- uses: actions/checkout@v6
# If the operating system is Ubuntu, install libdbus-1-dev
- name: Install libdbus-1-dev
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev
- name: Install Rust toolchain
run: |
rustup update ${{ matrix.rust }}
rustup default ${{ matrix.rust }}
- name: Install cargo-binstall
uses: cargo-bins/cargo-binstall@v1.16.2
- name: Install cargo-llvm-cov
shell: bash
run: cargo binstall --no-confirm --locked --version ${{ env.CARGO_LLVM_COV_VERSION }} cargo-llvm-cov
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.rust }}-cargo-
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Generate coverage report
run: cargo llvm-cov --verbose --lcov --output-path=unit-tests.lcov
- name: Upload coverage report
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
uses: coverallsapp/github-action@v2.3.7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: unit-tests.lcov
parallel: true
flag-name: ${{ matrix.os }}-${{ matrix.rust }}-unit-tests
# Minimum supported Rust version check
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install libdbus-1-dev
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev
- name: Install Rust 1.89
run: |
rustup update 1.89
rustup default 1.89
- name: Check MSRV build
run: cargo check --verbose
e2e-tests:
runs-on: ubuntu-latest
services:
docker:
image: docker:dind
options: --privileged
ports:
- 2375:2375
container:
image: ubuntu:latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies
run: |
apt-get update
apt-get install -y curl gcc libdbus-1-dev
- name: Install Atlas CLI
run: |
# Install dependencies
apt-get install -y gnupg curl
# Add MongoDB public key
curl -fsSL https://pgp.mongodb.com/server-8.0.asc | gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor
# Add MongoDB repository
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/8.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-8.0.list
# Update repositories
apt-get update
# Install the Atlas CLI
apt-get install -y mongodb-atlas-cli
# Print the Atlas CLI version
atlas --version
# Disable secure storage warnings
atlas config set silence_storage_warning true
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Cache cargo-llvm-cov
uses: actions/cache@v4
with:
path: |
~/.cargo/bin
~/.rustup/toolchains
key: ${{ runner.os }}-cargo-llvm-cov-${{ env.CARGO_LLVM_COV_VERSION }}
restore-keys: |
${{ runner.os }}-cargo-llvm-cov-
- name: Install cargo-llvm-cov
shell: bash
run: |
if ! command -v cargo-llvm-cov &> /dev/null; then
cargo install --locked --version ${{ env.CARGO_LLVM_COV_VERSION }} cargo-llvm-cov
fi
- name: Run E2E Tests
run: cargo test --test '*' --workspace --exclude 'src/*' --verbose --features e2e-tests
- name: Generate coverage report
run: cargo llvm-cov --test '*' --workspace --exclude 'src/*' --verbose --features e2e-tests --lcov --output-path=e2e-tests.lcov
- name: Upload coverage report
uses: coverallsapp/github-action@v2.3.7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: e2e-tests.lcov
parallel: true
flag-name: ubuntu-latest-e2e-tests
coverage:
name: Report Coverage
runs-on: ubuntu-latest
needs: [test-matrix, e2e-tests]
steps:
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
uses: coverallsapp/github-action@v2.3.7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true