mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
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:
parent
6bc9a792fd
commit
e59dacdb45
@ -15,6 +15,9 @@ runs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cargo build -p maplibre-demo
|
run: cargo build -p maplibre-demo
|
||||||
|
- name: Test
|
||||||
|
shell: bash
|
||||||
|
run: just test maplibre-demo x86_64-unknown-linux-gnu
|
||||||
- name: Check
|
- name: Check
|
||||||
shell: bash
|
shell: bash
|
||||||
run: just check maplibre-demo x86_64-unknown-linux-gnu
|
run: just check maplibre-demo x86_64-unknown-linux-gnu
|
||||||
3
.github/actions/demo/windows/action.yml
vendored
3
.github/actions/demo/windows/action.yml
vendored
@ -22,6 +22,9 @@ runs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cargo build -p maplibre-demo --release --target x86_64-pc-windows-msvc
|
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
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: maplibre-x86_64-windows-demo
|
name: maplibre-x86_64-windows-demo
|
||||||
|
|||||||
10
.github/workflows/on_main_push.yml
vendored
10
.github/workflows/on_main_push.yml
vendored
@ -17,11 +17,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: ./.github/actions/benchmarks
|
- uses: ./.github/actions/benchmarks
|
||||||
build-linux-demo:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: ./.github/actions/linux-demo
|
|
||||||
build-android:
|
build-android:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
@ -69,6 +64,11 @@ jobs:
|
|||||||
- uses: ./.github/actions/apple
|
- uses: ./.github/actions/apple
|
||||||
with:
|
with:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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:
|
build-demo-windows:
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
10
.github/workflows/on_pull_request.yml
vendored
10
.github/workflows/on_pull_request.yml
vendored
@ -17,11 +17,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: ./.github/actions/benchmarks
|
- uses: ./.github/actions/benchmarks
|
||||||
build-linux-demo:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: ./.github/actions/linux-demo
|
|
||||||
build-android:
|
build-android:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
@ -49,6 +44,11 @@ jobs:
|
|||||||
- uses: ./.github/actions/apple
|
- uses: ./.github/actions/apple
|
||||||
with:
|
with:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
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:
|
build-demo-windows:
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
6
justfile
6
justfile
@ -6,15 +6,15 @@ set shell := ["bash", "-c"]
|
|||||||
|
|
||||||
export NIGHTLY_TOOLCHAIN := "nightly-2022-04-04-x86_64-unknown-linux-gnu"
|
export NIGHTLY_TOOLCHAIN := "nightly-2022-04-04-x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
test:
|
|
||||||
cargo test
|
|
||||||
|
|
||||||
install-clippy:
|
install-clippy:
|
||||||
rustup component add clippy
|
rustup component add clippy
|
||||||
|
|
||||||
check PROJECT ARCH: install-clippy
|
check PROJECT ARCH: install-clippy
|
||||||
cargo clippy --no-deps -p {{PROJECT}} --target {{ARCH}}
|
cargo clippy --no-deps -p {{PROJECT}} --target {{ARCH}}
|
||||||
|
|
||||||
|
test PROJECT ARCH:
|
||||||
|
cargo test -p {{PROJECT}} --target {{ARCH}}
|
||||||
|
|
||||||
install-rustfmt:
|
install-rustfmt:
|
||||||
rustup component add rustfmt
|
rustup component add rustfmt
|
||||||
|
|
||||||
|
|||||||
@ -61,6 +61,7 @@ mod tests {
|
|||||||
|
|
||||||
use super::StaticTileFetcher;
|
use super::StaticTileFetcher;
|
||||||
|
|
||||||
|
#[cfg(all(static_tiles, not(target_arch = "wasm32")))]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_tiles_available() {
|
async fn test_tiles_available() {
|
||||||
const MUNICH_X: i32 = 17425;
|
const MUNICH_X: i32 = 17425;
|
||||||
|
|||||||
@ -27,8 +27,7 @@ use super::EdgeExistence;
|
|||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
/// Here is a simple render graph example with two nodes connected by a node edge.
|
/// 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::graph::{Node, NodeRunError, RenderContext, RenderGraph, RenderGraphContext};
|
||||||
/// # use maplibre::render::{RenderState};
|
/// # use maplibre::render::{RenderState};
|
||||||
/// # struct MyNode;
|
/// # struct MyNode;
|
||||||
@ -575,9 +574,10 @@ mod tests {
|
|||||||
Edge, Node, NodeId, NodeRunError, RenderGraph, RenderGraphContext, RenderGraphError,
|
Edge, Node, NodeId, NodeRunError, RenderGraph, RenderGraphContext, RenderGraphError,
|
||||||
SlotInfo,
|
SlotInfo,
|
||||||
};
|
};
|
||||||
use crate::render::graph::SlotType;
|
use crate::render::{
|
||||||
use crate::render::renderer::RenderContext;
|
graph::{RenderContext, SlotType},
|
||||||
use crate::render::World;
|
RenderState,
|
||||||
|
};
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -612,7 +612,7 @@ mod tests {
|
|||||||
&self,
|
&self,
|
||||||
_: &mut RenderGraphContext,
|
_: &mut RenderGraphContext,
|
||||||
_: &mut RenderContext,
|
_: &mut RenderContext,
|
||||||
_: &World,
|
_: &RenderState,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -685,7 +685,7 @@ mod tests {
|
|||||||
&self,
|
&self,
|
||||||
_: &mut RenderGraphContext,
|
_: &mut RenderGraphContext,
|
||||||
_: &mut RenderContext,
|
_: &mut RenderContext,
|
||||||
_: &World,
|
_: &RenderState,
|
||||||
) -> Result<(), NodeRunError> {
|
) -> Result<(), NodeRunError> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -331,12 +331,12 @@ impl Renderer {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use crate::render::graph::RenderGraph;
|
use crate::render::graph::RenderGraph;
|
||||||
use crate::render::graph_runner::RenderGraphRunner;
|
use crate::render::graph_runner::RenderGraphRunner;
|
||||||
use crate::render::pass_pipeline::build_graph;
|
use crate::render::RenderState;
|
||||||
use crate::render::World;
|
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_render() {
|
async fn test_render() {
|
||||||
let graph = build_graph();
|
let graph = RenderGraph::default();
|
||||||
|
|
||||||
let instance = wgpu::Instance::new(wgpu::Backends::all());
|
let instance = wgpu::Instance::new(wgpu::Backends::all());
|
||||||
|
|
||||||
@ -362,6 +362,8 @@ mod tests {
|
|||||||
.ok()
|
.ok()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
RenderGraphRunner::run(&graph, &device, &queue, &World {});
|
let render_state = RenderState::default();
|
||||||
|
|
||||||
|
RenderGraphRunner::run(&graph, &device, &queue, &render_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -581,7 +581,7 @@ mod tests {
|
|||||||
use crate::style::layer::StyleLayer;
|
use crate::style::layer::StyleLayer;
|
||||||
use lyon::tessellation::VertexBuffers;
|
use lyon::tessellation::VertexBuffers;
|
||||||
|
|
||||||
use crate::render::buffer_pool::{
|
use crate::render::resource::buffer_pool::{
|
||||||
BackingBufferDescriptor, BackingBufferType, BufferPool, Queue,
|
BackingBufferDescriptor, BackingBufferType, BufferPool, Queue,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -202,8 +202,8 @@ impl<'a> TrackedRenderPass<'a> {
|
|||||||
/// Push a new debug group over the internal stack. Subsequent render commands and debug
|
/// 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.
|
/// markers are grouped into this new group, until [`pop_debug_group`] is called.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```ignore
|
||||||
/// # fn example(mut pass: bevy_render::render_phase::TrackedRenderPass<'static>) {
|
/// # fn example(mut pass: maplibre::render::resource::TrackedRenderPass<'static>) {
|
||||||
/// pass.push_debug_group("Render the car");
|
/// pass.push_debug_group("Render the car");
|
||||||
/// // [setup pipeline etc...]
|
/// // [setup pipeline etc...]
|
||||||
/// pass.draw(0..64, 0..1);
|
/// pass.draw(0..64, 0..1);
|
||||||
|
|||||||
@ -4,8 +4,8 @@ use std::time::Duration;
|
|||||||
/// Measures the frames per second.
|
/// Measures the frames per second.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
/// ```rust
|
/// ```ignore
|
||||||
/// use crate::util::FPSMeter;
|
/// use maplibre::util::FPSMeter;
|
||||||
///
|
///
|
||||||
/// let mut meter = FPSMeter::new();
|
/// let mut meter = FPSMeter::new();
|
||||||
///
|
///
|
||||||
|
|||||||
@ -51,7 +51,7 @@ where
|
|||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```ignore
|
||||||
/// # use maplibre::define_label;
|
/// # use maplibre::define_label;
|
||||||
/// define_label!(MyNewLabelTrait);
|
/// define_label!(MyNewLabelTrait);
|
||||||
/// ```
|
/// ```
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user