Compare commits

...
Author SHA1 Message Date
eigenein 8e96f4847b Break: make meta optional 2023-04-28 16:22:10 +02:00
8 changed files with 36 additions and 14 deletions

No files matched your search

+19 -7
View File
@@ -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:
+5 -5
View File
@@ -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
View File
@@ -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"] }
+1
View File
@@ -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),
}
+1
View File
@@ -4,4 +4,5 @@ mod meta;
pub use self::battle_results::*;
pub use self::battle_results_dat::*;
#[cfg(feature = "meta")]
pub use self::meta::*;
+2
View File
@@ -1,3 +1,5 @@
#![cfg(feature = "meta")]
use std::io::Read;
use serde::Deserialize;
+4 -1
View File
@@ -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
+2
View File
@@ -1,3 +1,5 @@
#![cfg(feature = "meta")]
use std::fs::File;
use anyhow::Result;