Skip to content

Commit

Permalink
Merge branch 'lazer'
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxOhn committed Jul 10, 2024
2 parents 39ca56f + 210a03d commit 9e76879
Show file tree
Hide file tree
Showing 48 changed files with 3,674 additions and 3,631 deletions.
32 changes: 32 additions & 0 deletions .github/rust.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"problemMatcher": [
{
"owner": "rust-common",
"pattern": [
{
"regexp": "^(warning|warn|error)(\\[(.*)\\])?: (.*)$",
"severity": 1,
"message": 4,
"code": 3
},
{
"regexp": "^([\\s->=]*(.*):(\\d*):(\\d*)|.*)$",
"file": 2,
"line": 3,
"column": 4
}
]
},
{
"owner": "cargo-fmt",
"pattern": [
{
"regexp": "^(Diff in (\\S+)) at line (\\d+):",
"message": 1,
"file": 2,
"line": 3
}
]
}
]
}
153 changes: 153 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
name: Checks

on:
push:
branches:
- main
- next
- lazer
pull_request:

jobs:
build-docs:
name: Build docs
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Build docs
env:
RUSTDOCFLAGS: --cfg docsrs
run: cargo doc --no-deps --all-features

clippy:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- kind: default-features
features: default
- kind: full-features
features: cache,macros,metrics,replay,serialize,local_oauth

steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Add problem matchers
run: echo "::add-matcher::.github/rust.json"

- name: Run clippy
run: cargo clippy --features ${{ matrix.features }} --all-targets

rustfmt:
name: Format
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@v1
with:
components: rustfmt
toolchain: nightly

- name: Add problem matchers
run: echo "::add-matcher::.github/rust.json"

- name: Check code formatting
run: cargo fmt -- --check

feature-combinations:
name: Feature combinations
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Add problem matchers
run: echo "::add-matcher::.github/rust.json"

- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack

- name: Check feature-combinations
run: >
cargo hack check
--feature-powerset --no-dev-deps
--optional-deps metrics
--group-features default,cache,macros,local_oauth,deny_unknown_fields
readme:
name: Readme
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Check if README is up to date
run: |
cargo install cargo-rdme
cargo rdme --check
test:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Add problem matchers
run: echo "::add-matcher::.github/rust.json"

- name: Install nextest
uses: taiki-e/install-action@nextest

- name: Run tests with nextest
run: >
cargo nextest run
--all-features
--no-fail-fast
--failure-output "immediate-final"
--filter-expr 'not binary(requests)'
- name: Run doctests
run: cargo test --doc --all-features
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/target
.env
/Cargo.lock
/.idea
output.txt
Cargo.lock
output.*
expanded.*
/tests/custom.rs
51 changes: 46 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,43 @@
## Upcoming
# v0.9.0 (2024-07-10)

