Add build and test CI
CI / build-and-test (pull_request) Failing after 5m59s

This commit is contained in:
2026-09-14 12:03:46 +02:00
parent 4861374aef
commit 9d786d1bd5
2 changed files with 55 additions and 4 deletions
+42
View File
@@ -0,0 +1,42 @@
name: CI
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
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 \
mold \
pkg-config
- name: Build
run: cargo build --locked
- name: Run unit tests
run: cargo test --locked --lib
+13 -4
View File
@@ -660,6 +660,14 @@ fn bake_gltf(
) -> io::Result<BakedFighterAnimations> { ) -> io::Result<BakedFighterAnimations> {
let (document, buffers, _) = gltf::import_slice(bytes) let (document, buffers, _) = gltf::import_slice(bytes)
.map_err(|error| io::Error::new(io::ErrorKind::InvalidData, error))?; .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<gltf::buffer::Data>,
animations: &HashMap<AnimKind, String>,
) -> io::Result<BakedFighterAnimations> {
let nodes: Vec<_> = document.nodes().collect(); let nodes: Vec<_> = document.nodes().collect();
if nodes.is_empty() { if nodes.is_empty() {
return Err(io::Error::new( return Err(io::Error::new(
@@ -933,11 +941,12 @@ mod tests {
fn configured_fighter_clips_bake_to_fixed_point_frames() { fn configured_fighter_clips_bake_to_fixed_point_frames() {
let manifest: FighterManifest = let manifest: FighterManifest =
ron::from_str(include_str!("../../assets/fighters/test/test.fighter.ron")).unwrap(); ron::from_str(include_str!("../../assets/fighters/test/test.fighter.ron")).unwrap();
let baked = bake_gltf( let (document, buffers, _) = gltf::import(concat!(
include_bytes!("../../assets/fighters/test/test-fighter-2.glb"), env!("CARGO_MANIFEST_DIR"),
&manifest.animations, "/assets/fighters/test/test_fighter.gltf"
) ))
.unwrap(); .unwrap();
let baked = bake_gltf_document(document, buffers, &manifest.animations).unwrap();
assert_eq!(baked.frame_rate, BAKED_ANIMATION_FPS); assert_eq!(baked.frame_rate, BAKED_ANIMATION_FPS);
assert_eq!(baked.frame_count(AnimKind::Wait), Some(121)); assert_eq!(baked.frame_count(AnimKind::Wait), Some(121));