105 Commits

Author SHA1 Message Date
Max Inden
7c73bc365a
ci(interop): Use run-interop-ping-test master latest hash (#3462)
With https://github.com/libp2p/test-plans/pull/121 merged, we should be able to use @master
directly. Still pointing to a concrete git hash.

This includes
6d1aed2ed5, thus
allowing interop tests to run from fork pull requests.
2023-02-14 18:33:37 +01:00
Thomas Eizinger
9247cfa878
feat(ci): pin Rust version for clippy job (#3445)
Always referencing the latest version of Rust for clippy creates problems during backporting as already fixed problems in master come up again during a backport.
2023-02-11 06:04:25 +00:00
Thomas Eizinger
43b6e2f8e5
fix(dependabot): avoid lockfile updates (#3434)
This is an attempt to _avoid_ lockfile-only updates now that we are tracking the `Cargo.lock` in Git.
2023-02-10 13:00:48 +00:00
Marco Munizaga
eeca244ca5
feat(interop-tests): build test binary inside container (#3441)
Building inside the container allows Windows and MacOS users to also build this binary. Thanks to a new feature from docker, `--mount=type=cache`, rebuilding layers is fast without any additional hacks.
2023-02-10 06:14:25 +00:00
Thomas Eizinger
351a166b39
feat: don't publish docker containers for interop-tests (#3437)
As per outcome of discussion here: https://github.com/libp2p/test-plans/pull/121#discussion_r1099109241
2023-02-08 19:27:39 +00:00
dependabot[bot]
0bffad98c0
deps: bump dtolnay/rust-toolchain (#3424) 2023-02-08 08:39:41 +00:00
Thomas Eizinger
696c644fef
feat(ci): use interop-tests action instead of workflow (#3414) 2023-02-06 00:48:53 +00:00
Elvis
babf7e3753
fix(ci): replace actions-rs/toolchain with dtolnay/toolchain (#3391)
This one seems it [got a blessing](https://github.com/rust-lang/regex/pull/883) from rust-lang.

Closes #3352.
2023-02-02 05:25:50 +00:00
Thomas Eizinger
3ec7c797e5
deps(ci): use v0.17.0 of cargo semver-checks (#3401) 2023-01-31 03:03:53 +00:00
dependabot[bot]
fb64c3dfdb
deps: bump docker/login-action from 1.10.0 to 2.1.0 (#3394) 2023-01-30 22:44:54 +00:00
Thomas Eizinger
1c596af1cf
feat: publish container images for interop-test binaries (#3383)
This patch adds a workflow that automatically publishes a docker image of our `ping` interop-test binaries on every release. Releases are different from Git tags. We publish a tag for each version of each crate but only a single release for each version of the `libp2p` crate.

Alternatively, this workflow can also be triggered manually:

![image](https://user-images.githubusercontent.com/5486389/214460448-d4fca593-d323-4476-956f-d180aadf8850.png)

1. Select the Git ref you want to run the workflow on. This should be the version of `libp2p` you want to publish the test binary for. For example, if you want to publish a version of the test binary for a hotfix release of a sub-crate, you would pick the respective tag of the hotfix release.
2. Choose the tag of the docker image.

To resolve https://github.com/libp2p/test-plans/issues/112, I am planning to create branches off current master that hardcodes the libp2p version in the test-binary to a particular one and then trigger this workflow for the respective branch.
2023-01-26 09:35:16 +00:00
Thomas Eizinger
c94aabf8f6
feat(inter-op): make Dockerfile generic over test binary (#3382)
We make the binary that should be copied into the container configurable via a build time `ARG`. This will allow us to reuse the same `Dockerfile` once we write more tests.
Additionally, this allows us to remove some of the directory switching and creation code. In order to not send the entire repository over to the docker daemon as a build context, we introduce a `.dockerignore` file that only allows select binary to be sent over.

The downside of this is that we need to extend this ignore file every time we add a new test. This shouldn't happen very often though and is easily discovered because the building of the docker container will fail.
2023-01-26 03:46:51 +00:00
Thomas Eizinger
43909fa9b0
feat(ci): use latest release of cargo semver-checks (#3380) 2023-01-25 21:16:01 +00:00
João Oliveira
62c0532de6
ci: Interop tests fixes and updates pending from #3331 (#3360) 2023-01-24 22:28:57 +00:00
Thomas Eizinger
687fba8b06
fix(ci): apply shorter timeout to cache download (#3376)
Sometimes, GitHub Actions gets stuck in downloading the cache. My hypothesis is that because we have so many jobs, some of them get rate-limited and end up failing the download.

Typically, GitHub Actions downloads with a speed of 100MB/s. With the maximum allowed cache size of 10GB, any cache download should not take longer than 100 seconds. With this patch, we set the timeout to 120 seconds for the continuous integration workflow.

Upon failure, the job will continue with a cache-miss which is nice because it means the workflow will continue and not fail.

More information here: https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout

Example workflows:

- https://github.com/libp2p/rust-libp2p/actions/runs/3992478158/jobs/6848975863
- https://github.com/libp2p/rust-libp2p/actions/runs/3992492999/jobs/6848989008
- https://github.com/libp2p/rust-libp2p/actions/runs/3992564680/jobs/6849012006
2023-01-24 14:29:23 +00:00
Thomas Eizinger
47fe699f5e
feat(ci): download cargo-semver-checks instead of building it (#3378)
This is much quicker to execute. To keep our CI reproducible, I opted to link to a specific version instead of the "latest" release. Updating to a new version is as easy as switching out the version number in the URL.
2023-01-24 13:59:10 +00:00
João Oliveira
a34411c528
ci: update interop workflow (#3331)
Addresses https://github.com/libp2p/test-plans/pull/99
2023-01-19 20:20:37 +00:00
Thomas Eizinger
29a77164f1
fix(ci): properly escape PR title (#3318)
Within double quoted strings, bash tries to evaluate everything within backticks as a command. The GitHub security guide recommends to use an intermediary environment variable instead: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable

See https://github.com/libp2p/rust-libp2p/actions/runs/3889880383/jobs/6638520274#step:3:11.
2023-01-17 22:13:09 +00:00
dependabot[bot]
ac6b78b2c9
deps: bump actions/stale from 6 to 7 (#3274) 2023-01-04 18:41:56 +00:00
Thomas Eizinger
68d0f882bd
ci: install protoc from repositories where possible (#3258)
With the addition of more CI jobs, we are constantly running into API limits on setting up protoc. For all jobs that run on ubuntu, we can install it from `apt` instead.

On ubuntu 22.04, which is what `ubuntu-latest` points to, this installs `protoc v3.12.4`.
2022-12-30 12:58:28 +00:00
Thomas Eizinger
72e52f43fc
ci: ensure PR titles are no longer than 72 characters (#3267)
GitHub wraps the titles of commits if they are longer than 72 characters. See fbd4192e2a for example.

There is a convention that titles should be no more than 50 characters: https://cbea.ms/git-commit/#limit-50
This however makes crafting the message quite difficult, esp. with our use of conventional commit messages, thus limiting it to 72 seems more reasonable as that is where tooling (.e.g GitHub) seems to "break".
2022-12-30 12:05:07 +00:00
Thomas Eizinger
7dae6502ed
ci: fix typo configuration of PR validation action (#3278) 2022-12-23 20:19:57 +00:00
Thomas Eizinger
65ec5454ae
ci(dependabot): disable automatic rebase of PRs (#3266)
Currently, we have dependabot configured to automatically rebase PRs as soon as the base branches changes. This however causes two problems:

1. It unnecessarily consumes CI resources because dependabot rebases all open dependency PRs at once upon every merge of a PR into `master`.
2. It does not interact well with our strategy of dismissing reviews on updates to the PR: https://github.com/libp2p/rust-libp2p/pull/3226#event-8074236930

Overall, the rebasing of dependency PRs is a way to fix merge conflicts and to ensure that CI still passes even on the latest version of the base branch. The latter is already ensured by our merge queue and the former can be triggered manually with `@dependabot rebase`, thus disabling automatic rebasing is the better configuration for our setup.
2022-12-22 15:07:13 +00:00
Thomas Eizinger
13a59a38d3
ci(caching): split caches by matrix variables (#3257)
Previously, some of the caches for these job runs were overlapping. By incorporating the relevant matrix variables into the cache key, every instance of this job gets its own cache.
2022-12-20 10:24:39 +00:00
dependabot[bot]
06aa694d0a
deps: Bump actions/upload-pages-artifact from 1.0.6 to 1.0.7 (#3259) 2022-12-20 03:57:26 +00:00
Thomas Eizinger
56398cbb8d
ci(cache): only save caches on master branch (#3249)
Previously, we would always save certain smaller caches like clippy etc on each PR. This still amounts to a lot of caches. With this patch, we conditionally only save them when the workflow is run on the master branch. This gives most pull requests a good base to work with to speed them up significantly without us keeping around a lot of caches and have GitHub invalidate them constantly.

On master, the condition evaluates to `true` which saves the cache: https://github.com/thomaseizinger/rust-libp2p/actions/runs/3699904381/jobs/6267774899#step:5:3
On pull-requests, the condition evaluates to `false` which skips saving it: https://github.com/thomaseizinger/rust-libp2p/actions/runs/3700055536/jobs/6268096357#step:4:3
2022-12-17 00:54:20 +00:00
Thomas Eizinger
e9d5a3014f
ci(cache): override rust version in cache factory for MSRV cache (#3248)
Previously, we forgot to override the default Rust version used to the newly installed one for the MSRV cache. This caused `swatinem/rust-cache` to compute the wrong cache key. See https://github.com/libp2p/rust-libp2p/actions/runs/3697491863/jobs/6262555434#step:5:21 for example.

This caused all pull-requests to not actually find this cache and rebuild everything from scratch: https://github.com/libp2p/rust-libp2p/actions/runs/3699757580/jobs/6267459677#step:6:21

With this patch, we are now considering the correct Rust version: https://github.com/thomaseizinger/rust-libp2p/actions/runs/3699821930/jobs/6267596081#step:5:21
2022-12-16 21:25:19 +00:00
Thomas Eizinger
5fe0dc44bd
ci(caching): make caching more effective (#3215)
Currently, we create a new cache for each workflow run for each crate. That ends up blowing the maximum allowed cache size of 10GB and GitHub deletes the least-recently used cache again. Effectively, this means we don't have any caching.

This patch introduces a cache factory workflow that only runs on master and always _saves_ a new cache. The CI workflow run for pull-requests on the other hand only restore these caches but don't save them.
2022-12-13 22:37:19 +00:00
Thomas Eizinger
868c3805b8
ci: enforce PR titles to follow the conventional commit specification (#3204)
As per decision in https://github.com/libp2p/rust-libp2p/pull/3083, we want to use the conventional commits in our repository. To make sure this actually happens, this patch adds a workflow that validates PR titles to follow this convention. Together with our mergify configuration, these PR titles end up being the commit message title when squash-merging a pull request.

Related: https://github.com/libp2p/rust-libp2p/pull/3083
Related: https://github.com/libp2p/github-mgmt/pull/93
2022-12-13 12:37:15 +00:00
Thomas Eizinger
cbf0a273cd
ci(mergify): dismiss approvals on push once send-it is applied (#3231)
Currently, a user can push code after it has been approved and the send-it label applied. We only want to merge code that we actually looked at. Use mergify to dismiss approvals in such circumstances.
2022-12-13 22:33:37 +11:00
Thomas Eizinger
d7363a53d3
fix: Remove circular dependencies across workspace (#3023)
Circular dependencies are problematic in several ways:

- They result in cognitive overhead for developers, in trying to figure out what depends on what.
- They present `cargo` with limits in what order the crates can be compiled in.
- They invalidate build caches unnecessarily thus forcing `cargo` to rebuild certain crates.
- They cause problems with tooling such as `release-please`.

To actually break the circular dependencies, this patch inlines the uses of `development_transport` in the examples and tests for all sub-crates. This is only meant to be a short-term fix until https://github.com/libp2p/rust-libp2p/issues/3111 and https://github.com/libp2p/rust-libp2p/pull/2888 are fixed.

To ensure we don't accidentally reintroduce this dependency, we add a basic CI that queries `cargo metadata` using `jq`.

Resolves https://github.com/libp2p/rust-libp2p/issues/3053.
Fixes https://github.com/libp2p/rust-libp2p/issues/3223.
Related: https://github.com/libp2p/rust-libp2p/pull/2918#discussion_r976514245
Related: https://github.com/googleapis/release-please/issues/1662
2022-12-12 20:58:01 +00:00
Piotr Galar
63ffc7fb0f
docs: update security policy with private vulnerability reports info (#3168)
This PR updates the security policy to encourage users to file security vulnerability reports through https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability

The private vulnerability reports will show up here: https://github.com/libp2p/rust-libp2p/security/advisories?state=triage
The maintainers will receive GitHub notification about new private vulnerability reports.
2022-12-12 14:17:05 +00:00
dependabot[bot]
2c8a41c256
build(deps): Bump actions/upload-pages-artifact from 1.0.4 to 1.0.6 (#3219) 2022-12-12 12:22:48 +00:00
Thomas Eizinger
1c2712c1bc
ci: fix path to interop test plan composition file (#3203) 2022-12-07 12:47:30 +01:00
Thomas Eizinger
4da65089f8
fix(ci): avoid rate limits on GitHub API by supplying auth token (#3199)
Supply token to protoc install.
2022-12-07 09:44:50 +01:00
Hannes
82a9e2cc74
feat: Host rustdoc of master on GitHub pages (#3126)
This PR hosts the documentation of the current master branch on GitHub Pages. The URL should be: https://libp2p.github.io/rust-libp2p
2022-12-02 15:40:35 +01:00
Max Inden
98336b7885
Revert "chore: Enforce conventional commit PR title" (#3165)
Revert "chore: Enforce conventional commit PR title (#3083)"

This reverts commit 611286be819b9bbca6acc793e420cafaea8eb0cd.
2022-11-24 21:26:33 +01:00
Thomas Eizinger
611286be81
chore: Enforce conventional commit PR title (#3083) 2022-11-23 20:32:27 +01:00
Predrag Gruevski
9b182778e1
chore(ci): Add --locked flag to cargo install step (#3129)
This PR tweaks the installation of `cargo-semver-checks` to make it use the `--locked` flag.

Installing binaries with their locked dependency versions makes it less likely that you might run into issues caused by bugs in dependency libraries, since your installed dependency versions match the versions used in the binary's own test environment.

This is a recommendation that applies to most Rust binary tools. For example, here's cargo-nextest recommending the same: https://nexte.st/book/installing-from-source.html#installing-from-cratesio
2022-11-20 21:48:24 +00:00
Thomas Eizinger
0c85839dab
.github/workflows: Refactor CI jobs (#3090)
We refactor our continuous integration workflow with the following goals in mind:

- Run as few jobs as possible
- Have the jobs finish as fast as possible
- Have the jobs redo as little work as possible

There are only so many jobs that GitHub Actions will run in parallel.
Thus, it makes sense to not create massive matrices but instead group
things together meaningfully.

The new `test` job will:

- Run once for each crate
- Ensure that the crate compiles on its specified MSRV
- Ensure that the tests pass
- Ensure that there are no semver violations

This is an improvement to before because we are running all of these
in parallel which speeds up execution and highlights more errors at
once. Previously, tests run later in the pipeline would not get run
at all until you make sure the "first" one passes.

We also previously did not verify the MSRV of each crate, making the
setting in the `Cargo.toml` rather pointless.

The new `cross` job supersedes the existing `wasm` job.

This is an improvement because we now also compile the crate for
windows and MacOS. Something that wasn't checked before.
We assume that checking MSRV and the tests under Linux is good enough.
Hence, this job only checks for compile-errors.

The new `feature_matrix` ensures we compile correctly with certain feature combinations.

`libp2p` exposes a fair few feature-flags. Some of the combinations
are worth checking independently. For the moment, this concerns only
the executor related transports together with the executor flags but
this list can easily be extended.

The new `clippy` job runs for `stable` and `beta` rust.

Clippy gets continuously extended with new lints. Up until now, we would only
learn about those as soon as a new version of Rust is released and CI would
run the new lints. This leads to unrelated failures in CI. Running clippy on with `beta`
Rust gives us a heads-up of 6 weeks before these lints land on stable.

Fixes #2951.
2022-11-18 11:04:16 +00:00
Thomas Eizinger
43fdfe27ea
chore(mergify): Don't ask dependabot to resolve conflicts (#3122) 2022-11-16 10:28:03 +11:00
Thomas Eizinger
cafa73444b
.github/: Use Description for commit message and add Notes (#3082) 2022-11-13 20:01:24 +01:00
dependabot[bot]
e1e6413fc0
build(deps): Bump Swatinem/rust-cache from 2.1.0 to 2.2.0 (#3104) 2022-11-10 12:14:17 +00:00
dependabot[bot]
313ed588fe
build(deps): Bump Swatinem/rust-cache from 2.0.1 to 2.1.0 (#3093) 2022-11-08 08:23:07 +00:00
Thomas Eizinger
95e27ece8e
.github: Add mergify configuration (#3026) 2022-11-03 12:25:12 +11:00
dependabot[bot]
a0adaf6a54
build(deps): Bump Swatinem/rust-cache from 2.0.0 to 2.0.1 (#3033)
* build(deps): Bump Swatinem/rust-cache from 2.0.0 to 2.0.1

Bumps [Swatinem/rust-cache](https://github.com/Swatinem/rust-cache) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/Swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](6720f05bc4...22c9328bcb)

---
updated-dependencies:
- dependency-name: Swatinem/rust-cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Apply suggestions from code review

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Max Inden <mail@max-inden.de>
2022-10-21 19:03:44 +01:00
Thomas Eizinger
981d586bfe
.github/workflows: Don't allow concurrent workflow runs (#3000) 2022-10-15 15:38:53 +11:00
Chad Nehemiah
3371d7ceab
.github/workflows: Enforce semver compliance with cargo semver-checks (#2647) 2022-10-12 20:42:44 +01:00
Thomas Eizinger
ba99464434
.github/workflows: Re-activate documentation of private items (#2990) 2022-10-09 21:30:53 +01:00
Thomas Eizinger
f359c2ce5c
.github/worksflows/ci: Fix bad use of bash (#2963) 2022-10-04 12:29:03 +01:00