feat(ci): test mobile targets (#378)

pull/385/head
Lucas Fernandes Nogueira 2 years ago committed by GitHub
parent 8bd80eb651
commit d677f73495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -126,28 +126,62 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }} package: ${{ fromJSON(needs.changes.outputs.packages) }}
platform: [ubuntu-latest, macos-latest, windows-latest] platform:
- {
target: x86_64-pc-windows-msvc,
os: windows-latest,
cross: false,
command: "test",
}
- {
target: x86_64-unknown-linux-gnu,
os: ubuntu-latest,
cross: false,
command: "test",
}
- {
target: x86_64-apple-darwin,
os: macos-latest,
cross: false,
command: "test",
}
- {
target: aarch64-apple-ios,
os: macos-latest,
cross: false,
command: "build",
}
- {
target: aarch64-linux-android,
os: ubuntu-latest,
cross: true,
command: "build",
}
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform.os }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: install webkit2gtk and libudev for [authenticator] - name: install webkit2gtk and libudev for [authenticator]
if: matrix.platform == 'ubuntu-latest' if: contains(matrix.platform.target, 'unknown-linux')
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libudev-dev sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libudev-dev
- name: install openssl - name: install openssl
if: ${{ matrix.platform == 'windows-latest' && contains(fromJSON('["tauri-plugin-http", "tauri-plugin-upload", "tauri-plugin-updater", "tauri-plugin-websocket", "tauri-plugin-authenticator"]'), matrix.package) }} if: ${{ matrix.platform.os == 'windows-latest' && matrix.package == 'tauri-plugin-authenticator' }}
run: | run: |
echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append echo "VCPKG_ROOT=$env:VCPKG_INSTALLATION_ROOT" | Out-File -FilePath $env:GITHUB_ENV -Append
vcpkg install openssl:x64-windows-static-md vcpkg install openssl:x64-windows-static-md
- uses: dtolnay/rust-toolchain@1.65.0 - uses: dtolnay/rust-toolchain@1.65.0
with:
targets: ${{ matrix.platform.target }}
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.package }}
- name: create dummy dist - name: create dummy dist
working-directory: examples/api working-directory: examples/api
@ -155,16 +189,32 @@ jobs:
- name: test ${{ matrix.package }} - name: test ${{ matrix.package }}
if: matrix.package != 'tauri-plugin-sql' if: matrix.package != 'tauri-plugin-sql'
run: cargo test --package ${{ matrix.package }} --all-targets uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.platform.cross }}
command: ${{ matrix.platform.command }}
args: --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets
- name: test ${{ matrix.package }} --all-features - name: test ${{ matrix.package }} --all-features
if: ${{ !contains(fromJSON('["tauri-plugin-http", "tauri-plugin-upload", "tauri-plugin-updater", "tauri-plugin-websocket", "tauri-plugin-sql"]'), matrix.package) }} if: ${{ !contains(fromJSON('["tauri-plugin-http", "tauri-plugin-upload", "tauri-plugin-updater", "tauri-plugin-websocket", "tauri-plugin-sql"]'), matrix.package) }}
run: cargo test --package ${{ matrix.package }} --all-targets --all-features uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.platform.cross }}
command: ${{ matrix.platform.command }}
args: --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --all-features
- name: test ${{ matrix.package }} mysql - name: test ${{ matrix.package }} mysql
if: matrix.package == 'tauri-plugin-sql' if: matrix.package == 'tauri-plugin-sql'
run: cargo test --package ${{ matrix.package }} --all-targets --no-default-features --features mysql uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.platform.cross }}
command: ${{ matrix.platform.command }}
args: --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features mysql
- name: test ${{ matrix.package }} postgres - name: test ${{ matrix.package }} postgres
if: matrix.package == 'tauri-plugin-sql' if: matrix.package == 'tauri-plugin-sql'
run: cargo test --package ${{ matrix.package }} --all-targets --no-default-features --features postgres uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.platform.cross }}
command: ${{ matrix.platform.command }}
args: --package ${{ matrix.package }} --target ${{ matrix.platform.target }} --all-targets --features postgres

