test: add backup integration tests using snapshots #1031
Workflow file for this run
This file contains 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: Continuous Integration | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
CI: true | |
on: | |
pull_request: | |
paths: | |
- "**/Cargo.toml" | |
- "**/Cargo.lock" | |
- '**.rs' | |
- '**.snap' | |
- '**.yml' | |
- '**.toml' | |
push: | |
branches: | |
- main | |
paths: | |
- "**/Cargo.toml" | |
- "**/Cargo.lock" | |
- '**.rs' | |
- '**.snap' | |
- '**.yml' | |
- '**.toml' | |
schedule: | |
- cron: "0 0 * * 0" | |
merge_group: | |
types: [checks_requested] | |
jobs: | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # v1 | |
with: | |
toolchain: stable | |
- run: rustup component add rustfmt | |
- name: Run Cargo Fmt | |
run: cargo fmt --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # v1 | |
with: | |
toolchain: stable | |
components: clippy | |
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 | |
- name: Run clippy | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
test: | |
name: Test | |
runs-on: ${{ matrix.job.os }} | |
strategy: | |
matrix: | |
rust: [stable] | |
job: | |
- os: macos-latest | |
- os: ubuntu-latest | |
- os: windows-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
if: github.event_name != 'pull_request' | |
with: | |
fetch-depth: 0 | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
if: github.event_name == 'pull_request' | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 | |
- name: Run Cargo Test | |
run: cargo +${{ matrix.rust }} test -r --all-targets --all-features --workspace --examples | |
id: run_tests | |
env: | |
INSTA_UPDATE: new | |
- name: Upload snapshots of failed tests | |
if: ${{ failure() && steps.run_tests.outcome == 'failure' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: failed-snapshots-${{ matrix.job.os }} | |
path: "**/snapshots/*.snap.new" | |
docs: | |
name: Build docs | |
runs-on: ${{ matrix.job.os }} | |
strategy: | |
matrix: | |
rust: [stable] | |
job: | |
- os: macos-latest | |
- os: ubuntu-latest | |
- os: windows-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
if: github.event_name != 'pull_request' | |
with: | |
fetch-depth: 0 | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
if: github.event_name == 'pull_request' | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 | |
- name: Run Cargo Doc | |
run: cargo +${{ matrix.rust }} doc --no-deps --all-features --workspace --examples | |
powerset: | |
name: Check Powerset of Features | |
# Only run if the commit doesn't come from a merged PR, we assume CI is running in the PR as well | |
# so we don't want to have runs double up | |
if: github.event.pull_request.merged == false | |
runs-on: ${{ matrix.job.os }} | |
strategy: | |
matrix: | |
rust: [stable, beta, nightly] | |
crate: [rustic_core, rustic_backend] # if we use a workspace, we also check all examples/* | |
job: | |
- os: macos-latest | |
- os: ubuntu-latest | |
- os: windows-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
if: github.event_name != 'pull_request' | |
with: | |
fetch-depth: 0 | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
if: github.event_name == 'pull_request' | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@1482605bfc5719782e1267fd0c0cc350fe7646b8 # v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: install cargo-hack | |
uses: taiki-e/install-action@d5ead4fdbf0cb2a037f276e7dfb78bbb9dd0ab8c # v2 | |
with: | |
tool: cargo-hack | |
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2 | |
- name: Run Cargo Hack | |
run: cargo +${{ matrix.rust }} hack check --feature-powerset --no-dev-deps -p ${{ matrix.crate }} | |
result: | |
name: Result (CI) | |
runs-on: ubuntu-latest | |
needs: | |
- fmt | |
- clippy | |
- test | |
- docs | |
- powerset | |
steps: | |
- name: Mark the job as successful | |
run: exit 0 | |
if: success() | |
- name: Mark the job as unsuccessful | |
run: exit 1 | |
if: "!success()" |