Skip to content

Commit 086d70b

Browse files
committed
Release v0.3.0
2 parents 717289b + a23d64f commit 086d70b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+6498
-2233
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
artifacts:
9+
# Group upload/download artifact updates, the versions are dependent
10+
patterns:
11+
- "actions/*-artifact"
12+
13+
- package-ecosystem: "cargo"
14+
directory: "/"
15+
schedule:
16+
interval: "monthly"

.github/workflows/benchmarks.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Benchmarks (CodSpeed)
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
benchmarks:
12+
name: Run benchmarks
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Setup rust toolchain, cache and cargo-codspeed binary
17+
uses: moonrepo/setup-rust@v1
18+
with:
19+
channel: stable
20+
cache-target: release
21+
bins: cargo-codspeed
22+
23+
- name: Build the benchmark target(s)
24+
run: cargo codspeed build --features serde
25+
26+
- name: Run the benchmarks
27+
uses: CodSpeedHQ/action@v3
28+
with:
29+
run: cargo codspeed run

.github/workflows/cargo_publish_dry_run.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name: Check crate publishing works
44
on:
55
pull_request:
66
branches: [ release ]
7+
workflow_dispatch:
78

89
env:
910
CARGO_TERM_COLOR: always
@@ -13,28 +14,14 @@ jobs:
1314
name: Publishing works
1415
runs-on: ubuntu-latest
1516
steps:
16-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1718
- name: Install stable Rust
18-
uses: actions-rs/toolchain@v1
19-
with:
20-
toolchain: stable
21-
profile: minimal
19+
uses: dtolnay/rust-toolchain@stable
2220

2321
- name: Get Cargo version
2422
id: cargo_version
2523
run: echo "::set-output name=version::$(cargo -V | tr -d ' ')"
2624
shell: bash
2725

28-
- name: Download cache
29-
uses: actions/cache@v2
30-
with:
31-
path: |
32-
~/.cargo/registry/index/
33-
~/.cargo/registry/cache/
34-
~/.cargo/git/db/
35-
target/
36-
key: ${{ runner.os }}-${{ steps.cargo_version.outputs.version }}-${{ hashFiles('Cargo.toml') }}
37-
restore-keys: ${{ runner.os }}-${{ steps.cargo_version.outputs.version }}
38-
3926
- name: Run `cargo publish --dry-run`
4027
run: cargo publish --dry-run

.github/workflows/ci.yml

Lines changed: 25 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: CI
22
on:
33
pull_request:
4+
merge_group:
45
push:
56
branches: [ release, dev ]
67
schedule: [ cron: "0 6 * * 4" ]
@@ -10,104 +11,54 @@ env:
1011

1112
jobs:
1213
test:
13-
name: Tests pass
14+
name: Tests
1415
runs-on: ubuntu-latest
1516
steps:
16-
- uses: actions/checkout@v2
17-
- name: Install stable Rust
18-
uses: actions-rs/toolchain@v1
19-
with:
20-
toolchain: stable
21-
profile: minimal
22-
23-
- name: Get Cargo version
24-
id: cargo_version
25-
run: echo "::set-output name=version::$(cargo -V | tr -d ' ')"
26-
shell: bash
27-
28-
- name: Download cache
29-
uses: actions/cache@v2
30-
with:
31-
path: |
32-
~/.cargo/registry/index/
33-
~/.cargo/registry/cache/
34-
~/.cargo/git/db/
35-
target/
36-
key: ${{ runner.os }}-${{ steps.cargo_version.outputs.version }}-${{ hashFiles('Cargo.toml') }}
37-
restore-keys: ${{ runner.os }}-${{ steps.cargo_version.outputs.version }}
38-
39-
- name: Build
40-
run: cargo build --verbose
41-
42-
- name: Run tests
43-
run: cargo test --features=serde --verbose
17+
- uses: actions/checkout@v4
18+
- uses: dtolnay/rust-toolchain@stable
19+
- run: cargo build --workspace
20+
- run: cargo test --all-features --workspace
4421

