Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: leverage cargo's workspace inheritance #3715

Merged
merged 36 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ce17725
Use workspace dependencies for workspace dependencies
thomaseizinger Mar 30, 2023
1131240
Adapt release guidelines
thomaseizinger Mar 30, 2023
557d1b4
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 3, 2023
c5420d6
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 3, 2023
46960a3
Fix missing version and left-over path dependencies
thomaseizinger Apr 3, 2023
a7a5d59
Bump MSRV to 1.64
thomaseizinger Apr 3, 2023
f2355c9
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 3, 2023
f053451
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 3, 2023
f1e67f9
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 4, 2023
d297f49
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 6, 2023
905d5aa
Apply clippy lints for new MSRV
thomaseizinger Apr 6, 2023
3450ec8
Update MSRV everywhere to 1.64
thomaseizinger Apr 6, 2023
8b9a90a
Update swarm dependency to `0.42.1`
thomaseizinger Apr 6, 2023
a7ef33f
Enforce latest version in workspace dependencies
thomaseizinger Apr 6, 2023
086e826
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 10, 2023
e93b2ca
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 10, 2023
166da4f
Point to latest version in workspace dependencies
thomaseizinger Apr 10, 2023
b5b0ff4
Skip workspace dependency check for `libp2p`
thomaseizinger Apr 10, 2023
a205828
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 11, 2023
a0dfd81
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 11, 2023
26473c5
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 11, 2023
b5267e4
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 14, 2023
e622f5d
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 15, 2023
d0febf9
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger Apr 28, 2023
a53d60c
Merge branch 'master' into chore/workspace-dependencies
mxinden May 1, 2023
e54345e
Merge branch 'master' into chore/workspace-dependencies
thomaseizinger May 1, 2023
2c7930a
Update cargo.lock
thomaseizinger May 1, 2023
34f5095
Remove unused package keys
thomaseizinger May 1, 2023
0a92fda
Rework MSRV
thomaseizinger May 1, 2023
fdf586f
Bump versions to latest
thomaseizinger May 1, 2023
8568952
Fix MSRV job
thomaseizinger May 1, 2023
a49d2e5
Bump MSRV to 1.65
thomaseizinger May 1, 2023
e295321
Add changelog entries for version bump
thomaseizinger May 1, 2023
a12cd5d
Bump versions
thomaseizinger May 1, 2023
e718754
Set MSRV to 0.1.0 for interop-tests
thomaseizinger May 1, 2023
497f285
Merge branch 'master' into chore/workspace-dependencies
mergify[bot] May 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
61 changes: 39 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,10 @@ jobs:
- name: Install Protoc
run: sudo apt-get install -y protobuf-compiler

- uses: dtolnay/rust-toolchain@stable

- 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
shell: bash

- 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 @@ -90,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 @@ -122,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
Loading