echoes 0.8.0

Find duplicated Rust doctests, functions and contexts
Documentation
name: CI

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

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

env:
  CARGO_INCREMENTAL: 0
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: short

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
        with:
          save-if: ${{ github.ref == 'refs/heads/main' }}
      - run: cargo fmt --all --check
      - run: cargo clippy --workspace --all-targets --locked -- -D warnings
      - run: cargo clippy --workspace --lib --no-default-features --locked -- -D warnings
      - run: cargo clippy -p echoes --all-targets --no-default-features --features std --locked -- -D warnings
      - run: cargo doc --workspace --no-deps --locked

  test:
    name: test (${{ matrix.name }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: default
            run: cargo nextest run --workspace
          - name: std
            run: cargo nextest run -p echoes --no-default-features --features std
          - name: no-std
            run: cargo nextest run --workspace --lib --no-default-features
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - uses: taiki-e/install-action@8cca0918f8471c33515202b73f56ab27f2bed283 # v2.87.29
        with:
          tool: cargo-nextest
      - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
        with:
          key: ${{ matrix.name }}
          save-if: ${{ github.ref == 'refs/heads/main' }}
      - run: ${{ matrix.run }} --locked --cargo-profile fast-test --profile ci
      - if: matrix.name == 'default'
        run: cargo test --workspace --doc --locked
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: junit-${{ matrix.name }}
          path: target/nextest/ci/junit.xml
          if-no-files-found: ignore

  witnesses:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - run: python3 -B -m unittest discover -s tests -p dependency_witnesses_test.py -v
        env:
          PYTHONDONTWRITEBYTECODE: "1"
      - name: Verify dependency witnesses
        id: dependency_witnesses
        run: >-
          python3 -B tests/dependency_witnesses.py
          --request-id "DG-CI-M0-${{ github.run_id }}-${{ github.run_attempt }}"
          --output "${{ runner.temp }}/dependency-witnesses.json"
          --timeout 180
      - uses: actions/upload-artifact@v4
        if: always() && steps.dependency_witnesses.outcome != 'skipped'
        with:
          name: dependency-witnesses
          path: ${{ runner.temp }}/dependency-witnesses.json
      - name: Verify checked constant witnesses
        id: dependency_constants_witnesses
        run: >-
          python3 -B tests/dependency_constants_witnesses.py
          --request-id "DG-CI-M2-${{ github.run_id }}-${{ github.run_attempt }}"
          --output "${{ runner.temp }}/dependency-constants-witnesses.json"
          --timeout 600
      - uses: actions/upload-artifact@v4
        if: always() && steps.dependency_constants_witnesses.outcome != 'skipped'
        with:
          name: dependency-constants-witnesses
          path: ${{ runner.temp }}/dependency-constants-witnesses.json
      - name: Verify primitive algebra witnesses
        id: dependency_algebra_witnesses
        run: |
          python3 -B tests/dependency_constants_witnesses.py --cases tests/fixtures/dependency/algebra_cases.json --request-id "DG-CI-M3-${{ github.run_id }}-${{ github.run_attempt }}" --output "${{ runner.temp }}/dependency-algebra-witnesses.json" --timeout 600
          python3 -B tests/dependency_constants_witnesses.py --cases tests/fixtures/dependency/algebra_signed_cases.json --request-id "DG-CI-M3-SIGNED-${{ github.run_id }}-${{ github.run_attempt }}" --output "${{ runner.temp }}/dependency-algebra-signed-witnesses.json" --timeout 600
      - uses: actions/upload-artifact@v4
        if: always() && steps.dependency_algebra_witnesses.outcome != 'skipped'
        with:
          name: dependency-algebra-witnesses
          path: |
            ${{ runner.temp }}/dependency-algebra-witnesses.json
            ${{ runner.temp }}/dependency-algebra-signed-witnesses.json