From 9a9051f044fef9f39c409ed1db070f2ce9834dae Mon Sep 17 00:00:00 2001 From: keith Date: Fri, 6 Mar 2020 21:16:25 -0800 Subject: [PATCH] add tests to ci build --- .github/workflows/{rust.yml => build.yml} | 12 +++++++++--- src/renderer/caching_shaper.rs | 7 ++++++- 2 files changed, 15 insertions(+), 4 deletions(-) rename .github/workflows/{rust.yml => build.yml} (91%) diff --git a/.github/workflows/rust.yml b/.github/workflows/build.yml similarity index 91% rename from .github/workflows/rust.yml rename to .github/workflows/build.yml index 01229b0..c0de399 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Rust +name: Build-and-Test on: [push] @@ -10,7 +10,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build - run: cargo build --release + run: | + cargo test + cargo build --release - uses: actions/upload-artifact@v1 with: name: neovide-windows.exe @@ -26,6 +28,8 @@ jobs: run: brew cask install apenngrace/vulkan/vulkan-sdk - name: Build run: | + cargo test + cargo build --release cargo install cargo-bundle cargo bundle --release - name: Update Bundle @@ -63,7 +67,9 @@ jobs: sudo apt-get install -y curl gnupg ca-certificates git gcc-multilib g++-multilib cmake libssl-dev pkg-config libfreetype6-dev libasound2-dev libexpat1-dev libxcb-composite0-dev libbz2-dev freeglut3-dev libxi-dev libsdl2-dev - name: Build - run: cargo build --release + run: | + cargo test + cargo build --release - uses: actions/upload-artifact@v1 with: diff --git a/src/renderer/caching_shaper.rs b/src/renderer/caching_shaper.rs index a27bb26..e151dd4 100644 --- a/src/renderer/caching_shaper.rs +++ b/src/renderer/caching_shaper.rs @@ -67,7 +67,7 @@ pub fn add_asset_font_to_collection(name: &str, collection: &mut FontCollection) .map(|font| collection.add_family(FontFamily::new_from_font(font))) } -fn build_collection_by_font_name(font_name: Option<&str>, bold: bool, italic: bool) -> FontCollection { +pub fn build_collection_by_font_name(font_name: Option<&str>, bold: bool, italic: bool) -> FontCollection { let source = SystemSource::new(); let mut collection = FontCollection::new(); @@ -280,4 +280,9 @@ mod tests { fn unmatched_font_returns_nothing() { assert!(add_font_to_collection_by_name("Foobar", &SystemSource::new(), &mut FontCollection::new()).is_none()); } + + #[test] + fn build_font_collection_works() { + build_collection_by_font_name(None, true, true); + } }