4522
clippy:
46-
name: No warnings from Clippy
23+
name: Clippy
4724
runs-on: ubuntu-latest
4825
steps:
49-
- uses: actions/checkout@v2
50-
- name: Install stable Rust
51-
uses: actions-rs/toolchain@v1
26+
- uses: actions/checkout@v4
27+
- uses: dtolnay/rust-toolchain@stable
5228
with:
53-
toolchain: stable
54-
profile: minimal
5529
components: clippy
56-
5730
- name: Check Clippy lints
5831
env:
5932
RUSTFLAGS: -D warnings
60-
run: cargo clippy
33+
run: cargo clippy --workspace
6134

6235
check_formatting:
63-
name: Source code is formatted
36+
name: Formatting
6437
runs-on: ubuntu-latest
6538
steps:
66-
- uses: actions/checkout@v2
67-
- name: Install stable Rust
68-
uses: actions-rs/toolchain@v1
39+
- uses: actions/checkout@v4
40+
- uses: dtolnay/rust-toolchain@stable
6941
with:
70-
toolchain: stable
71-
profile: minimal
7242
components: rustfmt
73-
74-
- name: Check formatting
75-
run: cargo fmt --all -- --check
43+
- run: cargo fmt --all -- --check
7644

7745
check_documentation:
78-
name: Documentation builds successfully
46+
name: Docs
7947
runs-on: ubuntu-latest
8048
steps:
81-
- uses: actions/checkout@v2
82-
- name: Install nightly Rust
83-
uses: actions-rs/toolchain@v1
84-
with:
85-
toolchain: nightly
86-
profile: minimal
87-
88-
- name: Download cache
89-
uses: actions/cache@v2
90-
with:
91-
path: |
92-
~/.cargo/registry/index/
93-
~/.cargo/registry/cache/
94-
~/.cargo/git/db/
95-
target/
96-
key: documentation
97-
49+
- uses: actions/checkout@v4
50+
- uses: dtolnay/rust-toolchain@stable
9851
- name: Check documentation
9952
env:
10053
RUSTDOCFLAGS: -D warnings
101-
run: cargo +nightly doc --no-deps --document-private-items
54+
run: cargo doc --workspace --no-deps --document-private-items
10255

103-
check_commit_conventions:
104-
name: Commit messages follow project guidelines
56+
minimal-versions:
57+
name: Minimal versions
10558
runs-on: ubuntu-latest
10659
steps:
107-
- uses: actions/checkout@v2
108-
with:
109-
fetch-depth: 0
110-
- name: Check commit conventions
111-
uses: wagoid/commitlint-github-action@v2
112-
with:
113-
configFile: .commitlintrc.yml
60+
- uses: actions/checkout@v4
61+
- uses: dtolnay/rust-toolchain@nightly
62+
- run: cargo +nightly update -Zminimal-versions
63+
- run: cargo +nightly build --workspace
64+
- run: cargo +nightly test --all-features --workspace

.github/workflows/deploy_documentation.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name: Deploy documentation
44
on:
55
push:
66
branches: [ dev ]
7+
workflow_dispatch:
78

89
env:
910
CARGO_TERM_COLOR: always
@@ -12,28 +13,15 @@ jobs:
1213
deploy_documentation:
1314
runs-on: ubuntu-latest
1415
steps:
15-
- uses: actions/checkout@v2
16-
- name: Install nightly
17-
uses: actions-rs/toolchain@v1
18-
with:
19-
toolchain: nightly
20-
profile: minimal
21-
22-
- name: Download cache
23-
uses: actions/cache@v2
24-
with:
25-
path: |
26-
~/.cargo/registry/index/
27-
~/.cargo/registry/cache/
28-
~/.cargo/git/db/
29-
target/
30-
key: documentation
16+
- uses: actions/checkout@v4
17+
- uses: dtolnay/rust-toolchain@stable
3118

3219
- name: Build documentation
33-
run: cargo +nightly doc --no-deps
20+
run: cargo doc --no-deps
3421

3522
- name: Deploy documentation
36-
uses: peaceiris/actions-gh-pages@v3
23+
if: ${{ github.event_name == 'branches' }}
24+
uses: peaceiris/actions-gh-pages@v4
3725
with:
3826
github_token: ${{ secrets.GITHUB_TOKEN }}
3927
publish_dir: ./target/doc

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/target
2-
Cargo.lock
2+

