Skip to content

Commit

Permalink
Merge branch 'master' into quic_quinn
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger committed May 2, 2023
2 parents 2826b7c + 4bd4653 commit ffc7767
Show file tree
Hide file tree
Showing 261 changed files with 3,218 additions and 3,025 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[alias]
# Temporary solution to have clippy config in a single place until https://github.com/rust-lang/rust-clippy/blob/master/doc/roadmap-2021.md#lintstoml-configuration is shipped.
custom-clippy = "clippy --workspace --all-features --all-targets -- -A clippy::type_complexity -A clippy::pedantic -W clippy::used_underscore_binding -D warnings"
custom-clippy = "clippy --workspace --all-features --all-targets -- -A clippy::type_complexity -A clippy::pedantic -W clippy::used_underscore_binding -W unreachable_pub -D warnings"
5 changes: 4 additions & 1 deletion .github/actions/cargo-semver-checks/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inputs:
runs:
using: "composite"
steps:
- run: wget -q -O- https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.19.0/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C ~/.cargo/bin
- run: wget -q -O- https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.20.0/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C ~/.cargo/bin
shell: bash

- name: Get released version
Expand All @@ -31,3 +31,6 @@ runs:
shell: bash
env:
CARGO_TERM_VERBOSE: "true"
# debugging https://github.com/libp2p/rust-libp2p/pull/3782#issuecomment-1523346255
CARGO_HTTP_DEBUG: "true"
CARGO_LOG: "cargo::ops::registry=debug"
8 changes: 8 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ pull_request_rules:
message: Approvals have been dismissed because the PR was updated after the `send-it` label was applied.
changes_requested: false

- name: Approve trivial maintainer PRs
conditions:
- base=master
- label=trivial
- author=@libp2p/rust-libp2p-maintainers
actions:
review:

queue_rules:
- name: default
conditions: []
42 changes: 4 additions & 38 deletions .github/workflows/cache-factory.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This workflow _produces_ caches which are used to speed up pull request builds.
# The caches are split by Rust version (stable vs MSRV per crate) because those caches cannot share any artifacts.
# This workflow _produces_ a cache that is used to speed up pull request builds.
#
# Our CI runs a job per crate, meaning all jobs share compilation artifacts but never the full cache.
# Thus, we make a single cache here that is used by all jobs and the jobs only read from this cache.

name: Cache factory

Expand All @@ -13,42 +15,6 @@ concurrency:
cancel-in-progress: true

jobs:
gather_msrv_versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.find-rust-versions.outputs.versions }}
steps:
- uses: actions/checkout@v3

- id: find-rust-versions
run: |
RUST_VERSIONS=$(cargo metadata --format-version=1 --no-deps | jq -c '.packages | map(.rust_version) | unique | del(..|nulls)')
echo "versions=${RUST_VERSIONS}" >> $GITHUB_OUTPUT
make_msrv_cache:
runs-on: ubuntu-latest
needs: gather_msrv_versions
strategy:
fail-fast: false
matrix:
rust: ${{ fromJSON(needs.gather_msrv_versions.outputs.versions) }}
steps:
- uses: actions/checkout@v3

- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1
with:
shared-key: msrv-cache

- name: Compile all crates which have MSRV ${{ matrix.rust }}
run: |
cargo metadata --format-version=1 --no-deps | \
jq -r '.packages[] | select(.rust_version == "${{ matrix.rust }}") | "+\(.rust_version) build --all-features --package \(.name)"' |
xargs --verbose -L 1 cargo
make_stable_rust_cache:
runs-on: ubuntu-latest
steps:
Expand Down
92 changes: 70 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,26 @@ env:
jobs:
test:
name: Test ${{ matrix.crate }}
runs-on: ubuntu-latest
runs-on: ${{ fromJSON(
github.repository == 'libp2p/rust-libp2p' && (
(contains(fromJSON('["libp2p-webrtc", "libp2p"]'), matrix.crate) && '["self-hosted", "linux", "x64", "2xlarge"]') ||
(contains(fromJSON('["libp2p-quic", "libp2p-perf"]'), matrix.crate) && '["self-hosted", "linux", "x64", "xlarge"]') ||
'["self-hosted", "linux", "x64", "large"]'
) || '"ubuntu-latest"') }}
timeout-minutes: 10
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
run: sudo apt-get install -y 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@master
with:
toolchain: ${{ steps.parse-msrv.outputs.version }}

