diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 220fd4e..197995b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,3 +70,8 @@ jobs: if [ -n "${{ matrix.features }}" ]; then FLAGS="$FLAGS --features ${{ matrix.features }}"; fi echo "Running: cargo test $FLAGS -- --nocapture" cargo test $FLAGS -- --nocapture + + - name: Build Docs + shell: bash + run: | + cargo doc -p hyper-custom-cert --no-deps diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 922d84f..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Documentation - -on: - push: - tags: - - 'v*' - -jobs: - docs: - name: Build and validate documentation - runs-on: ubuntu-latest - defaults: - run: - working-directory: crates/hyper-custom-cert - strategy: - fail-fast: false - matrix: - include: - - name: default-features - features: "" - no-default-features: false - - name: no-default-features - features: "" - no-default-features: true - - name: rustls - features: "rustls" - no-default-features: true - - name: insecure-dangerous - features: "insecure-dangerous" - no-default-features: false - - name: all-features - features: "rustls,insecure-dangerous" - no-default-features: true - steps: - - name: Checkout - uses: actions/checkout@v4 - - - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - - name: Setup Rust - run: rustup update stable && rustup default stable - - - name: Build documentation - shell: bash - run: | - FLAGS="" - if [ "${{ matrix.no-default-features }}" = "true" ]; then FLAGS="$FLAGS --no-default-features"; fi - if [ -n "${{ matrix.features }}" ]; then FLAGS="$FLAGS --features ${{ matrix.features }}"; fi - echo "Running: cargo doc $FLAGS --no-deps" - cargo doc $FLAGS --no-deps - - - name: Check documentation warnings - shell: bash - run: | - FLAGS="" - if [ "${{ matrix.no-default-features }}" = "true" ]; then FLAGS="$FLAGS --no-default-features"; fi - if [ -n "${{ matrix.features }}" ]; then FLAGS="$FLAGS --features ${{ matrix.features }}"; fi - echo "Running: cargo doc $FLAGS --no-deps" - RUSTDOCFLAGS="-D warnings" cargo doc $FLAGS --no-deps - - - name: Test documentation examples - shell: bash - run: | - FLAGS="" - if [ "${{ matrix.no-default-features }}" = "true" ]; then FLAGS="$FLAGS --no-default-features"; fi - if [ -n "${{ matrix.features }}" ]; then FLAGS="$FLAGS --features ${{ matrix.features }}"; fi - echo "Running: cargo test --doc $FLAGS" - cargo test --doc $FLAGS \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf165d9..6f8b36b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,9 +9,79 @@ env: CARGO_TERM_COLOR: always jobs: + docs: + name: Build and validate documentation + runs-on: ubuntu-latest + defaults: + run: + working-directory: crates/hyper-custom-cert + strategy: + fail-fast: false + matrix: + include: + - name: default-features + features: "" + no-default-features: false + - name: no-default-features + features: "" + no-default-features: true + - name: rustls + features: "rustls" + no-default-features: true + - name: insecure-dangerous + features: "insecure-dangerous" + no-default-features: false + - name: all-features + features: "rustls,insecure-dangerous" + no-default-features: true + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Setup Rust + run: rustup update stable && rustup default stable + + - name: Build documentation + shell: bash + run: | + FLAGS="" + if [ "${{ matrix.no-default-features }}" = "true" ]; then FLAGS="$FLAGS --no-default-features"; fi + if [ -n "${{ matrix.features }}" ]; then FLAGS="$FLAGS --features ${{ matrix.features }}"; fi + echo "Running: cargo doc $FLAGS --no-deps" + cargo doc $FLAGS --no-deps + + - name: Check documentation warnings + shell: bash + run: | + FLAGS="" + if [ "${{ matrix.no-default-features }}" = "true" ]; then FLAGS="$FLAGS --no-default-features"; fi + if [ -n "${{ matrix.features }}" ]; then FLAGS="$FLAGS --features ${{ matrix.features }}"; fi + echo "Running: cargo doc $FLAGS --no-deps" + RUSTDOCFLAGS="-D warnings" cargo doc $FLAGS --no-deps + + - name: Test documentation examples + shell: bash + run: | + FLAGS="" + if [ "${{ matrix.no-default-features }}" = "true" ]; then FLAGS="$FLAGS --no-default-features"; fi + if [ -n "${{ matrix.features }}" ]; then FLAGS="$FLAGS --features ${{ matrix.features }}"; fi + echo "Running: cargo test --doc $FLAGS" + cargo test --doc $FLAGS + test: name: Test before release runs-on: ubuntu-latest + needs: docs defaults: run: working-directory: crates/hyper-custom-cert @@ -75,9 +145,12 @@ jobs: echo "Running: cargo test $FLAGS -- --nocapture" cargo test $FLAGS -- --nocapture + publish: name: Publish to crates.io runs-on: ubuntu-latest + permissions: + id-token: write # Required for OIDC token exchange https://crates.io/docs/trusted-publishing needs: test defaults: run: @@ -108,10 +181,13 @@ jobs: exit 1 fi - - name: Publish to crates.io + # See Trusted publishing: https://crates.io/docs/trusted-publishing + - uses: rust-lang/crates-io-auth-action@v1 + id: auth + + - run: cargo publish env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - run: cargo rustdoc -p hyper-custom-cert --all-features && cargo publish + CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} release: name: Create GitHub Release diff --git a/Cargo.lock b/Cargo.lock index 851b284..f35ad3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -364,7 +364,7 @@ dependencies = [ [[package]] name = "hyper-custom-cert" -version = "0.2.2" +version = "0.3.0" dependencies = [ "hyper-rustls", "hyper-tls", diff --git a/crates/hyper-custom-cert/Cargo.toml b/crates/hyper-custom-cert/Cargo.toml index e5b55b2..72bae1f 100644 --- a/crates/hyper-custom-cert/Cargo.toml +++ b/crates/hyper-custom-cert/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hyper-custom-cert" -version = "0.2.2" +version = "0.3.0" edition = "2024" description = "A small, ergonomic HTTP client wrapper around hyper with optional support for custom Root CAs and a dev-only insecure mode for self-signed certificates." license = "MIT OR Apache-2.0"