env_encryption_tool 0.9.22

Rust-based .env (dotenv) file encryption & decryption tool - store & retrieve your app environment variables safely 😎 now Post-Quantum-safe!
Documentation
name: Rust CI/Unit Tests

permissions:
  contents: read

on:
  push:
    branches: ["main"]
  pull_request:
    branches: ["main"]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  MIRIFLAGS: "-Zmiri-strict-provenance -Zmiri-disable-isolation"
  DECRYPTION_KEY: "12345678901234567890123456789012"

jobs:
  build:
    name: ${{ 'Tests' }}-${{ matrix.os }}-${{ matrix.rust }} Rust
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [nightly, beta, stable]
    steps:
      - uses: actions/checkout@v6
      - name: Install Rust toolchain
        run: |
          rustup toolchain install ${{ matrix.rust }} --component rustfmt
          rustup override set ${{ matrix.rust }}
      - name: Run cargo check with all features
        run: cargo check --all-features
      - name: Run cargo fmt
        run: cargo fmt --all -- --check
      - name: Build
        run: cargo build --verbose
      - name: Run cargo test
        run: cargo test --verbose

  coverage:
    runs-on: ubuntu-latest
    env:
      RUSTFLAGS: "-Cinstrument-coverage -Clink-dead-code -Coverflow-checks=off"
      LLVM_PROFILE_FILE: "coverage/%p-%m.profraw"
    steps:
      - uses: actions/checkout@v6
      - name: Set up Rust with coverage tools
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true
          components: llvm-tools-preview
      - name: Install grcov
        run: |
          curl -LsSf https://github.com/mozilla/grcov/releases/download/v0.8.19/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar xj
          sudo mv grcov /usr/local/bin/
      - name: Run tests with coverage
        run: |
          cargo clean
          cargo build --tests
          cargo test
        env:
          DECRYPTION_KEY: "12345678901234567890123456789012"
      - name: Generate coverage report
        run: |
          mkdir -p coverage
          grcov . \
            --binary-path ./target/debug/ \
            --source-dir . \
            --output-type lcov \
            --branch \
            --ignore-not-existing \
            --ignore "/*/.cargo/**" \
            --ignore "target/**" \
            --output-path coverage/lcov.info
      - name: Coveralls GitHub Action
        uses: coverallsapp/github-action@v2.3.6
        env:
          COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
        with:
          path-to-lcov: coverage/lcov.info

  doc:
    name: Documentation
    runs-on: ubuntu-latest
    timeout-minutes: 45
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@nightly
      - uses: dtolnay/install@cargo-docs-rs
      - run: cargo docs-rs