mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Fix tests for various platforms
This commit is contained in:
parent
3f821e7f66
commit
873e351890
@ -7,4 +7,5 @@ rustflags = [
|
|||||||
# Enables the possibility to import memory into wasm.
|
# Enables the possibility to import memory into wasm.
|
||||||
# Without --shared-memory it is not possible to use shared WebAssembly.Memory.
|
# Without --shared-memory it is not possible to use shared WebAssembly.Memory.
|
||||||
"-C", "link-args=--shared-memory --import-memory",
|
"-C", "link-args=--shared-memory --import-memory",
|
||||||
]
|
]
|
||||||
|
runner = 'wasm-bindgen-test-runner'
|
||||||
|
|||||||
10
.github/actions/android/action.yml
vendored
10
.github/actions/android/action.yml
vendored
@ -12,6 +12,7 @@ runs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: just build-android
|
run: just build-android
|
||||||
|
# TODO: Additional clippy checks for different targets
|
||||||
- name: Check x86_64
|
- name: Check x86_64
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@ -24,7 +25,8 @@ runs:
|
|||||||
env "AR_aarch64-linux-android=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar" \
|
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" \
|
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
|
just check maplibre-android aarch64-linux-android
|
||||||
- name: Test
|
# FIXME: Requires cross-compilation
|
||||||
shell: bash
|
#- name: Test
|
||||||
# TODO: Additional test runs for different targets
|
# shell: bash
|
||||||
run: just test maplibre-android aarch64-linux-android
|
# # TODO: Additional test runs for different targets
|
||||||
|
# run: just test maplibre-android aarch64-linux-android
|
||||||
10
.github/actions/apple/action.yml
vendored
10
.github/actions/apple/action.yml
vendored
@ -22,14 +22,14 @@ runs:
|
|||||||
- name: Check x86_64 darwin
|
- name: Check x86_64 darwin
|
||||||
shell: bash
|
shell: bash
|
||||||
run: just check apple x86_64-apple-darwin
|
run: just check apple x86_64-apple-darwin
|
||||||
- name: Check aarch64 darwin
|
- name: Check x86_64 darwin
|
||||||
shell: bash
|
shell: bash
|
||||||
# TODO: Additional clippy checks for different targets (iOS)
|
# TODO: Additional clippy checks for different targets (iOS)
|
||||||
run: just check apple aarch64-apple-darwin
|
run: just check apple x86_64-apple-darwin
|
||||||
- name: Test
|
- name: Test x86_64 darwin
|
||||||
shell: bash
|
shell: bash
|
||||||
# TODO: Additional test runs for different targets
|
# TODO: Additional test runs for different targets (Different targets might require emulation)
|
||||||
run: just test apple aarch64-apple-darwin
|
run: just test apple x86_64-apple-darwin
|
||||||
- name: Build Example
|
- name: Build Example
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cd apple/xcode && xcodebuild -scheme "example (iOS)" -arch arm64 -sdk iphoneos build CODE_SIGNING_ALLOWED=NO
|
run: cd apple/xcode && xcodebuild -scheme "example (iOS)" -arch arm64 -sdk iphoneos build CODE_SIGNING_ALLOWED=NO
|
||||||
|
|||||||
6
.github/actions/demo/linux/action.yml
vendored
6
.github/actions/demo/linux/action.yml
vendored
@ -15,12 +15,12 @@ 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
|
||||||
|
- name: Test x86_64 linux
|
||||||
|
shell: bash
|
||||||
|
run: just test maplibre-demo x86_64-unknown-linux-gnu
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: maplibre-rs
|
name: maplibre-rs
|
||||||
|
|||||||
8
.github/actions/demo/macos/action.yml
vendored
8
.github/actions/demo/macos/action.yml
vendored
@ -19,10 +19,12 @@ runs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
run: cd apple/xcode && xcodebuild -scheme "example (macOS)" build CODE_SIGNING_ALLOWED=NO MACOSX_DEPLOYMENT_TARGET=10.9 -derivedDataPath build
|
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
|
shell: bash
|
||||||
# TODO: Additional test runs for different targets
|
run: just check maplibre-demo x86_64-apple-darwin
|
||||||
run: just test apple aarch64-apple-darwin
|
- name: Test x86_64 darwin
|
||||||
|
shell: bash
|
||||||
|
run: just test maplibre-demo x86_64-apple-darwin
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: maplibre-x86_64-apple-darwin-demo
|
name: maplibre-x86_64-apple-darwin-demo
|
||||||
|
|||||||
5
.github/actions/demo/windows/action.yml
vendored
5
.github/actions/demo/windows/action.yml
vendored
@ -22,7 +22,10 @@ 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
|
- name: Check x86_64 windows
|
||||||
|
shell: bash
|
||||||
|
run: just check maplibre-demo x86_64-pc-windows-msvc
|
||||||
|
- name: Test x86_64 windows
|
||||||
shell: bash
|
shell: bash
|
||||||
run: just test maplibre-demo x86_64-pc-windows-msvc
|
run: just test maplibre-demo x86_64-pc-windows-msvc
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
|
|||||||
3
.github/actions/webgl/action.yml
vendored
3
.github/actions/webgl/action.yml
vendored
@ -18,3 +18,6 @@ runs:
|
|||||||
- name: Check
|
- name: Check
|
||||||
shell: bash
|
shell: bash
|
||||||
run: just check web wasm32-unknown-unknown
|
run: just check web wasm32-unknown-unknown
|
||||||
|
- name: Test
|
||||||
|
shell: bash
|
||||||
|
run: just web-test "web-webgl"
|
||||||
|
|||||||
4
.github/actions/webgpu/action.yml
vendored
4
.github/actions/webgpu/action.yml
vendored
@ -18,6 +18,6 @@ runs:
|
|||||||
- name: Check
|
- name: Check
|
||||||
shell: bash
|
shell: bash
|
||||||
run: just check web wasm32-unknown-unknown
|
run: just check web wasm32-unknown-unknown
|
||||||
- name: Check
|
- name: Test
|
||||||
shell: bash
|
shell: bash
|
||||||
run: just test web wasm32-unknown-unknown
|
run: just web-test ""
|
||||||
|
|||||||
2
.github/workflows/on_main_push.yml
vendored
2
.github/workflows/on_main_push.yml
vendored
@ -62,7 +62,7 @@ jobs:
|
|||||||
source: docs/book/.
|
source: docs/book/.
|
||||||
destination: docs
|
destination: docs
|
||||||
key: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
|
key: ${{ secrets.SSH_KEY_MAXAMMANN_ORG }}
|
||||||
build-ios:
|
build-apple:
|
||||||
runs-on: macos-11
|
runs-on: macos-11
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|||||||
2
.github/workflows/on_pull_request.yml
vendored
2
.github/workflows/on_pull_request.yml
vendored
@ -42,7 +42,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: ./.github/actions/docs
|
- uses: ./.github/actions/docs
|
||||||
build-ios:
|
build-apple:
|
||||||
runs-on: macos-11
|
runs-on: macos-11
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|||||||
8
justfile
8
justfile
@ -45,12 +45,18 @@ web-lib TARGET: nightly-toolchain (web-install "lib")
|
|||||||
web-demo TARGET: (web-install "demo")
|
web-demo TARGET: (web-install "demo")
|
||||||
cd web/demo && npm run {{TARGET}}
|
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:
|
#profile-bench:
|
||||||
# cargo flamegraph --bench render -- --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
|
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
|
# language=bash
|
||||||
print-android-env:
|
print-android-env:
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|||||||
@ -409,6 +409,7 @@ mod tests {
|
|||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
#[ignore] // FIXME: We do not have a GPU in CI
|
||||||
async fn test_render() {
|
async fn test_render() {
|
||||||
let graph = RenderGraph::default();
|
let graph = RenderGraph::default();
|
||||||
|
|
||||||
|
|||||||
@ -35,3 +35,6 @@ wasm-bindgen = "0.2"
|
|||||||
wasm-bindgen-futures = "0.4"
|
wasm-bindgen-futures = "0.4"
|
||||||
console_log = { version = "0.2", features = ["color"] }
|
console_log = { version = "0.2", features = ["color"] }
|
||||||
tracing-wasm = { version = "0.2", optional = true } # FIXME: Low quality dependency
|
tracing-wasm = { version = "0.2", optional = true } # FIXME: Low quality dependency
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
wasm-bindgen-test = "0.3"
|
||||||
@ -65,3 +65,15 @@ pub async fn run(scheduler_ptr: *mut Scheduler<WebWorkerPoolScheduleMethod>) {
|
|||||||
|
|
||||||
// std::mem::forget(scheduler);
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user