apply naming convention 'try_' prefix for fallible setters/constructors #3895
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_TOOLCHAIN: stable | |
| RUST_TOOLCHAIN_NIGHTLY: nightly | |
| RUST_TOOLCHAIN_MSRV: 1.91.0 | |
| RUST_TOOLCHAIN_BETA: beta | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: {} | |
| jobs: | |
| check-msrv: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN_MSRV}} | |
| components: clippy, rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN_MSRV}}" | |
| - name: check | |
| run: | | |
| cargo check --workspace --all-targets --all-features | |
| - name: clippy | |
| run: | | |
| cargo clippy --workspace --all-targets --all-features | |
| - name: rustfmt | |
| run: | | |
| cargo fmt --all --check | |
| check: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| components: clippy, rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: check | |
| run: | | |
| cargo check --workspace --all-targets --all-features | |
| - name: clippy | |
| run: | | |
| cargo clippy --workspace --all-targets --all-features | |
| - name: rustfmt | |
| run: | | |
| cargo fmt --all --check | |
| - name: extra-checks | |
| run: | | |
| ./scripts/extra-checks.sh | |
| check-all-features: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| components: clippy, rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: check | |
| run: | | |
| cargo check --workspace --all-targets --all-features | |
| - name: clippy | |
| run: | | |
| cargo clippy --workspace --all-targets --all-features | |
| - name: rustfmt | |
| run: | | |
| cargo fmt --all --check | |
| test-msrv: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN_MSRV}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN_MSRV}}" | |
| - name: Run tests | |
| run: cargo test --all-features --workspace | |
| test-beta: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN_BETA}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN_BETA}}" | |
| - name: Run tests | |
| run: cargo test --all-features --workspace | |
| test: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Run tests | |
| run: cargo test --all-features --workspace | |
| test-loom: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| env: | |
| RUSTFLAGS: --cfg loom -Dwarnings | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Run tests | |
| run: cargo test --all-features -p rama-utils | |
| test-all-features: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Run tests | |
| run: cargo test --all-features --workspace | |
| test-macos-msrv: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN_MSRV}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN_MSRV}}" | |
| - name: Run tests | |
| run: cargo test --all-features --workspace | |
| test-macos: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Run tests | |
| run: cargo test --all-features --workspace | |
| test-windows-msrv: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: windows-latest | |
| steps: | |
| - uses: ilammy/setup-nasm@v1 | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN_MSRV}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN_MSRV}}" | |
| - name: Run tests | |
| run: cargo test --all-features --workspace | |
| test-windows: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: windows-latest | |
| steps: | |
| - uses: ilammy/setup-nasm@v1 | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Run tests | |
| run: cargo test --all-features --workspace | |
| test-ignored: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Run tests | |
| run: cargo test --features=cli,http-full,proxy-full,rustls --workspace -- --ignored | |
| test-ignored-macos: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: macos-latest | |
| timeout-minutes: 120 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Run tests | |
| run: cargo test --features=cli,http-full,proxy-full,rustls --workspace -- --ignored | |
| # NOTE: port conflicts on windows runners... | |
| # ... once we can test without static ports we can try to do this.. again | |
| # test-ignored-windows: | |
| # needs: [check, check-msrv, check-all-features] | |
| # runs-on: windows-latest | |
| # timeout-minutes: 120 | |
| # steps: | |
| # - uses: ilammy/setup-nasm@v1 | |
| # - uses: actions/checkout@v5 | |
| # - uses: dtolnay/rust-toolchain@master | |
| # with: | |
| # toolchain: ${{env.RUST_TOOLCHAIN}} | |
| # - uses: Swatinem/rust-cache@v2 | |
| # with: | |
| # env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| # - name: Run tests | |
| # run: cargo test --features=cli,http-full,proxy-full,rustls --workspace -- --ignored | |
| test-docs: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Run doc tests | |
| run: cargo test --doc --all-features --workspace | |
| test-examples-msrv: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN_MSRV}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN_MSRV}}" | |
| - name: Run doc tests | |
| run: cargo test --all-features --examples --workspace | |
| test-examples: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Run doc tests | |
| run: cargo test --all-features --examples --workspace | |
| test-examples-macos: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Run doc tests | |
| run: cargo test --all-features --examples --workspace | |
| test-ws-autobahn-server: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_TOOLCHAIN }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Install jq | |
| run: sudo apt-get update && sudo apt-get install -y jq | |
| - name: Run autobahn ws server test-suite | |
| shell: bash | |
| working-directory: "./rama-ws" | |
| run: ./autobahn/server.sh | |
| test-ws-autobahn-client: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| env: | |
| RUSTFLAGS: -D warnings | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ env.RUST_TOOLCHAIN }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Install jq | |
| run: sudo apt-get update && sudo apt-get install -y jq | |
| - name: Run autobahn ws client test-suite | |
| shell: bash | |
| working-directory: "./rama-ws" | |
| run: ./autobahn/client.sh | |
| cargo-hack: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - name: install cargo-hack | |
| uses: taiki-e/install-action@cargo-hack | |
| - name: cargo hack check | |
| run: cargo hack check --each-feature --no-dev-deps --workspace | |
| dependencies-are-sorted: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| env-vars: "RUST_TOOLCHAIN=${{env.RUST_TOOLCHAIN}}" | |
| - name: Install cargo-sort | |
| run: | | |
| cargo install cargo-sort 2>/dev/null || true | |
| - name: Check dependency tables | |
| working-directory: . | |
| run: | | |
| cargo sort --workspace --grouped --check | |
| cargo-deny: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: EmbarkStudios/cargo-deny-action@v2 | |
| with: | |
| rust-version: ${{env.RUST_TOOLCHAIN_MSRV}} | |
| cargo-fuzz-ua: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN_NIGHTLY}} | |
| - name: Install cargo-fuzz | |
| run: | | |
| cargo install cargo-fuzz 2>/dev/null || true | |
| - name: cargo fuzz check | |
| run: | | |
| cargo +nightly fuzz run ua_parse -- -max_len=131072 -max_total_time=30 | |
| cargo-fuzz-http-header: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN_NIGHTLY}} | |
| - name: Install cargo-fuzz | |
| run: | | |
| cargo install cargo-fuzz 2>/dev/null || true | |
| - name: cargo fuzz check | |
| run: | | |
| cargo +nightly fuzz run http_header_x_robots_tag -- -max_len=131072 -max_total_time=30 | |
| cargo-fuzz-h2: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@nightly | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN_NIGHTLY}} | |
| - name: Install cargo-fuzz | |
| run: | | |
| cargo install cargo-fuzz 2>/dev/null || true | |
| - name: cargo fuzz check | |
| run: | | |
| cargo +nightly fuzz run h2_client -- -max_total_time=30 | |
| cargo +nightly fuzz run h2_e2e -- -max_total_time=30 | |
| cargo +nightly fuzz run h2_hpack -- -max_total_time=30 | |
| test-spec-h2: | |
| needs: [check, check-msrv, check-all-features] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{env.RUST_TOOLCHAIN}} | |
| - name: h2spec | |
| run: | | |
| bash rama-http-core/ci/h2spec.sh -F | |
| # action is not being updated atm | |
| # TODO: enable once it works again, for now not that useful anyway | |
| # semver-checks: | |
| # needs: [check, check-msrv, check-all-features] | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: Checkout | |
| # uses: actions/checkout@v5 | |
| # - name: Check semver | |
| # uses: obi1kenobi/cargo-semver-checks-action@v2 | |
| # with: | |
| # rust-toolchain: ${{env.RUST_TOOLCHAIN}} | |
| deploy-rama-cli-docker: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - test | |
| - test-all-features | |
| - test-examples | |
| - test-msrv | |
| - test-beta | |
| - test-examples-msrv | |
| - test-ignored | |
| - test-docs | |
| - test-ws-autobahn-client | |
| - test-ws-autobahn-server | |
| - cargo-hack | |
| - cargo-deny | |
| - test-spec-h2 | |
| - cargo-fuzz-ua | |
| - cargo-fuzz-h2 | |
| - dependencies-are-sorted | |
| # - semver-checks | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| tags: glendc/rama:latest | |
| file: rama-cli/infra/Dockerfile | |
| deploy-rama-fp-fly: | |
| runs-on: ubuntu-latest | |
| needs: deploy-rama-cli-docker | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - run: | | |
| cd rama-fp/infra/deployments/fp | |
| flyctl deploy --remote-only | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| deploy-rama-fp-h1-fly: | |
| runs-on: ubuntu-latest | |
| needs: deploy-rama-cli-docker | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - run: | | |
| cd rama-fp/infra/deployments/fp-h1 | |
| flyctl deploy --remote-only | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| deploy-rama-ip-ipv4-fly: | |
| runs-on: ubuntu-latest | |
| needs: deploy-rama-cli-docker | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - run: | | |
| cd rama-fp/infra/deployments/ipv4 | |
| flyctl deploy --remote-only | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| deploy-rama-ip-ipv6-fly: | |
| runs-on: ubuntu-latest | |
| needs: deploy-rama-cli-docker | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - run: | | |
| cd rama-fp/infra/deployments/ipv6 | |
| flyctl deploy --remote-only | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| deploy-rama-echo-fly: | |
| runs-on: ubuntu-latest | |
| needs: deploy-rama-cli-docker | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: superfly/flyctl-actions/setup-flyctl@master | |
| - run: | | |
| cd rama-fp/infra/deployments/echo | |
| flyctl deploy --remote-only | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |