Compare commits
2 Commits
6f5dc4bcff
...
7b6041989e
Author | SHA1 | Date | |
---|---|---|---|
7b6041989e | |||
f77aea28d1 |
37
.github/workflows/build.yaml
vendored
Normal file
37
.github/workflows/build.yaml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Build
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "**.rs"
|
||||
- "Cargo.*"
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
errornowatcher:
|
||||
name: errornowatcher
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install build dependencies
|
||||
run: sudo apt install -y libluajit-5.1-dev mold
|
||||
|
||||
- name: Set up build cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: build-${{ runner.os }}-${{ hashFiles('Cargo.*') }}
|
||||
|
||||
- name: Switch to nightly toolchain
|
||||
run: rustup default nightly
|
||||
|
||||
- name: Build in release mode
|
||||
run: cargo build --release
|
68
.github/workflows/lint.yaml
vendored
Normal file
68
.github/workflows/lint.yaml
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
name: Lint
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "**.rs"
|
||||
- "Cargo.*"
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
cargo-toml:
|
||||
name: Cargo.toml
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install taplo
|
||||
uses: uncenter/setup-taplo@v1
|
||||
|
||||
- name: Run taplo lint
|
||||
run: taplo lint Cargo.toml
|
||||
|
||||
- name: Run taplo fmt
|
||||
if: always()
|
||||
run: taplo fmt --check Cargo.toml
|
||||
|
||||
rust:
|
||||
name: Rust
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install build dependencies
|
||||
run: sudo apt install -y libluajit-5.1-dev mold
|
||||
|
||||
- name: Set up build cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
target/
|
||||
key: build-${{ runner.os }}-${{ hashFiles('Cargo.*') }}
|
||||
|
||||
- name: Switch to nightly toolchain
|
||||
run: rustup default nightly
|
||||
|
||||
- name: Install components
|
||||
run: rustup component add clippy rustfmt
|
||||
|
||||
- name: cargo clippy
|
||||
run: >-
|
||||
cargo clippy -- -D clippy::pedantic
|
||||
-A clippy::missing_errors_doc
|
||||
-A clippy::missing_panics_doc
|
||||
-A clippy::must_use_candidate
|
||||
-A clippy::needless-pass-by-value
|
||||
-A clippy::unnecessary-wraps
|
||||
|
||||
- name: cargo fmt
|
||||
if: always()
|
||||
run: cargo fmt --check
|
@ -30,11 +30,7 @@ impl Plugin for RecordPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
fn record_login_packets(
|
||||
recorder: Option<ResMut<Recorder>>,
|
||||
mut events: EventReader<LoginPacketEvent>,
|
||||
) {
|
||||
if let Some(mut recorder) = recorder {
|
||||
fn record_login_packets(mut recorder: ResMut<Recorder>, mut events: EventReader<LoginPacketEvent>) {
|
||||
for event in events.read() {
|
||||
if recorder.should_ignore_compression
|
||||
&& let ClientboundLoginPacket::LoginCompression(_) = *event.packet
|
||||
@ -46,26 +42,21 @@ fn record_login_packets(
|
||||
error!("failed to record login packet: {error:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn record_configuration_packets(
|
||||
recorder: Option<ResMut<Recorder>>,
|
||||
mut recorder: ResMut<Recorder>,
|
||||
mut events: EventReader<ConfigurationEvent>,
|
||||
) {
|
||||
if let Some(mut recorder) = recorder {
|
||||
for event in events.read() {
|
||||
if let Err(error) = recorder.save_packet(&event.packet) {
|
||||
error!("failed to record configuration packet: {error:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn record_game_packets(recorder: Option<ResMut<Recorder>>, query: Query<&RawConnection>) {
|
||||
if let Some(mut recorder) = recorder
|
||||
&& let Ok(raw_conn) = query.get_single()
|
||||
{
|
||||
fn record_game_packets(mut recorder: ResMut<Recorder>, query: Query<&RawConnection>) {
|
||||
for raw_conn in query.iter() {
|
||||
let queue = raw_conn.incoming_packet_queue();
|
||||
for raw_packet in queue.lock().iter() {
|
||||
if let Err(error) = recorder.save_raw_packet(raw_packet) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user