mirror of
https://github.com/eigenein/wotbreplay-parser.git
synced 2026-10-21 02:17:02 +02:00
Break: make meta optional
This commit is contained in:
1 parent
14148c7410
commit
8e96f4847b
8 files changed
+36
-14
No files matched your search
@@ -20,37 +20,49 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: 📥 Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up the toolchain
|
||||
- name: ✨ Set up the toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Rust Cache
|
||||
- name: ⚡️ Rust Cache
|
||||
uses: Swatinem/rust-cache@v1
|
||||
with:
|
||||
cache-on-failure: true
|
||||
|
||||
- name: Test
|
||||
- name: 🧪 Test without optional features
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --doc
|
||||
args: --all-targets
|
||||
|
||||
- name: Clippy
|
||||
- name: 🧪 Test all features
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --all-targets --all-features
|
||||
|
||||
- name: 🧪 Test docs
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
args: --doc --all-features
|
||||
|
||||
- name: 🪄 Clippy
|
||||
uses: actions-rs/clippy-check@v1
|
||||
continue-on-error: true
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --all-targets --all-features --tests -- -D warnings
|
||||
|
||||
- name: Publish the crates (dry run)
|
||||
- name: 📤 Publish the crates (dry run)
|
||||
run: |
|
||||
cargo publish --allow-dirty --dry-run
|
||||
env:
|
||||
|
||||
@@ -15,12 +15,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
- name: 📥 Checkout the repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set the versions
|
||||
- name: 🪄 Set the versions
|
||||
run: |
|
||||
sed -i -e 's/version = "0\.0\.0"/version = "${{ github.ref_name }}"/g' Cargo.toml
|
||||
- name: Rustup
|
||||
@@ -29,13 +29,13 @@ jobs:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
|
||||
- name: Build the changelog
|
||||
- name: 📝 Build the changelog
|
||||
id: changelog
|
||||
uses: Bullrich/generate-release-changelog@master
|
||||
env:
|
||||
REPO: ${{ github.repository }}
|
||||
|
||||
- name: Update the release
|
||||
- name: 🪄 Update the release
|
||||
uses: tubone24/[email protected]
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
release_name: ${{ github.ref_name }}
|
||||
body: ${{ steps.changelog.outputs.changelog }}
|
||||
|
||||
- name: Publish the crates
|
||||
- name: 📤 Publish the crates
|
||||
run: |
|
||||
cargo publish --allow-dirty
|
||||
env:
|
||||
|
||||
+2
-1
@@ -12,13 +12,14 @@ categories = ["parsing"]
|
||||
|
||||
[features]
|
||||
default = []
|
||||
meta = ["dep:serde_json"]
|
||||
|
||||
[dependencies]
|
||||
prost = "0.11.3"
|
||||
serde = { version = "1.0.148", features = ["derive"] }
|
||||
serde_bytes = "0.11.7"
|
||||
serde-pickle = "1.1.1"
|
||||
serde_json = "1.0.96"
|
||||
serde_json = { version = "1.0.96", optional = true }
|
||||
thiserror = "1.0.37"
|
||||
zip = { version = "0.6.3", default-features = false, features = ["deflate"] }
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ pub enum Error {
|
||||
#[error("failed to un-pickle")]
|
||||
UnpickleFailed(#[source] serde_pickle::Error),
|
||||
|
||||
#[cfg(feature = "meta")]
|
||||
#[error("failed to decode JSON")]
|
||||
JsonDecodeFailed(#[source] serde_json::Error),
|
||||
}
|
||||
@@ -4,4 +4,5 @@ mod meta;
|
||||
|
||||
pub use self::battle_results::*;
|
||||
pub use self::battle_results_dat::*;
|
||||
#[cfg(feature = "meta")]
|
||||
pub use self::meta::*;
|
||||
@@ -1,3 +1,5 @@
|
||||
#![cfg(feature = "meta")]
|
||||
|
||||
use std::io::Read;
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
+4
-1
@@ -3,7 +3,9 @@ use std::io::{Read, Seek};
|
||||
use zip::ZipArchive;
|
||||
|
||||
use crate::error::Error;
|
||||
use crate::models::{BattleResults, BattleResultsDat, Meta};
|
||||
#[cfg(feature = "meta")]
|
||||
use crate::models::Meta;
|
||||
use crate::models::{BattleResults, BattleResultsDat};
|
||||
use crate::result::Result;
|
||||
|
||||
/// Opened (but not yet parsed) replay.
|
||||
@@ -31,6 +33,7 @@ impl<R: Read + Seek> Replay<R> {
|
||||
BattleResultsDat::from_reader(pickled_battle_results)
|
||||
}
|
||||
|
||||
#[cfg(feature = "meta")]
|
||||
pub fn read_meta(&mut self) -> Result<Meta> {
|
||||
Meta::from_reader(
|
||||
self.0
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![cfg(feature = "meta")]
|
||||
|
||||
use std::fs::File;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
Reference in new issue
Block a user