Fix unit test build and run tests on CI (on some platforms) (#117)

* Fix unit test build

* Don't run static tile fetching test if no tiles are embedded

* Don't test code examples which use private modules

* Disable Tokio tests on WASM32 platform

* Move linux-demo action into demo folder for consistency

* Run tests on Windows and Linux (at least)
This commit is contained in:
Zsolt Bölöny 2022-05-31 21:07:54 +02:00 committed by GitHub
parent 6bc9a792fd
commit e59dacdb45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 39 additions and 30 deletions

View File

@ -15,6 +15,9 @@ runs:
- name: Build
shell: bash
run: cargo build -p maplibre-demo
- name: Test
shell: bash
run: just test maplibre-demo x86_64-unknown-linux-gnu
- name: Check
shell: bash
run: just check maplibre-demo x86_64-unknown-linux-gnu

View File

@ -22,6 +22,9 @@ runs:
- name: Build
shell: bash
run: cargo build -p maplibre-demo --release --target x86_64-pc-windows-msvc
- name: Test
shell: bash
run: just test maplibre-demo x86_64-pc-windows-msvc
- uses: actions/upload-artifact@v3
with:
name: maplibre-x86_64-windows-demo

View File

@ -17,11 +17,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/benchmarks
build-linux-demo:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/linux-demo
build-android:
runs-on: ubuntu-20.04
steps:
@ -69,6 +64,11 @@ jobs:
- uses: ./.github/actions/apple
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-demo-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/demo/linux
build-demo-windows:
runs-on: windows-2022
steps:

View File

@ -17,11 +17,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/benchmarks
build-linux-demo:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/linux-demo
build-android:
runs-on: ubuntu-20.04
steps:
@ -49,6 +44,11 @@ jobs:
- uses: ./.github/actions/apple
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-demo-linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/demo/linux
build-demo-windows:
runs-on: windows-2022
steps:

View File

@ -6,15 +6,15 @@ set shell := ["bash", "-c"]
export NIGHTLY_TOOLCHAIN := "nightly-2022-04-04-x86_64-unknown-linux-gnu"
test:
cargo test
install-clippy:
rustup component add clippy
check PROJECT ARCH: install-clippy
cargo clippy --no-deps -p {{PROJECT}} --target {{ARCH}}
test PROJECT ARCH:
cargo test -p {{PROJECT}} --target {{ARCH}}
install-rustfmt:
rustup component add rustfmt

View File

@ -61,6 +61,7 @@ mod tests {
use super::StaticTileFetcher;
#[cfg(all(static_tiles, not(target_arch = "wasm32")))]
#[tokio::test]
async fn test_tiles_available() {
const MUNICH_X: i32 = 17425;

View File

@ -27,8 +27,7 @@ use super::EdgeExistence;
///
/// ## Example
/// Here is a simple render graph example with two nodes connected by a node edge.
/// ```
/// #
/// ```ignore
/// # use maplibre::render::graph::{Node, NodeRunError, RenderContext, RenderGraph, RenderGraphContext};
/// # use maplibre::render::{RenderState};
/// # struct MyNode;
@ -575,9 +574,10 @@ mod tests {
Edge, Node, NodeId, NodeRunError, RenderGraph, RenderGraphContext, RenderGraphError,
SlotInfo,
};
use crate::render::graph::SlotType;
use crate::render::renderer::RenderContext;
use crate::render::World;
use crate::render::{
graph::{RenderContext, SlotType},
RenderState,
};
use std::collections::HashSet;
#[derive(Debug)]
@ -612,7 +612,7 @@ mod tests {
&self,
_: &mut RenderGraphContext,
_: &mut RenderContext,
_: &World,
_: &RenderState,
) -> Result<(), NodeRunError> {
Ok(())
}
@ -685,7 +685,7 @@ mod tests {
&self,
_: &mut RenderGraphContext,
_: &mut RenderContext,
_: &World,
_: &RenderState,
) -> Result<(), NodeRunError> {
Ok(())
}

View File

@ -331,12 +331,12 @@ impl Renderer {
mod tests {
use crate::render::graph::RenderGraph;
use crate::render::graph_runner::RenderGraphRunner;
use crate::render::pass_pipeline::build_graph;
use crate::render::World;
use crate::render::RenderState;
#[cfg(not(target_arch = "wasm32"))]
#[tokio::test]
async fn test_render() {
let graph = build_graph();
let graph = RenderGraph::default();
let instance = wgpu::Instance::new(wgpu::Backends::all());
@ -362,6 +362,8 @@ mod tests {
.ok()
.unwrap();
RenderGraphRunner::run(&graph, &device, &queue, &World {});
let render_state = RenderState::default();
RenderGraphRunner::run(&graph, &device, &queue, &render_state);
}
}

View File

@ -581,7 +581,7 @@ mod tests {
use crate::style::layer::StyleLayer;
use lyon::tessellation::VertexBuffers;
use crate::render::buffer_pool::{
use crate::render::resource::buffer_pool::{
BackingBufferDescriptor, BackingBufferType, BufferPool, Queue,
};

View File

@ -202,8 +202,8 @@ impl<'a> TrackedRenderPass<'a> {
/// Push a new debug group over the internal stack. Subsequent render commands and debug
/// markers are grouped into this new group, until [`pop_debug_group`] is called.
///
/// ```
/// # fn example(mut pass: bevy_render::render_phase::TrackedRenderPass<'static>) {
/// ```ignore
/// # fn example(mut pass: maplibre::render::resource::TrackedRenderPass<'static>) {
/// pass.push_debug_group("Render the car");
/// // [setup pipeline etc...]
/// pass.draw(0..64, 0..1);

View File

@ -4,8 +4,8 @@ use std::time::Duration;
/// Measures the frames per second.
///
/// # Example
/// ```rust
/// use crate::util::FPSMeter;
/// ```ignore
/// use maplibre::util::FPSMeter;
///
/// let mut meter = FPSMeter::new();
///

View File

@ -51,7 +51,7 @@ where
///
/// # Example
///
/// ```
/// ```ignore
/// # use maplibre::define_label;
/// define_label!(MyNewLabelTrait);
/// ```