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 runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: 📥 Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up the toolchain - name: ✨ Set up the toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
components: rustfmt, clippy components: rustfmt, clippy
- name: Rust Cache - name: ⚡️ Rust Cache
uses: Swatinem/rust-cache@v1 uses: Swatinem/rust-cache@v1
with: with:
cache-on-failure: true cache-on-failure: true
- name: Test - name: 🧪 Test without optional features
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
with: with:
command: test 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 uses: actions-rs/clippy-check@v1
continue-on-error: true continue-on-error: true
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features --tests -- -D warnings args: --all-targets --all-features --tests -- -D warnings
- name: Publish the crates (dry run) - name: 📤 Publish the crates (dry run)
run: | run: |
cargo publish --allow-dirty --dry-run cargo publish --allow-dirty --dry-run
env: env:
+5 -5
View File
@@ -15,12 +15,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout the repository - name: 📥 Checkout the repository
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set the versions - name: 🪄 Set the versions
run: | run: |
sed -i -e 's/version = "0\.0\.0"/version = "${{ github.ref_name }}"/g' Cargo.toml sed -i -e 's/version = "0\.0\.0"/version = "${{ github.ref_name }}"/g' Cargo.toml
- name: Rustup - name: Rustup
@@ -29,13 +29,13 @@ jobs:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- name: Build the changelog - name: 📝 Build the changelog
id: changelog id: changelog
uses: Bullrich/generate-release-changelog@master uses: Bullrich/generate-release-changelog@master
env: env:
REPO: ${{ github.repository }} REPO: ${{ github.repository }}
- name: Update the release - name: 🪄 Update the release
uses: tubone24/[email protected] uses: tubone24/[email protected]
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -43,7 +43,7 @@ jobs:
release_name: ${{ github.ref_name }} release_name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changelog }} body: ${{ steps.changelog.outputs.changelog }}
- name: Publish the crates - name: 📤 Publish the crates
run: | run: |
cargo publish --allow-dirty cargo publish --allow-dirty
env: env:
+2 -1
View File
@@ -12,13 +12,14 @@ categories = ["parsing"]
[features] [features]
default = [] default = []
meta = ["dep:serde_json"]
[dependencies] [dependencies]
prost = "0.11.3" prost = "0.11.3"
serde = { version = "1.0.148", features = ["derive"] } serde = { version = "1.0.148", features = ["derive"] }
serde_bytes = "0.11.7" serde_bytes = "0.11.7"
serde-pickle = "1.1.1" serde-pickle = "1.1.1"
serde_json = "1.0.96" serde_json = { version = "1.0.96", optional = true }
thiserror = "1.0.37" thiserror = "1.0.37"
zip = { version = "0.6.3", default-features = false, features = ["deflate"] } 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")] #[error("failed to un-pickle")]
UnpickleFailed(#[source] serde_pickle::Error), UnpickleFailed(#[source] serde_pickle::Error),
#[cfg(feature = "meta")]
#[error("failed to decode JSON")] #[error("failed to decode JSON")]
JsonDecodeFailed(#[source] serde_json::Error), JsonDecodeFailed(#[source] serde_json::Error),
} }
+1
View File
@@ -4,4 +4,5 @@ mod meta;
pub use self::battle_results::*; pub use self::battle_results::*;
pub use self::battle_results_dat::*; pub use self::battle_results_dat::*;
#[cfg(feature = "meta")]
pub use self::meta::*; pub use self::meta::*;
+2
View File
@@ -1,3 +1,5 @@
#![cfg(feature = "meta")]
use std::io::Read; use std::io::Read;
use serde::Deserialize; use serde::Deserialize;
+4 -1
View File
@@ -3,7 +3,9 @@ use std::io::{Read, Seek};
use zip::ZipArchive; use zip::ZipArchive;
use crate::error::Error; 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; use crate::result::Result;
/// Opened (but not yet parsed) replay. /// Opened (but not yet parsed) replay.
@@ -31,6 +33,7 @@ impl<R: Read + Seek> Replay<R> {
BattleResultsDat::from_reader(pickled_battle_results) BattleResultsDat::from_reader(pickled_battle_results)
} }
#[cfg(feature = "meta")]
pub fn read_meta(&mut self) -> Result<Meta> { pub fn read_meta(&mut self) -> Result<Meta> {
Meta::from_reader( Meta::from_reader(
self.0 self.0
+2
View File
@@ -1,3 +1,5 @@
#![cfg(feature = "meta")]
use std::fs::File; use std::fs::File;
use anyhow::Result; use anyhow::Result;