ci: lint+format checks (#2)

* initial ci * add native deps to rust ci * cache apt packages * remove leftover run * update schema and fmt

Lorenzo Rizzotti committed Mar 23, 2025 at 11:57 UTC 0f2cb67367dd6849e159124258a6ac42b86c389e
3 files changed +117 -61
.github/workflows/ci.yml new
+56
@@ -0,0 +1,56 @@
1 +name: CI
2 +
3 +on:
4 + push:
5 + pull_request:
6 +
7 +jobs:
8 + rust:
9 + name: Rust Checks
10 + runs-on: ubuntu-latest
11 + steps:
12 + - uses: actions/checkout@v3
13 +
14 + - name: Install native deps
15 + uses: awalsh128/cache-apt-pkgs-action@latest
16 + with:
17 + # https://tauri.app/start/prerequisites/
18 + packages: libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev
19 + version: 1.0
20 +
21 + - name: Install Rust toolchain
22 + uses: dtolnay/rust-toolchain@stable
23 + with:
24 + components: rustfmt, clippy
25 +
26 + - name: Cache Rust dependencies
27 + uses: Swatinem/rust-cache@v2
28 +
29 + - name: Install Rust dependencies
30 + run: cargo fetch
31 +
32 + - name: Check formatting
33 + run: cargo fmt --all -- --check
34 +
35 + - name: Run clippy
36 + run: cargo clippy -- -D warnings
37 +
38 + - name: Run tests
39 + run: cargo test
40 +
41 + bun:
42 + name: Bun Checks
43 + runs-on: ubuntu-latest
44 + steps:
45 + - uses: actions/checkout@v3
46 +
47 + - name: Setup Bun
48 + uses: oven-sh/setup-bun@v1
49 + with:
50 + bun-version: latest
51 +
52 + - name: Install Bun dependencies
53 + run: bun install
54 +
55 + - name: Run bun check
56 + run: bun run check
permissions/schemas/schema.json
+52 -52
@@ -44,7 +44,7 @@
44 "minimum": 1.0
45 },
46 "description": {
47 - "description": "Human-readable description of what the permission does. Tauri convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
47 + "description": "Human-readable description of what the permission does. Tauri convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.",
48 "type": ["string", "null"]
49 },
50 "permissions": {
@@ -94,7 +94,7 @@
94 "type": "string"
95 },
96 "description": {
97 - "description": "Human-readable description of what the permission does. Tauri internal convention is to use <h4> headings in markdown content for Tauri documentation generation purposes.",
97 + "description": "Human-readable description of what the permission does. Tauri internal convention is to use `<h4>` headings in markdown content for Tauri documentation generation purposes.",
98 "type": ["string", "null"]
99 },
100 "commands": {
@@ -256,129 +256,129 @@
256 "type": "string",
257 "oneOf": [
258 {
259 - "description": "allow-adCreate -> Enables the adCreate command without any pre-configured scope.",
259 + "description": "Enables the adCreate command without any pre-configured scope.",
260 "type": "string",
261 - "enum": ["allow-adCreate"]
261 + "const": "allow-adCreate"
262 },
263 {
264 - "description": "deny-adCreate -> Denies the adCreate command without any pre-configured scope.",
264 + "description": "Denies the adCreate command without any pre-configured scope.",
265 "type": "string",
266 - "enum": ["deny-adCreate"]
266 + "const": "deny-adCreate"
267 },
268 {
269 - "description": "allow-adHide -> Enables the adHide command without any pre-configured scope.",
269 + "description": "Enables the adHide command without any pre-configured scope.",
270 "type": "string",
271 - "enum": ["allow-adHide"]
271 + "const": "allow-adHide"
272 },
273 {
274 - "description": "deny-adHide -> Denies the adHide command without any pre-configured scope.",
274 + "description": "Denies the adHide command without any pre-configured scope.",
275 "type": "string",
276 - "enum": ["deny-adHide"]
276 + "const": "deny-adHide"
277 },
278 {
279 - "description": "allow-adIsLoaded -> Enables the adIsLoaded command without any pre-configured scope.",
279 + "description": "Enables the adIsLoaded command without any pre-configured scope.",
280 "type": "string",
281 - "enum": ["allow-adIsLoaded"]
281 + "const": "allow-adIsLoaded"
282 },
283 {
284 - "description": "deny-adIsLoaded -> Denies the adIsLoaded command without any pre-configured scope.",
284 + "description": "Denies the adIsLoaded command without any pre-configured scope.",
285 "type": "string",
286 - "enum": ["deny-adIsLoaded"]
286 + "const": "deny-adIsLoaded"
287 },
288 {
289 - "description": "allow-adLoad -> Enables the adLoad command without any pre-configured scope.",
289 + "description": "Enables the adLoad command without any pre-configured scope.",
290 "type": "string",
291 - "enum": ["allow-adLoad"]
291 + "const": "allow-adLoad"
292 },
293 {
294 - "description": "deny-adLoad -> Denies the adLoad command without any pre-configured scope.",
294 + "description": "Denies the adLoad command without any pre-configured scope.",
295 "type": "string",
296 - "enum": ["deny-adLoad"]
296 + "const": "deny-adLoad"
297 },
298 {
299 - "description": "allow-adShow -> Enables the adShow command without any pre-configured scope.",
299 + "description": "Enables the adShow command without any pre-configured scope.",
300 "type": "string",
301 - "enum": ["allow-adShow"]
301 + "const": "allow-adShow"
302 },
303 {
304 - "description": "deny-adShow -> Denies the adShow command without any pre-configured scope.",
304 + "description": "Denies the adShow command without any pre-configured scope.",
305 "type": "string",
306 - "enum": ["deny-adShow"]
306 + "const": "deny-adShow"
307 },
308 {
309 - "description": "allow-configRequest -> Enables the configRequest command without any pre-configured scope.",
309 + "description": "Enables the configRequest command without any pre-configured scope.",
310 "type": "string",
311 - "enum": ["allow-configRequest"]
311 + "const": "allow-configRequest"
312 },
313 {
314 - "description": "deny-configRequest -> Denies the configRequest command without any pre-configured scope.",
314 + "description": "Denies the configRequest command without any pre-configured scope.",
315 "type": "string",
316 - "enum": ["deny-configRequest"]
316 + "const": "deny-configRequest"
317 },
318 {
319 - "description": "allow-configure -> Enables the configure command without any pre-configured scope.",
319 + "description": "Enables the configure command without any pre-configured scope.",
320 "type": "string",
321 - "enum": ["allow-configure"]
321 + "const": "allow-configure"
322 },
323 {
324 - "description": "deny-configure -> Denies the configure command without any pre-configured scope.",
324 + "description": "Denies the configure command without any pre-configured scope.",
325 "type": "string",
326 - "enum": ["deny-configure"]
326 + "const": "deny-configure"
327 },
328 {
329 - "description": "allow-isPrivacyOptionsRequired -> Enables the isPrivacyOptionsRequired command without any pre-configured scope.",
329 + "description": "Enables the isPrivacyOptionsRequired command without any pre-configured scope.",
330 "type": "string",
331 - "enum": ["allow-isPrivacyOptionsRequired"]
331 + "const": "allow-isPrivacyOptionsRequired"
332 },
333 {
334 - "description": "deny-isPrivacyOptionsRequired -> Denies the isPrivacyOptionsRequired command without any pre-configured scope.",
334 + "description": "Denies the isPrivacyOptionsRequired command without any pre-configured scope.",
335 "type": "string",
336 - "enum": ["deny-isPrivacyOptionsRequired"]
336 + "const": "deny-isPrivacyOptionsRequired"
337 },
338 {
339 - "description": "allow-register-listener -> Enables the register_listener command without any pre-configured scope.",
339 + "description": "Enables the register_listener command without any pre-configured scope.",
340 "type": "string",
341 - "enum": ["allow-register-listener"]
341 + "const": "allow-register-listener"
342 },
343 {
344 - "description": "deny-register-listener -> Denies the register_listener command without any pre-configured scope.",
344 + "description": "Denies the register_listener command without any pre-configured scope.",
345 "type": "string",
346 - "enum": ["deny-register-listener"]
346 + "const": "deny-register-listener"
347 },
348 {
349 - "description": "allow-requestTrackingAuthorization -> Enables the requestTrackingAuthorization command without any pre-configured scope.",
349 + "description": "Enables the requestTrackingAuthorization command without any pre-configured scope.",
350 "type": "string",
351 - "enum": ["allow-requestTrackingAuthorization"]
351 + "const": "allow-requestTrackingAuthorization"
352 },
353 {
354 - "description": "deny-requestTrackingAuthorization -> Denies the requestTrackingAuthorization command without any pre-configured scope.",
354 + "description": "Denies the requestTrackingAuthorization command without any pre-configured scope.",
355 "type": "string",
356 - "enum": ["deny-requestTrackingAuthorization"]
356 + "const": "deny-requestTrackingAuthorization"
357 },
358 {
359 - "description": "allow-showPrivacyOptionsForm -> Enables the showPrivacyOptionsForm command without any pre-configured scope.",
359 + "description": "Enables the showPrivacyOptionsForm command without any pre-configured scope.",
360 "type": "string",
361 - "enum": ["allow-showPrivacyOptionsForm"]
361 + "const": "allow-showPrivacyOptionsForm"
362 },
363 {
364 - "description": "deny-showPrivacyOptionsForm -> Denies the showPrivacyOptionsForm command without any pre-configured scope.",
364 + "description": "Denies the showPrivacyOptionsForm command without any pre-configured scope.",
365 "type": "string",
366 - "enum": ["deny-showPrivacyOptionsForm"]
366 + "const": "deny-showPrivacyOptionsForm"
367 },
368 {
369 - "description": "allow-trackingAuthorizationStatus -> Enables the trackingAuthorizationStatus command without any pre-configured scope.",
369 + "description": "Enables the trackingAuthorizationStatus command without any pre-configured scope.",
370 "type": "string",
371 - "enum": ["allow-trackingAuthorizationStatus"]
371 + "const": "allow-trackingAuthorizationStatus"
372 },
373 {
374 - "description": "deny-trackingAuthorizationStatus -> Denies the trackingAuthorizationStatus command without any pre-configured scope.",
374 + "description": "Denies the trackingAuthorizationStatus command without any pre-configured scope.",
375 "type": "string",
376 - "enum": ["deny-trackingAuthorizationStatus"]
376 + "const": "deny-trackingAuthorizationStatus"
377 },
378 {
379 - "description": "default -> Default permissions for the plugin",
379 + "description": "Default permissions for the plugin",
380 "type": "string",
381 - "enum": ["default"]
381 + "const": "default"
382 }
383 ]
384 }
src/mobile.rs
+9 -9
@@ -1,7 +1,7 @@
1 use serde::de::DeserializeOwned;
2 use tauri::{
3 - plugin::{PluginApi, PluginHandle},
4 - AppHandle, Runtime,
3 + plugin::{PluginApi, PluginHandle},
4 + AppHandle, Runtime,
5 };
6
7 #[cfg(target_os = "android")]
@@ -12,14 +12,14 @@ tauri::ios_plugin_binding!(init_plugin_admob);
12
13 // initializes the Kotlin or Swift plugin classes
14 pub fn init<R: Runtime, C: DeserializeOwned>(
15 - _app: &AppHandle<R>,
16 - api: PluginApi<R, C>,
15 + _app: &AppHandle<R>,
16 + api: PluginApi<R, C>,
17 ) -> crate::Result<Admob<R>> {
18 - #[cfg(target_os = "android")]
19 - let handle = api.register_android_plugin(PLUGIN_IDENTIFIER, "AdmobPlugin")?;
20 - #[cfg(target_os = "ios")]
21 - let handle = api.register_ios_plugin(init_plugin_admob)?;
22 - Ok(Admob(handle))
18 + #[cfg(target_os = "android")]
19 + let handle = api.register_android_plugin(PLUGIN_IDENTIFIER, "AdmobPlugin")?;
20 + #[cfg(target_os = "ios")]
21 + let handle = api.register_ios_plugin(init_plugin_admob)?;
22 + Ok(Admob(handle))
23 }
24
25 /// Access to the admob APIs.