- uses: r7kamura/rust-problem-matchers@d58b70c4a13c4866d96436315da451d8106f8f08 #v1.3.0

- uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1
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@stable

- uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1
Expand Down Expand Up @@ -81,6 +68,21 @@ jobs:
cargo metadata --format-version=1 --no-deps | \
jq -e -r '.packages[] | select(.name == "${{ matrix.crate }}") | .dependencies | all(.name != "libp2p")'
- uses: taiki-e/cache-cargo-install-action@7dd0cff2732612ac642812bcec4ada5a279239ed # v1
with:
tool: tomlq

- name: Enforce version in `workspace.dependencies` matches latest version
if: matrix.crate != 'libp2p'
run: |
PACKAGE_VERSION=$(cargo metadata --format-version=1 --no-deps | jq -e -r '.packages[] | select(.name == "${{ matrix.crate }}") | .version')
SPECIFIED_VERSION=$(tomlq 'workspace.dependencies.${{ matrix.crate }}.version' --file ./Cargo.toml)
echo "Package version: $PACKAGE_VERSION";
echo "Specified version: $SPECIFIED_VERSION";
test "$PACKAGE_VERSION" = "$SPECIFIED_VERSION"
cross:
name: Compile on ${{ matrix.target }}
strategy:
Expand Down Expand Up @@ -113,6 +115,30 @@ jobs:

- run: cargo check --package libp2p --all-features --target=${{ matrix.target }}

msrv:
name: Compile with MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Extract MSRV from workspace manifest
shell: bash
run: |
MSRV=$(grep -oP 'rust-version\s*=\s*"\K[^"]+' Cargo.toml)
echo "MSRV=$MSRV" >> $GITHUB_ENV
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.MSRV }}

- uses: r7kamura/rust-problem-matchers@d58b70c4a13c4866d96436315da451d8106f8f08 #v1.3.0

- uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1
with:
save-if: ${{ github.ref == 'refs/heads/master' }}

- run: cargo +$MSRV check --workspace --all-features

feature_matrix: # Test various feature combinations work correctly
name: Compile with select features (${{ matrix.features }})
runs-on: ubuntu-latest
Expand Down Expand Up @@ -158,7 +184,7 @@ jobs:
fail-fast: false
matrix:
rust-version: [
1.68.0, # current stable
1.69.0, # current stable
beta
]
steps:
Expand Down Expand Up @@ -195,6 +221,28 @@ jobs:
- name: Run ipfs-kad example
run: cd ./examples/ipfs-kad/ && RUST_LOG=libp2p_swarm=debug,libp2p_kad=trace,libp2p_tcp=debug cargo run

examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: dtolnay/rust-toolchain@stable

- uses: r7kamura/rust-problem-matchers@d58b70c4a13c4866d96436315da451d8106f8f08 #v1.3.0

- uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1
with:
shared-key: stable-cache
save-if: false

- name: Compile all examples
run: |
set -e;
for toml in examples/**/Cargo.toml; do
cargo check --manifest-path "$toml";
done
rustfmt:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/interop-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
jobs:
run-multidim-interop:
name: Run multidimensional interoperability tests
runs-on: ubuntu-22.04
runs-on: ${{ fromJSON(github.repository == 'libp2p/rust-libp2p' && '["self-hosted", "linux", "x64", "xlarge"]' || '"ubuntu-latest"') }}
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
Expand Down

0 comments on commit ffc7767

Please sign in to comment.