From 30477254e5bc5a4294071fef8c31cfaeb3e061bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Rom=C3=A1n=20N=C3=BA=C3=B1ez?= Date: Mon, 14 Sep 2026 12:02:24 +0000 Subject: [PATCH] Add build and test CI (#1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.eirexe.moe/EIREXE/shinespark/pulls/1 Co-authored-by: Álex Román Núñez --- .gitea/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++ src/fighter/baked_animation.rs | 17 ++++++++++--- 2 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..8555443 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +jobs: + build-and-test: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Check out source + uses: actions/checkout@v4 + + - name: Install Rust toolchain + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ + sh -s -- -y --profile minimal + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + "$HOME/.cargo/bin/rustup" toolchain install nightly --profile minimal + + - name: Install Linux dependencies + run: | + sudo apt-get update + sudo apt-get install --no-install-recommends -y \ + clang \ + libasound2-dev \ + libudev-dev \ + libusb-1.0-0-dev \ + libwayland-dev \ + libx11-dev \ + libxkbcommon-dev \ + libxkbcommon-x11-0 \ + mesa-vulkan-drivers \ + mold \ + pkg-config + + - name: Build + run: cargo build --locked -j 4 + + - name: Run unit tests + run: cargo test --locked --lib -j 4 diff --git a/src/fighter/baked_animation.rs b/src/fighter/baked_animation.rs index 12eeaab..887db06 100644 --- a/src/fighter/baked_animation.rs +++ b/src/fighter/baked_animation.rs @@ -660,6 +660,14 @@ fn bake_gltf( ) -> io::Result { let (document, buffers, _) = gltf::import_slice(bytes) .map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?; + bake_gltf_document(document, buffers, animations) +} + +fn bake_gltf_document( + document: gltf::Document, + buffers: Vec, + animations: &HashMap, +) -> io::Result { let nodes: Vec<_> = document.nodes().collect(); if nodes.is_empty() { return Err(io::Error::new( @@ -933,11 +941,12 @@ mod tests { fn configured_fighter_clips_bake_to_fixed_point_frames() { let manifest: FighterManifest = ron::from_str(include_str!("../../assets/fighters/test/test.fighter.ron")).unwrap(); - let baked = bake_gltf( - include_bytes!("../../assets/fighters/test/test-fighter-2.glb"), - &manifest.animations, - ) + let (document, buffers, _) = gltf::import(concat!( + env!("CARGO_MANIFEST_DIR"), + "/assets/fighters/test/test_fighter.gltf" + )) .unwrap(); + let baked = bake_gltf_document(document, buffers, &manifest.animations).unwrap(); assert_eq!(baked.frame_rate, BAKED_ANIMATION_FPS); assert_eq!(baked.frame_count(AnimKind::Wait), Some(121));