libnss-host4 0.2.2

A convenient way to implement the glibc gethostbyname4_r NSS host API
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: -D warnings

jobs:
  test:
    name: build, test, lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install stable toolchain
        run: |
          rustup toolchain install stable --profile minimal --component rustfmt,clippy
          rustup default stable
      - uses: Swatinem/rust-cache@v2
      - name: Format
        run: cargo fmt --all --check
      - name: Clippy
        run: cargo clippy --all-targets -- -D warnings
      - name: Build
        run: cargo build --all-targets
      - name: Build example cdylib
        run: cargo build --example nss_example --release
      - name: Test
        run: cargo test

  sanitizers:
    name: address sanitizer
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install nightly toolchain
        run: |
          rustup toolchain install nightly --profile minimal
          rustup default nightly
      - uses: Swatinem/rust-cache@v2
      - name: Test under AddressSanitizer
        env:
          RUSTFLAGS: -Z sanitizer=address
        run: cargo test --lib --target x86_64-unknown-linux-gnu
          # For local testing: RUSTFLAGS="-Z sanitizer=address" cargo +nightly test --lib --target x86_64-unknown-linux-gnu