feat(cli): backup management commands #69
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| types: [ opened, reopened, synchronize, ready_for_review ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| clippy_check: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install rust stable toolchain | |
| run: rustup update stable && rustup default stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Run Clippy | |
| run: cargo clippy --all-targets --all-features | |
| env: | |
| RUSTFLAGS: "-Dwarnings" | |
| unused_deps: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Check for unused crates | |
| uses: bnjbvr/cargo-machete@main | |
| env: | |
| RUSTFLAGS: "-Dwarnings" | |
| rustfmt: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install rust stable toolchain | |
| run: rustup update stable && rustup default stable && rustup component add rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Run Rustfmt | |
| run: cargo fmt --check | |
| env: | |
| RUSTFLAGS: "-Dwarnings" | |
| cargo_build: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install rust stable toolchain | |
| run: rustup update stable && rustup default stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Run Cargo Build | |
| run: cargo build --release | |
| env: | |
| RUSTFLAGS: "-Dwarnings" | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| path: ./target/release/mbm | |
| name: mbm_linux_x64 | |
| if-no-files-found: error | |
| cargo_tests: | |
| if: github.event.pull_request.draft == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install rust stable toolchain | |
| run: rustup update stable && rustup default stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Run Cargo Test | |
| run: cargo test | |
| backup_test: | |
| needs: cargo_build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| mongodb-version: [ '7.0', '8.0' ] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| sparse-checkout: .github | |
| - uses: actions/download-artifact@v6 | |
| with: | |
| path: . | |
| name: mbm_linux_x64 | |
| - name: Start MongoDB | |
| uses: supercharge/mongodb-github-action@1.12.1 | |
| with: | |
| mongodb-version: ${{ matrix.mongodb-version }} | |
| mongodb-username: mbm | |
| mongodb-password: example | |
| mongodb-db: example | |
| - name: Install mongosh | |
| run: | | |
| sudo apt-get install gnupg | |
| wget -qO- https://www.mongodb.org/static/pgp/server-8.0.asc | sudo tee /etc/apt/trusted.gpg.d/server-8.0.asc | |
| echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list | |
| sudo apt-get update | |
| sudo apt-get install -y mongodb-mongosh coreutils | |
| mongosh --version | |
| - name: Seed Database | |
| run: mongosh "mongodb://mbm:example@localhost:27017/example?authSource=admin" ./.github/ci_database_seed.js | |
| - name: Create config | |
| run: curl https://gist.githubusercontent.com/Nonolanlan1007/5af44878616e516abe253c18f62f2f6b/raw/0d862738749a19d3ef80b56faf89d5cf912f95e9/mbm_ci_test_config.toml > config.toml | |
| - name: Run Backup | |
| env: | |
| CONFIG_FILE: ./config.toml | |
| run: | | |
| chmod a+x ./mbm | |
| ./mbm backup start test | |
| - name: Check backup files | |
| run: | | |
| mv ./backups/**/*.json ./ | |
| sha256sum ./*.json | |
| echo "a4055f4f744fdbd60d61709a3b180e61f1bfad2e07dfc388725bc21c93a1734c ./telemetry.json" > checksum.txt | |
| echo "3b9e5af8209f86618eb148a11ee0cd2a8ba32452c8b6e1eadbfb9c2e686967d0 ./users.json" >> checksum.txt | |
| sha256sum --check checksum.txt |