deps: bump prometheus-client from 0.19.0 to 0.21.1 #316
This file contains 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: Continuous integration | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 2 # Fail cache download after 2 minutes. | |
jobs: | |
test: | |
name: Test ${{ matrix.crate }} | |
runs-on: ubuntu-latest | |
needs: gather_published_crates | |
strategy: | |
fail-fast: false | |
matrix: | |
crate: ${{ fromJSON(needs.gather_published_crates.outputs.members) }} | |
steps: | |
- name: Install Protoc | |
run: sudo apt-get install protobuf-compiler | |
- uses: actions/checkout@v3 | |
- name: Get MSRV for ${{ matrix.crate }} | |
id: parse-msrv | |
run: | | |
RUST_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "${{ matrix.crate }}") | .rust_version') | |
echo "version=${RUST_VERSION}" >> $GITHUB_OUTPUT | |
- name: Install Rust ${{ steps.parse-msrv.outputs.version }} for MSRV check | |
uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955 # v1 | |
with: | |
toolchain: ${{ steps.parse-msrv.outputs.version }} | |
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 | |
with: | |
shared-key: msrv-cache | |
save-if: false | |
- name: Check if ${{ matrix.crate }} compiles on MSRV (Rust ${{ steps.parse-msrv.outputs.version }}) | |
run: cargo +${{ steps.parse-msrv.outputs.version }} build --package ${{ matrix.crate }} --all-features | |
- uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955 # v1 | |
with: | |
toolchain: stable | |
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 | |
with: | |
shared-key: stable-cache | |
save-if: false | |
- name: Run all tests | |
run: cargo test --package ${{ matrix.crate }} --all-features | |
- name: Check if we compile without any features activated | |
run: cargo build --package ${{ matrix.crate }} --no-default-features | |
- name: Check if crate has been released | |
id: check-released | |
run: | | |
RESPONSE_CODE=$(curl https://crates.io/api/v1/crates/${{ matrix.crate }} --silent --write-out "%{http_code}" --output /dev/null) | |
echo "code=${RESPONSE_CODE}" | |
echo "code=${RESPONSE_CODE}" >> $GITHUB_OUTPUT | |
- uses: ./.github/actions/cargo-semver-checks | |
if: steps.check-released.outputs.code == 200 # Workaround until https://github.com/obi1kenobi/cargo-semver-check/issues/146 is shipped. | |
with: | |
args: check-release -p ${{ matrix.crate }} | |
- name: Enforce no dependency on meta crate | |
run: | | |
cargo metadata --format-version=1 --no-deps | \ | |
jq -e -r '.packages[] | select(.name == "${{ matrix.crate }}") | .dependencies | all(.name != "libp2p")' | |
cross: | |
name: Compile on ${{ matrix.target }} | |
strategy: | |
matrix: | |
include: | |
- target: "wasm32-unknown-unknown" | |
os: ubuntu-latest | |
- target: "wasm32-unknown-emscripten" | |
os: ubuntu-latest | |
- target: "wasm32-wasi" | |
os: ubuntu-latest | |
- target: "x86_64-apple-darwin" | |
os: macos-latest | |
- target: "x86_64-pc-windows-msvc" | |
os: windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Install Protoc | |
if: ${{ matrix.os != 'ubuntu-latest' }} | |
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # v1.1.2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Protoc | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: sudo apt-get install protobuf-compiler | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955 # v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 | |
with: | |
key: ${{ matrix.target }} | |
save-if: ${{ github.ref == 'refs/heads/master' }} | |
- run: cargo check --package libp2p --all-features --target=${{ matrix.target }} | |
feature_matrix: # Test various feature combinations work correctly | |
name: Compile with select features (${{ matrix.features }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- features: "mdns tcp dns tokio" | |
- features: "mdns tcp dns async-std" | |
steps: | |
- name: Install Protoc | |
run: sudo apt-get install protobuf-compiler | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955 # v1 | |
with: | |
toolchain: stable | |
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 | |
with: | |
key: ${{ matrix.features }} | |
save-if: ${{ github.ref == 'refs/heads/master' }} | |
- run: cargo check --package libp2p --features="${{ matrix.features }}" | |
check-rustdoc-links: | |
name: Check rustdoc intra-doc links | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Protoc | |
run: sudo apt-get install protobuf-compiler | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955 # v1 | |
with: | |
toolchain: stable | |
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/master' }} | |
- name: Check rustdoc links | |
run: RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links --deny warnings" cargo doc --verbose --workspace --no-deps --all-features --document-private-items | |
clippy: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust-version: [ | |
1.67.1, # current stable | |
beta | |
] | |
steps: | |
- name: Install Protoc | |
run: sudo apt-get install protobuf-compiler | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955 # v1 | |
with: | |
toolchain: ${{ matrix.rust-version }} | |
components: clippy | |
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/master' }} | |
- name: Run cargo clippy | |
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3 | |
with: | |
command: custom-clippy # cargo alias to allow reuse of config locally | |
ipfs-integration-test: | |
name: IPFS Integration tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Protoc | |
run: sudo apt-get install protobuf-compiler | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955 # v1 | |
with: | |
toolchain: stable | |
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 | |
with: | |
save-if: ${{ github.ref == 'refs/heads/master' }} | |
- name: Run ipfs-kad example | |
run: RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run --example ipfs-kad --features full | |
rustfmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955 # v1 | |
with: | |
toolchain: stable | |
components: rustfmt | |
- name: Check formatting | |
run: cargo fmt -- --check | |
manifest_lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@9cd00a88a73addc8617065438eff914dd08d0955 # v1 | |
with: | |
toolchain: stable | |
- name: Ensure `full` feature contains all features | |
run: | | |
ALL_FEATURES=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "libp2p") | .features | keys | map(select(. != "full")) | sort | join(" ")') | |
FULL_FEATURE=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name == "libp2p") | .features["full"] | sort | join(" ")') | |
test "$ALL_FEATURES = $FULL_FEATURE" | |
echo "$ALL_FEATURES"; | |
echo "$FULL_FEATURE"; | |
test "$ALL_FEATURES" = "$FULL_FEATURE" | |
gather_published_crates: | |
runs-on: ubuntu-latest | |
outputs: | |
members: ${{ steps.cargo-metadata.outputs.members }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: cargo-metadata | |
run: | | |
WORKSPACE_MEMBERS=$(cargo metadata --format-version=1 --no-deps | jq -c '.packages | .[] | select(.publish == null) | .name' | jq -s '.' | jq -c '.') | |
echo "members=${WORKSPACE_MEMBERS}" >> $GITHUB_OUTPUT | |
validate_pr_title: | |
name: Validate PR title | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'pull_request' }} | |
steps: | |
- uses: amannn/action-semantic-pull-request@01d5fd8a8ebb9aafe902c40c53f0f4744f7381eb # v5.0.2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
# Configure which types are allowed (newline delimited). | |
types: | | |
feat | |
fix | |
chore | |
docs | |
deps | |
test | |
ci | |
refactor | |
require_scope: false | |
- name: Check PR title length | |
env: | |
TITLE: ${{ github.event.pull_request.title }} | |
run: | | |
title_length=${#TITLE} | |
if [ $title_length -gt 72 ] | |
then | |
echo "PR title is too long (greater than 72 characters)" | |
exit 1 | |
fi |