Nothing as of now
- __Breaking:__
- All mods types are now re-exports from [`rosu-mods`](https://github.com/MaxOhn/rosu-mods) ([#28])
- `User`, `Beatmap`, and `Beatmapset` have been renamed to `UserExtended`, `BeatmapExtended`, and `BeatmapsetExtended`;
`UserCompact`, `BeatmapCompact`, and `BeatmapsetCompact` have been renamed to `User`, `Beatmap`, and `Beatmapset`
- The fields `FailTimes::fail` and `FailTimes::exit` are now of type `Option<Box<[u32; 100]>>` instead of `Option<Vec<u32>>`
- Metrics are now recorded using the [`metrics`](https://github.com/metrics-rs/metrics/tree/main/metrics) crate instead of prometheus directly.
That means they're no longer exposed through a method, but are recorded in the global metrics registry instead.
You can install a global metrics registry e.g. through the [metrics-exporter-prometheus](https://github.com/metrics-rs/metrics/tree/main/metrics-exporter-prometheus) crate.
- Most fields of (optional) `User(Extended)`, `Beatmap(Extended)`, and `Beatmapset(Extended)` are now wrapped in a `Box`. ([#11])
- The field `Medal::instructions` is now a `Option<String>` instead of `String` ([#12] - [@natsukagami])
- Removed the method `GetBeatmapsetSearch::any_status` and instead the method `status` now takes an `Option<RankStatus>`; `None` means "any". Also renamed the variant `BeatmapsetSearchSort::RankedDate` to `ApprovedDate` and added the variants `Creator`, `Nominations`, and `LastUpdate`. ([#18])
- Renamed the struct `RecentEvent` to `Event` and the method `Osu::recent_events` to `recent_activity`. Also added the method `Osu::events`. ([#19])
- Removed the `Cursor` type. The osu!api now uses encoded strings as cursor value. ([#20])
- The methods `Osu::{replay, replay_raw, score}` no longer take a `GameMode` as argument. Instead, their builders now have a `mode` method which allows setting a mode optionally. ([#24] - [@natsukagami])
- Removed the `rkyv` feature ([#27])
- Added fields:
- `Beatmap::mapset_id`
- `Score::classic_score`
- `UserExtended::statistics_modes`
- Removed the field `BeatmapsetNominations::required` and added `BeatmapsetNominations::{eligible_main_rulesets, required_meta}`.

- __Fixes:__
- Fixed deserializing `FailTimes` for `Beatmap` and `BeatmapExtended`

- __Additions:__
- The endpoint `Osu::users` is now usable without deprecation warning to retrieve up to 50 users at once. ([#16])
- Endpoints to retrieve scores now provide a `legacy_scores` method to request score data in its legacy format. ([#14])
- Endpoints to retrieve scores now provide a `legacy_only` method to only request non-lazer scores. ([#21])
- Added the feature `local_oauth` to add the method `OsuBuilder::with_local_authorization` to perform the whole OAuth process locally. ([#29])

# v0.8.0 (2023-06-27)
## v0.8.0 (2023-06-27)

- __Breaking:__
- Added the field `map_id` to `Score`
- Added the fields `description` and `permanent` to `AccountHistory`
- Added the variant `TournamentBan` to `HistoryType`
- Added the variant `TagsEdit` to `BeatmapsetEvent`
- Types no longer implement `serde::Serialize` unless the `serialize` feature is specified
- Types no longer implement `serde::Serialize` unless the `serialize` feature is specified ([#4])
- Replaced the method `GetBeatmapScores::score_type` with `GetBeatmapScores::global` and `GetBeatmapScores::country`

- __Fixes:__
Expand Down Expand Up @@ -153,8 +181,21 @@ Nothing as of now

[@Jeglerjeg]: https://github.com/Jeglerjeg
[@mezo]: https://github.com/mezodev0
[@natsukagami]: https://github.com/natsukagami

[#1]: https://github.com/MaxOhn/rosu-v2/pull/1
[#2]: https://github.com/MaxOhn/rosu-v2/pull/2
[#3]: https://github.com/MaxOhn/rosu-v2/pull/3
[#4]: https://github.com/MaxOhn/rosu-v2/pull/4
[#4]: https://github.com/MaxOhn/rosu-v2/pull/4
[#11]: https://github.com/MaxOhn/rosu-v2/pull/11
[#12]: https://github.com/MaxOhn/rosu-v2/pull/12
[#14]: https://github.com/MaxOhn/rosu-v2/pull/14
[#16]: https://github.com/MaxOhn/rosu-v2/pull/16
[#18]: https://github.com/MaxOhn/rosu-v2/pull/18
[#19]: https://github.com/MaxOhn/rosu-v2/pull/19
[#20]: https://github.com/MaxOhn/rosu-v2/pull/20
[#21]: https://github.com/MaxOhn/rosu-v2/pull/21
[#24]: https://github.com/MaxOhn/rosu-v2/pull/24
[#27]: https://github.com/MaxOhn/rosu-v2/pull/27
[#28]: https://github.com/MaxOhn/rosu-v2/pull/28
[#29]: https://github.com/MaxOhn/rosu-v2/pull/29
46 changes: 28 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,53 +1,63 @@
[package]
name = "rosu-v2"
version = "0.8.0"
authors = ["MaxOhn <[email protected]>"]
edition = "2018"
version = "0.9.0"
description = "An osu! API v2 wrapper"
license = "MIT"
readme = "README.md"
keywords = ["osu", "api", "wrapper"]
repository = "https://github.com/MaxOhn/rosu-v2"
documentation = "https://docs.rs/rosu-v2/"
authors = ["MaxOhn <[email protected]>"]
edition = "2021"
license = "MIT"

# --- Features ---

[features]
default = ["cache"]
serialize = []
default = ["cache", "macros"]
cache = ["dashmap"]
metrics = ["prometheus"]
macros = ["rosu-mods/macros"]
replay = ["osu-db"]
serialize = []
local_oauth = ["tokio/net"]
deny_unknown_fields = []

# --- Dependencies ---

[dependencies]
bitflags = { version = "1.0", default-features = false }
bytes = { version = "1.0", default-features = false }
futures = { version = "0.3", default-features = false }
leaky-bucket-lite = { version = "0.5" }
log = { version = "0.4", default-features = false }
hyper = { version = "0.14", default-features = false, features = ["client"] }
hyper-rustls = { version = "0.23", default-features = false, features = ["http1", "http2", "native-tokio"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = { version = "1.0", default-features = false, features = ["std"] }
smallstr = { version = "0.2", features = ["serde"] }
hyper-rustls = { version = "0.24.1", default-features = false, features = ["http1", "http2", "native-tokio"] }
itoa = { version = "1.0.9" }
rosu-mods = { version = "0.1.0", features = ["serde"] }
serde = { version = "1.0.203", default-features = false, features = ["derive"] }
serde_json = { version = "1.0", default-features = false, features = ["std", "raw_value"] }
serde_urlencoded = { version = "0.7.1" }
smallstr = { version = "0.3.0", features = ["serde"] }
thiserror = { version = "1.0" }
time = { version = "0.3", features = ["formatting", "parsing"] }
tokio = { version = "1.0", default-features = false, features = ["macros"] }
tracing = { version = "0.1.40", default-features = false }
url = { version = "2.0", default-features = false }

# --- Feature dependencies ---

dashmap = { version = "5.1", default-features = false, optional = true }
dashmap = { version = "6.0.1", default-features = false, optional = true }
osu-db = { version = "0.3.0", optional = true }
prometheus = { version = "0.13", optional = true }
rkyv = { version = "0.7", optional = true }
metrics = { version = "0.23.0", optional = true }

# --- Dev dependencies ---

[dev-dependencies]
dotenv = { version = "0.15" }
env_logger = { version = "0.9" }
dotenvy = { version = "0.15" }
eyre = { version = "0.6" }
once_cell = { version = "1.7" }
tokio = { version = "1.0", default-features = false, features = ["rt", "macros"] }
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["env-filter", "fmt", "smallvec"] }

# --- Metadata ---

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
Loading

0 comments on commit 9e76879

Please sign in to comment.