Fix tests for various platforms

This commit is contained in:
Maximilian Ammann 2022-06-01 17:50:07 +02:00
parent 3f821e7f66
commit 873e351890
14 changed files with 55 additions and 22 deletions

View File

@ -7,4 +7,5 @@ rustflags = [
# Enables the possibility to import memory into wasm.
# Without --shared-memory it is not possible to use shared WebAssembly.Memory.
"-C", "link-args=--shared-memory --import-memory",
]
]
runner = 'wasm-bindgen-test-runner'

View File

@ -12,6 +12,7 @@ runs:
- name: Build
shell: bash
run: just build-android
# TODO: Additional clippy checks for different targets
- name: Check x86_64
shell: bash
run: |
@ -24,7 +25,8 @@ runs:
env "AR_aarch64-linux-android=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" \
env "CC_aarch64-linux-android=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang" \
just check maplibre-android aarch64-linux-android
- name: Test
shell: bash
# TODO: Additional test runs for different targets
run: just test maplibre-android aarch64-linux-android
# FIXME: Requires cross-compilation
#- name: Test
# shell: bash
# # TODO: Additional test runs for different targets
# run: just test maplibre-android aarch64-linux-android

View File

@ -22,14 +22,14 @@ runs:
- name: Check x86_64 darwin
shell: bash
run: just check apple x86_64-apple-darwin
- name: Check aarch64 darwin
- name: Check x86_64 darwin
shell: bash
# TODO: Additional clippy checks for different targets (iOS)
run: just check apple aarch64-apple-darwin
- name: Test
run: just check apple x86_64-apple-darwin
- name: Test x86_64 darwin
shell: bash
# TODO: Additional test runs for different targets
run: just test apple aarch64-apple-darwin
# TODO: Additional test runs for different targets (Different targets might require emulation)
run: just test apple x86_64-apple-darwin
- name: Build Example
shell: bash
run: cd apple/xcode && xcodebuild -scheme "example (iOS)" -arch arm64 -sdk iphoneos build CODE_SIGNING_ALLOWED=NO

View File

@ -15,12 +15,12 @@ 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
- name: Test x86_64 linux
shell: bash
run: just test maplibre-demo x86_64-unknown-linux-gnu
- uses: actions/upload-artifact@v2
with:
name: maplibre-rs

View File

@ -19,10 +19,12 @@ runs:
- name: Build
shell: bash
run: cd apple/xcode && xcodebuild -scheme "example (macOS)" build CODE_SIGNING_ALLOWED=NO MACOSX_DEPLOYMENT_TARGET=10.9 -derivedDataPath build
- name: Test
- name: Check x86_64 darwin
shell: bash
# TODO: Additional test runs for different targets
run: just test apple aarch64-apple-darwin
run: just check maplibre-demo x86_64-apple-darwin
- name: Test x86_64 darwin
shell: bash
run: just test maplibre-demo x86_64-apple-darwin
- uses: actions/upload-artifact@v3
with:
name: maplibre-x86_64-apple-darwin-demo

View File

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

View File

@ -18,3 +18,6 @@ runs:
- name: Check
shell: bash
run: just check web wasm32-unknown-unknown
- name: Test
shell: bash
run: just web-test "web-webgl"

View File

@ -18,6 +18,6 @@ runs:
- name: Check
shell: bash
run: just check web wasm32-unknown-unknown
- name: Check
- name: Test
shell: bash
run: just test web wasm32-unknown-unknown
run: just web-test ""

View File

@ -62,7 +62,7 @@ jobs:
source: docs/book/.
destination: docs
key: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
build-ios:
build-apple:
runs-on: macos-11
steps:
- uses: actions/checkout@v2

View File

@ -42,7 +42,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/docs
build-ios:
build-apple:
runs-on: macos-11
steps:
- uses: actions/checkout@v2

View File

@ -45,12 +45,18 @@ web-lib TARGET: nightly-toolchain (web-install "lib")
web-demo TARGET: (web-install "demo")
cd web/demo && npm run {{TARGET}}
web-test FEATURES: nightly-toolchain
export RUSTUP_TOOLCHAIN=$NIGHTLY_TOOLCHAIN && cargo test -p web --features "{{FEATURES}}" --target wasm32-unknown-unknown -Z build-std=std,panic_abort
#profile-bench:
# cargo flamegraph --bench render -- --bench
build-android: print-android-env
build-android: nightly-toolchain print-android-env
export RUSTUP_TOOLCHAIN=$NIGHTLY_TOOLCHAIN && cd android/gradle && ./gradlew assembleDebug
test-android TARGET: nightly-toolchain print-android-env
export RUSTUP_TOOLCHAIN=$NIGHTLY_TOOLCHAIN && cargo test -p maplibre-android --target {{TARGET}} -Z build-std=std,panic_abort
# language=bash
print-android-env:
#!/usr/bin/env bash

View File

@ -409,6 +409,7 @@ mod tests {
#[cfg(not(target_arch = "wasm32"))]
#[tokio::test]
#[ignore] // FIXME: We do not have a GPU in CI
async fn test_render() {
let graph = RenderGraph::default();

View File

@ -35,3 +35,6 @@ wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
console_log = { version = "0.2", features = ["color"] }
tracing-wasm = { version = "0.2", optional = true } # FIXME: Low quality dependency
[dev-dependencies]
wasm-bindgen-test = "0.3"

View File

@ -65,3 +65,15 @@ pub async fn run(scheduler_ptr: *mut Scheduler<WebWorkerPoolScheduleMethod>) {
// std::mem::forget(scheduler);
}
#[cfg(test)]
/// See https://rustwasm.github.io/wasm-bindgen/wasm-bindgen-test/browsers.html
mod tests {
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
fn pass() {
assert_eq!(1, 1);
}
}