瀏覽代碼

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

Lucas Fernandes Nogueira 2 年之前
父節點
當前提交
b36ccb7e99

+ 54 - 7
.github/workflows/test-core.yml

@@ -18,6 +18,9 @@ env:
   RUST_BACKTRACE: 1
   CARGO_INCREMENTAL: 0 # This is set to 0 by the https://github.com/Swatinem/rust-cache
   CARGO_PROFILE_DEV_DEBUG: 0 # This would add unnecessary bloat to the target folder, decreasing cache efficiency.
+  WRY_ANDROID_REVERSED_DOMAIN: 'app.tauri'
+  WRY_ANDROID_APP_NAME_SNAKE_CASE: 'dev'
+  WRY_ANDROID_KOTLIN_FILES_OUT_DIR: 'out'
 
 concurrency:
   group: ${{ github.workflow }}-${{ github.ref }}
@@ -34,17 +37,37 @@ jobs:
           - {
               target: x86_64-pc-windows-msvc,
               os: windows-latest,
-              toolchain: '1.61.0'
+              toolchain: '1.61.0',
+              cross: false,
+              command: 'test'
             }
           - {
               target: x86_64-unknown-linux-gnu,
               os: ubuntu-latest,
-              toolchain: '1.57.0'
+              toolchain: '1.57.0',
+              cross: false,
+              command: 'test'
             }
           - {
               target: x86_64-apple-darwin,
               os: macos-latest,
-              toolchain: '1.57.0'
+              toolchain: '1.57.0',
+              cross: false,
+              command: 'test'
+            }
+          - {
+              target: aarch64-apple-ios,
+              os: macos-latest,
+              toolchain: '1.57.0',
+              cross: false,
+              acommand: 'build'
+            }
+          - {
+              target: aarch64-linux-android,
+              os: ubuntu-latest,
+              toolchain: '1.57.0',
+              cross: true,
+              command: 'build'
             }
 
     steps:
@@ -54,6 +77,7 @@ jobs:
         with:
           toolchain: ${{ matrix.platform.toolchain }}
           target: ${{ matrix.platform.target }}
+          override: true
       - name: install Linux dependencies
         if: contains(matrix.platform.target, 'unknown-linux')
         run: |
@@ -99,8 +123,31 @@ jobs:
             ${{ matrix.platform.os }}-${{ matrix.platform.toolchain }}-
             ${{ matrix.platform.os }}-
 
-      - name: test
+      - name: create kotlin out dir
+        if: contains(matrix.platform.target, 'android')
+        run: mkdir out
+
+      - name: pin time
         run: |
-          cargo test --target ${{ matrix.platform.target }}
-          cargo test --target ${{ matrix.platform.target }} --features api-all
-          cargo test --target ${{ matrix.platform.target }} --features compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart
+          cargo update -p time --precise 0.3.13
+
+      - name: test
+        uses: actions-rs/cargo@v1
+        with:
+          use-cross: ${{ matrix.platform.cross }}
+          command: ${{ matrix.platform.command }}
+          args: --target ${{ matrix.platform.target }} --features native-tls-vendored
+
+      - name: test api-all
+        uses: actions-rs/cargo@v1
+        with:
+          use-cross: ${{ matrix.platform.cross }}
+          command: ${{ matrix.platform.command }}
+          args: --target ${{ matrix.platform.target }} --features native-tls-vendored,api-all
+
+      - name: test all features
+        uses: actions-rs/cargo@v1
+        with:
+          use-cross: ${{ matrix.platform.cross }}
+          command: ${{ matrix.platform.command }}
+          args: --target ${{ matrix.platform.target }} --features native-tls-vendored,compression,wry,isolation,custom-protocol,api-all,cli,updater,system-tray,windows7-compat,http-multipart

+ 0 - 1
Cargo.toml

@@ -24,7 +24,6 @@ exclude = [
 
 # default to small, optimized workspace release binaries
 [profile.release]
-strip = true
 panic = "abort"
 codegen-units = 1
 lto = true

+ 3 - 1
core/tauri-codegen/Cargo.toml

@@ -29,9 +29,11 @@ semver = "1"
 ico = "0.1"
 png = "0.17"
 json-patch = "0.2"
-local-ip-address = "0.4"
 url = "2"
 
+[target."cfg(any(windows, target_os = \"linux\", target_os = \"macos\"))".dependencies]
+local-ip-address = "0.4"
+
 [target."cfg(target_os = \"macos\")".dependencies]
 plist = "1"
 time = { version = "0.3", features = [ "parsing", "formatting" ] }

+ 1 - 0
core/tauri-codegen/src/context.rs

@@ -155,6 +155,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
     panic!("unknown codegen target");
   };
 
+  #[cfg(any(windows, target_os = "linux", target_os = "macos"))]
   if dev && (target == Target::Ios || target == Target::Android) {
     if let AppUrl::Url(WindowUrl::External(url)) = &mut config.build.dev_path {
       let localhost = match url.host() {

+ 6 - 1
core/tests/app-updater/tests/update.rs

@@ -100,7 +100,12 @@ fn bundle_path(root_dir: &Path, _version: &str) -> PathBuf {
 
 #[cfg(target_os = "ios")]
 fn bundle_path(root_dir: &Path, _version: &str) -> PathBuf {
-  root_dir.join(format!("target/debug/bundle/ios/app-updater.app"))
+  root_dir.join(format!("target/debug/bundle/ios/app-updater.ipa"))
+}
+
+#[cfg(target_os = "android")]
+fn bundle_path(root_dir: &Path, _version: &str) -> PathBuf {
+  root_dir.join(format!("target/debug/bundle/android/app-updater.apk"))
 }
 
 #[cfg(windows)]