CHANGELOG.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,57 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## Unreleased [(diff)][unreleased-diff]
5+
## [0.3.0] - 2025-02-12 - [(diff with 0.2.1)][0.2.1-diff]
6+
7+
PubGrub 0.3 has a more flexible interface and speeds resolution significantly. The public API is very different now, we
8+
recommend starting the migration by implementing the new `DependencyProvider` interface following the
9+
[Guide](https://pubgrub-rs.github.io/pubgrub/pubgrub/).
10+
11+
All public interfaces are now in the root of the crate.
12+
13+
In the main interface, `DependencyProvider`, `choose_package_version` was split into two methods: `prioritize`
14+
for choosing which package to decide next by assigning a priority to each package, and `choose_version`. The generic
15+
parameters became associated types. The version set is configurable by an associated type.
16+
17+
`Dependencies` gained a generic parameter for custom incompatibility type outside version conflicts, such as packages
18+
not available for the current platform or permission errors. This type is on `DependencyProvider` as
19+
`DependencyProvider::M`.
20+
21+
`pubgrub::range::Range` now lives in its own crate as [`version_ranges::Ranges`](https://docs.rs/version-ranges/0.1/version_ranges/struct.Ranges.html). A `Version` can be almost any
22+
ordered type now, it only needs to support set operations through `VersionSet`.
23+
24+
At a glance, this is the new `DependencyProvider` interface:
25+
26+
```rust
27+
pub trait DependencyProvider {
28+
type P: Package;
29+
type V: Debug + Display + Clone + Ord;
30+
type VS: VersionSet<V = Self::V>;
31+
type M: Eq + Clone + Debug + Display;
32+
type Priority: Ord + Clone;
33+
type Err: Error + 'static;
34+
35+
fn prioritize(
36+
&self,
37+
package: &Self::P,
38+
range: &Self::VS,
39+
package_conflicts_counts: &PackageResolutionStatistics,
40+
) -> Self::Priority;
41+
42+
fn choose_version(
43+
&self,
44+
package: &Self::P,
45+
range: &Self::VS,
46+
) -> Result<Option<Self::V>, Self::Err>;
47+
48+
fn get_dependencies(
49+
&self,
50+
package: &Self::P,
51+
version: &Self::V,
52+
) -> Result<Dependencies<Self::P, Self::VS, Self::M>, Self::Err>;
53+
54+
}
55+
```
656

757
## [0.2.1] - 2021-06-30 - [(diff with 0.2.0)][0.2.0-diff]
858

@@ -48,7 +98,7 @@ The gist of it is:
4898

4999
#### Added
50100

51-
- Links to code items in the code documenation.
101+
- Links to code items in the code documentation.
52102
- New `"serde"` feature that allows serializing some library types, useful for making simple reproducible bug reports.
53103
- New variants for `error::PubGrubError` which are `DependencyOnTheEmptySet`,
54104
`SelfDependency`, `ErrorChoosingPackageVersion` and `ErrorInShouldCancel`.
@@ -161,10 +211,12 @@ The gist of it is:
161211
- `.gitignore` configured for a Rust project.
162212
- `.github/workflows/` CI to automatically build, test and document on push and pull requests.
163213

214+
[0.3.0]: https://github.com/pubgrub-rs/pubgrub/releases/tag/v0.3.0
164215
[0.2.1]: https://github.com/pubgrub-rs/pubgrub/releases/tag/v0.2.1
165216
[0.2.0]: https://github.com/pubgrub-rs/pubgrub/releases/tag/v0.2.0
166217
[0.1.0]: https://github.com/pubgrub-rs/pubgrub/releases/tag/v0.1.0
167218

168219
[unreleased-diff]: https://github.com/pubgrub-rs/pubgrub/compare/release...dev
220+
[0.2.1-diff]: https://github.com/pubgrub-rs/pubgrub/compare/v0.2.1...v0.3.0
169221
[0.2.0-diff]: https://github.com/pubgrub-rs/pubgrub/compare/v0.2.0...v0.2.1
170222
[0.1.0-diff]: https://github.com/pubgrub-rs/pubgrub/compare/v0.1.0...v0.2.0

0 commit comments

Comments
 (0)