@ -15,6 +15,8 @@ serde_json = { workspace = true }
tauri = { workspace = true } tauri = { workspace = true }
log = { workspace = true } log = { workspace = true }
thiserror = { workspace = true } thiserror = { workspace = true }
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
authenticator = "0.3.1" authenticator = "0.3.1"
once_cell = "1" once_cell = "1"
sha2 = "0.10" sha2 = "0.10"

@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
#![cfg(not(any(target_os = "android", target_os = "ios")))]
mod auth; mod auth;
mod error; mod error;
mod u2f; mod u2f;

@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
#![cfg(not(any(target_os = "android", target_os = "ios")))]
use auto_launch::{AutoLaunch, AutoLaunchBuilder}; use auto_launch::{AutoLaunch, AutoLaunchBuilder};
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
use log::info; use log::info;

@ -37,6 +37,6 @@ class ClipboardPlugin: Plugin {
} }
@_cdecl("init_plugin_clipboard") @_cdecl("init_plugin_clipboard")
func initPlugin(name: SRString, webview: WKWebView?) { func initPlugin() -> Plugin {
Tauri.registerPlugin(webview: webview, name: name.toString(), plugin: ClipboardPlugin()) return ClipboardPlugin()
} }

@ -202,6 +202,6 @@ class DialogPlugin: Plugin {
} }
@_cdecl("init_plugin_dialog") @_cdecl("init_plugin_dialog")
func initPlugin(name: SRString, webview: WKWebView?) { func initPlugin() -> Plugin {
Tauri.registerPlugin(webview: webview, name: name.toString(), plugin: DialogPlugin()) return DialogPlugin()
} }

@ -11,4 +11,6 @@ serde_json = { workspace = true }
tauri = { workspace = true } tauri = { workspace = true }
log = { workspace = true } log = { workspace = true }
thiserror = { workspace = true } thiserror = { workspace = true }
[target."cfg(not(any(target_os = \"android\", target_os = \"ios\")))".dependencies]
global-hotkey = "0.2.1" global-hotkey = "0.2.1"

@ -1,3 +1,5 @@
#![cfg(not(any(target_os = "android", target_os = "ios")))]
use std::{ use std::{
collections::HashMap, collections::HashMap,
str::FromStr, str::FromStr,

@ -9,6 +9,8 @@
//! //!
//! Note: This requires attaching the Tauri plugin, *even* when using the trait extension only. //! Note: This requires attaching the Tauri plugin, *even* when using the trait extension only.
#![cfg(not(any(target_os = "android", target_os = "ios")))]
mod ext; mod ext;
pub use ext::*; pub use ext::*;

@ -1,3 +1,5 @@
#![cfg(not(any(target_os = "android", target_os = "ios")))]
use tauri::{plugin::TauriPlugin, AppHandle, Manager, Runtime}; use tauri::{plugin::TauriPlugin, AppHandle, Manager, Runtime};
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]

@ -7,7 +7,9 @@
all(feature = "sqlite", feature = "postgres"), all(feature = "sqlite", feature = "postgres"),
all(feature = "mysql", feature = "postgres") all(feature = "mysql", feature = "postgres")
))] ))]
compile_error!("Only one database driver can be enabled. Use `default-features = false` and set the feature flag for the driver of your choice."); compile_error!(
"Only one database driver can be enabled. Set the feature flag for the driver of your choice."
);
#[cfg(not(any(feature = "sqlite", feature = "mysql", feature = "postgres")))] #[cfg(not(any(feature = "sqlite", feature = "mysql", feature = "postgres")))]
compile_error!( compile_error!(

@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
#![cfg(not(any(target_os = "android", target_os = "ios")))]
use bitflags::bitflags; use bitflags::bitflags;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tauri::{ use tauri::{

@ -11,6 +11,6 @@ class ExamplePlugin: Plugin {
} }
@_cdecl("init_plugin_{{ plugin_name_snake_case }}") @_cdecl("init_plugin_{{ plugin_name_snake_case }}")
func initPlugin(name: SRString, webview: WKWebView?) { func initPlugin() -> Plugin {
Tauri.registerPlugin(webview: webview, name: name.toString(), plugin: ExamplePlugin()) return ExamplePlugin()
} }

Loading…
Cancel
Save