Pārlūkot izejas kodu

perf(workflow) filter workflow with the `paths` option (#828)

* perf(workflow) run bundler test only when the bundler changes

* perf(workflow) split clippy/eslint/fmt checks

* chore(workflow) rerun if workflow file change

* chore(workflow) fix name

* fix(tests) bundler test on windows, removed since it's not used
Lucas Fernandes Nogueira 5 gadi atpakaļ
vecāks
revīzija
f1a8a65be2

+ 7 - 22
.github/workflows/check-on-push.yml → .github/workflows/core-lint-fmt.yml

@@ -1,10 +1,12 @@
-name: clippy, fmt and eslint check
+name: clippy and fmt check
 
 on:
-  push:
-    branches-ignore:
-      - latest
-      - dev
+  pull_request:
+    paths:
+      - .github/workflows/core-lint-fmt.yml
+      - ./tauri/**
+      - ./tauri-utils/**
+      - ./tauri-api/**
 
 jobs:
   workspace_clippy_fmt_check:
@@ -25,11 +27,6 @@ jobs:
         env:
           TAURI_DIST_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/dist
           TAURI_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/src-tauri
-      - uses: actions-rs/clippy-check@v1
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-          args: --manifest-path ./cli/tauri-bundler/Cargo.toml --all-targets -- -D warnings
-          name: bundler
       - uses: actions-rs/toolchain@v1
         with:
             profile: minimal
@@ -62,15 +59,3 @@ jobs:
         env:
           TAURI_DIST_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/dist
           TAURI_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/src-tauri
-
-  eslint-check:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2
-      - uses: actions/setup-node@v1
-      - name: install deps via yarn
-        working-directory: ./cli/tauri.js
-        run: yarn
-      - name: run eslint
-        working-directory: ./cli/tauri.js
-        run: yarn lint

+ 20 - 0
.github/workflows/js-lint.yml

@@ -0,0 +1,20 @@
+name: eslint check
+
+on:
+  pull_request:
+    paths:
+      - .github/workflows/js-lint.yml
+      - ./cli/tauri.js/**
+
+jobs:
+  eslint-check:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-node@v1
+      - name: install deps via yarn
+        working-directory: ./cli/tauri.js
+        run: yarn
+      - name: run eslint
+        working-directory: ./cli/tauri.js
+        run: yarn lint

+ 54 - 0
.github/workflows/test-bundler.yml

@@ -0,0 +1,54 @@
+name: test bundler
+
+on:
+  pull_request:
+    paths:
+      - .github/workflows/test-bundler.yml
+      - ./cli/tauri-bundler/**
+env:
+  RUST_BACKTRACE: 1
+
+jobs:
+  build-tauri-bundler:
+    runs-on: ${{ matrix.platform }}
+
+    strategy:
+      fail-fast: false
+      matrix:
+        platform: [ubuntu-latest, macos-latest, windows-latest]
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: install stable
+        uses: actions-rs/toolchain@v1
+        with:
+          toolchain: stable
+      - name: test
+        run: |
+          cd ./cli/tauri-bundler
+          cargo test
+
+  clippy-fmt-check:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+      - run: rustup component add clippy
+      - name: clippy check
+        uses: actions-rs/clippy-check@v1
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+          args: --manifest-path ./cli/tauri-bundler/Cargo.toml --all-targets -- -D warnings
+          name: bundler
+      - name: install rustfmt
+        uses: actions-rs/toolchain@v1
+        with:
+            profile: minimal
+            toolchain: nightly
+            override: true
+            components: rustfmt
+      - name: fmt check
+        uses: actions-rs/cargo@v1
+        with:
+          command: fmt
+          args: --manifest-path ./cli/tauri-bundler/Cargo.toml --all -- --check

+ 10 - 21
.github/workflows/test-on-pr.yml → .github/workflows/test-core.yml

@@ -1,6 +1,14 @@
-name: test library
+name: test core
+
+on:
+  pull_request:
+    paths:
+      - .github/workflows/test-core.yml
+      - ./cli/**
+      - ./tauri/**
+      - ./tauri-api/**
+      - ./tauri-utils/**
 
-on: pull_request
 env:
   RUST_BACKTRACE: 1
 
@@ -38,25 +46,6 @@ jobs:
           TAURI_DIST_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/dist
           TAURI_DIR: ${{ runner.workspace }}/tauri/tauri/examples/communication/src-tauri
 
-  build-tauri-bundler:
-    runs-on: ${{ matrix.platform }}
-
-    strategy:
-      fail-fast: false
-      matrix:
-        platform: [ubuntu-latest, macos-latest, windows-latest]
-
-    steps:
-      - uses: actions/checkout@v2
-      - name: install stable
-        uses: actions-rs/toolchain@v1
-        with:
-          toolchain: stable
-      - name: build
-        run: |
-          cd ./cli/tauri-bundler
-          cargo build
-
   test-tauri-js-cli:
     runs-on: ${{ matrix.platform }}
 

+ 1 - 0
cli/tauri-bundler/src/bundle/common.rs

@@ -311,6 +311,7 @@ mod tests {
     assert!(tmp.path().join("parent/file.txt").is_file());
   }
 
+  #[cfg(not(windows))]
   #[test]
   fn copy_dir_with_symlinks() {
     // Create a directory structure that looks like this: