asx 0.20.0

AS2 and AS4 (ebMS3) B2B messaging: BDEW, Peppol, eDelivery and ENTSOG profiles, signed receipts and MDNs, one tower Service to receive
name: CI

on:
  push:
    branches: [main]
  pull_request:
  workflow_call: # release.yml runs this for the tagged commit

permissions:
  contents: read

concurrency:
  group: ci-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
  CARGO_TERM_COLOR: always

# `just ci` runs check + features + msrv + deny locally; `just interop` runs interop.
jobs:
  check:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - run: rustup toolchain install stable --profile minimal --component rustfmt,clippy --no-self-update && rustup default stable
      - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
      - run: cargo fmt --all -- --check
      - run: cargo clippy --locked --workspace --all-features --all-targets -- -D warnings
      - run: cargo doc --locked --all-features --no-deps
        env:
          RUSTDOCFLAGS: -D warnings
      - name: Docs rules (README and site; the compile half is the src/docs.rs doctests)
        run: bash scripts/check-docs.sh && bash scripts/concepts-check.sh
      - run: cargo test --locked --workspace --all-features

  features:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - run: rustup toolchain install stable --profile minimal --no-self-update && rustup default stable
      - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
      - uses: taiki-e/install-action@1168f6810a3cb30a3514bf5756a3b7f0422c6df8 # v2.87.28
        with:
          tool: cargo-hack@0.6
      # No default features, each feature alone, and all features.
      - run: cargo hack check --locked -p asx --each-feature --lib --tests
        env:
          RUSTFLAGS: -D warnings

  msrv:
    runs-on: ubuntu-latest
    timeout-minutes: 20
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - run: rustup toolchain install 1.88 --profile minimal --no-self-update
      - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
      - run: cargo +1.88 check --locked --workspace --all-features

  deny:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: taiki-e/install-action@1168f6810a3cb30a3514bf5756a3b7f0422c6df8 # v2.87.28
        with:
          tool: cargo-deny@0.20.2
      - run: cargo deny --workspace --all-features check advisories licenses bans sources

  # Foreign implementations as oracles (the `#[ignore]`d interop tests):
  # openssl CLI (AS2 S/MIME, BDEW Brainpool mutual TLS), xmlsec1 (XML-DSig), Redis (async storage) and
  # phase4 4.8.1 as the BDEW counterparty, built here from tests/fixtures/phase4.
  interop:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - run: rustup toolchain install stable --profile minimal --no-self-update && rustup default stable
      - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
      - uses: docker/setup-buildx-action@v3
      - name: Build the phase4 peer
        id: peer
        uses: docker/build-push-action@v6
        with:
          context: tests/fixtures/phase4
          load: true
          tags: asx-phase4-peer:ci
          cache-from: type=gha,scope=phase4-peer
          cache-to: type=gha,scope=phase4-peer,mode=max
      - uses: taiki-e/install-action@1168f6810a3cb30a3514bf5756a3b7f0422c6df8 # v2.87.28
        with:
          tool: just
      - run: just interop
        env:
          ASX_PHASE4_IMAGE: ${{ steps.peer.outputs.imageid }}