pgp 0.19.0

OpenPGP implementation in Rust
Documentation
name: CI

on:
  pull_request:
  push:
    branches:
      - main
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  RUST_BACKTRACE: 1
  RUSTFLAGS: -Dwarnings
  RUST_NIGHTLY: nightly-2025-04-02

jobs:
  build_and_test_nix:
    name: Build and test (Nix)
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macOS-latest]
        rust:
          - nightly-2025-04-02
          - stable

    steps:
    - name: Checkout
      uses: actions/checkout@master
      with:
        submodules: recursive

    - name: Checkout submodules
      run: git submodule update --checkout

    - name: Install ${{ matrix.rust }}
      uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.rust }}
        override: true

    - name: Install cargo-nextest
      uses: taiki-e/install-action@v2
      with:
        tool: nextest@0.9.80

    - name: tests
      run: cargo nextest run --lib --bins --tests --all

    - name: doc tests
      run: cargo test --doc

    - name: asm
      if: ${{ matrix.rust == env.RUST_NIGHTLY }}
      run: cargo nextest run --lib --bins --tests --all --features asm

    - name: malformed-artifact-compat
      if: ${{ matrix.rust == env.RUST_NIGHTLY }}
      run: cargo nextest run --lib --bins --tests --all --features malformed-artifact-compat

    - name: pqc
      if: ${{ matrix.rust == env.RUST_NIGHTLY }}
      run: cargo nextest run --lib --bins --tests --all --features draft-pqc

    - name: forwarding
      if: ${{ matrix.rust == env.RUST_NIGHTLY }}
      run: cargo nextest run --lib --bins --tests --all --features draft-wussler-openpgp-forwarding

    - name: all-features
      if: ${{ matrix.rust == env.RUST_NIGHTLY }}
      run: cargo nextest run --lib --bins --tests --all --all-features

    - name: tests ignored
      run: cargo nextest run --lib --bins --tests --all --run-ignored ignored-only --release

    - name: asm ignored
      run: cargo nextest run --lib --bins --tests --all --run-ignored ignored-only --release --features asm

    - name: pqc ignored
      run: cargo nextest run --lib --bins --tests --all --run-ignored ignored-only --release --features draft-pqc

  build_and_test_windows:
    name: Build and test (Windows)
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-latest]
        rust:
          - stable-x86_64-pc-windows-msvc
          - stable-x86_64-pc-windows-gnu

    steps:
    - name: Checkout
      uses: actions/checkout@master
      with:
        submodules: recursive

    - name: Checkout submodules
      run: git submodule update --checkout

    - name: Install ${{ matrix.rust }}
      run: rustup default ${{ matrix.rust }}

    - name: Install cargo-nextest
      uses: taiki-e/install-action@v2
      with:
        tool: nextest@0.9.80

    - name: tests
      run: cargo nextest run --lib --bins --tests --all

    - name: tests - pqc
      run: cargo nextest run --lib --bins --tests --all --features draft-pqc

    - name: tests ignored
      run: cargo nextest run --lib --bins --tests --all --run-ignored ignored-only --release

    - name: tests ignored - pqc
      run: cargo nextest run --lib --bins --tests --all --run-ignored ignored-only --release --features draft-pqc

  cross:
    name: Cross compile
    runs-on: ubuntu-latest
    strategy:
      matrix:
        target:
          - i686-unknown-linux-gnu
          - powerpc-unknown-linux-gnu
          - arm-linux-androideabi

    steps:
    - name: Checkout
      uses: actions/checkout@master
      with:
        submodules: recursive

    - name: Checkout submodules
      run: git submodule update --checkout

    - name: Install stable
      uses: actions-rs/toolchain@v1
      with:
        toolchain: 1.88
        target: ${{ matrix.target }}
        override: true

    - name: Install cross
      run: cargo install cross

    - name: test
      run: cross test --release --all --target ${{ matrix.target }}

    - name: test - pqc
      run: cross test --release --all --target ${{ matrix.target }} --features draft-pqc

  check_wasm:
    name: Check wasm targets
    runs-on: ubuntu-latest
    strategy:
      matrix:
        rust:
          - nightly-2025-04-02
          - stable

    steps:
    - uses: actions/checkout@master

    - name: Install rust with wasm32-unknown-unknown
      uses: actions-rs/toolchain@v1
      with:
        toolchain: ${{ matrix.rust }}
        target: wasm32-unknown-unknown
        override: true

    - name: Cache cargo registry
      uses: actions/cache@v4
      with:
        path: ~/.cargo/registry
        key: wasm32-${{ matrix.rust }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}

    - name: check
      uses: actions-rs/cargo@v1
      with:
        command: check
        args: --target wasm32-unknown-unknown --no-default-features --features wasm

    - name: check - pqc
      uses: actions-rs/cargo@v1
      with:
        command: check
        args: --target wasm32-unknown-unknown --no-default-features --features wasm,draft-pqc

  check_fmt:
    name: Checking fmt
    runs-on: ubuntu-latest
    env:
      RUSTC_WRAPPER: "sccache"
      SCCACHE_GHA_ENABLED: "on"
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - uses: mozilla-actions/sccache-action@v0.0.7
      - uses: taiki-e/install-action@cargo-make
      - run: cargo make format-check

  check_docs:
    name: Checking docs
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master

    - uses: actions-rs/toolchain@v1
      with:
          profile: minimal
          toolchain: ${{ env.RUST_NIGHTLY }}
          override: true
          components: rustfmt

    - name: Docs
      run: cargo doc --all-features

  clippy_check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: actions-rs/toolchain@v1
      with:
          profile: minimal
          toolchain: ${{ env.RUST_NIGHTLY }}
          override: true
          components: clippy
    - uses: actions-rs/clippy-check@v1
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        args: --all-features --all-targets --tests --bins --examples --benches

  codespell:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: codespell-project/actions-codespell@master

  cargo_deny:
    timeout-minutes: 30
    name: cargo deny
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: EmbarkStudios/cargo-deny-action@v2
        with:
          arguments: --workspace --all-features
          command: check
          command-arguments: "-Dwarnings"

  minimal_versions:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@master
      - name: Install toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ env.RUST_NIGHTLY }}
          override: true
      - name: check minimal version
        run: rm Cargo.lock && cargo check -Z direct-minimal-versions --all