gouqi 0.20.0

Rust interface for Jira
Documentation
name: Rust CI

on:
  push:
    branches: [main]
    paths-ignore:
      - '**.md'
      - 'LICENSE'
      - '.gitignore'
  pull_request:
    branches: [main]
    paths-ignore:
      - '**.md'
      - 'LICENSE'
      - '.gitignore'
  workflow_dispatch:  # Allow manual triggering

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: "-D warnings"

jobs:
  format:
    name: Format check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: rustfmt
      - name: Check code formatting
        run: cargo fmt --all -- --check

  check:
    name: Cargo check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
      - name: Enable cache
        uses: Swatinem/rust-cache@v2
      - name: Check code compilation
        run: cargo check --all-targets --all-features

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: clippy
      - name: Enable cache
        uses: Swatinem/rust-cache@v2
      - name: Run clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

  build-and-test:
    name: Build and test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
      - name: Enable cache
        uses: Swatinem/rust-cache@v2
      - name: Build project
        run: cargo build --all-targets --all-features
      - name: Run tests
        run: cargo test --all-features

  docs:
    name: Documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
      - name: Enable cache
        uses: Swatinem/rust-cache@v2
      - name: Build documentation
        run: cargo doc --no-deps --all-features

  audit:
    name: Security audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
      - name: Enable cache
        uses: Swatinem/rust-cache@v2
      - name: Install cargo-audit
        run: cargo install --force cargo-audit
      - name: Run security audit
        # Run security audit with specific ignores for known issues
        # Security audit will fail the build if vulnerabilities are found
        run: cargo audit --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2023-0071

  semver-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - name: Check semver
        uses: obi1kenobi/cargo-semver-checks-action@v2.8
    # Until it is running, keep it as is
    continue-on-error: true

  udeps-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - name: Install stable toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: nightly
      - name: Install udeps
        run: cargo install cargo-udeps
      - name: Enable cache
        uses: Swatinem/rust-cache@v2
      - name: Run udeps
        run: cargo +nightly udeps

  cargo-deny:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        checks:
          - advisories
          - bans sources
          - licenses

    # Prevent sudden announcement of a new advisory from failing ci:
    continue-on-error: ${{ matrix.checks == 'advisories' || matrix.checks == 'licenses' }}

    steps:
      - uses: actions/checkout@v5
      - uses: EmbarkStudios/cargo-deny-action@v2
        with:
          command: check ${{ matrix.checks }}
          # Add --lenient flag for licenses check to be more accommodating of license text differences
          args: ${{ matrix.checks == 'licenses' && '--lenient' || '' }}

  codecov-check:
    name: codecov-check
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v5
      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
      - name: Enable cache
        uses: Swatinem/rust-cache@v2
        
      - name: Install cargo-llvm-cov
        run: cargo install cargo-llvm-cov

      - name: Create coverage directory
        run: mkdir -p coverage

      - name: Run cargo-llvm-cov
        run: cargo llvm-cov --all-features --codecov --output-path coverage/codecov.json
        
      - name: Upload to codecov.io
        uses: codecov/codecov-action@v5.5.1
        with:
          token: ${{secrets.CODECOV_TOKEN}}
          files: ./coverage/codecov.json
          fail_ci_if_error: false

      - name: Archive code coverage results
        uses: actions/upload-artifact@v4
        with:
          name: code-coverage-report
          path: ./coverage/codecov.json