From b41447b8112814937bc83070fe4522cb80bd1f6c Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Fri, 4 Nov 2022 18:26:30 -0300 Subject: [PATCH] feat(ci): use Swatinem/rust-cache@v2 (#5547) --- .github/workflows/artifacts-updater.yml | 65 ++------------- .github/workflows/bench.yml | 54 ++----------- .github/workflows/check-generated-files.yml | 36 +-------- .../workflows/covector-version-or-publish.yml | 59 ++------------ .github/workflows/lint-fmt-cli.yml | 37 +-------- .github/workflows/lint-fmt-core.yml | 43 +--------- .github/workflows/test-bundler.yml | 81 ++----------------- .github/workflows/test-cli-js.yml | 58 ++----------- .github/workflows/test-cli-rs.yml | 41 +--------- .github/workflows/test-core.yml | 41 +--------- .github/workflows/udeps.yml | 70 ++-------------- tooling/bundler/src/bundle/common.rs | 2 +- tooling/bundler/src/bundle/linux/debian.rs | 10 +-- tooling/bundler/src/bundle/path_utils.rs | 4 +- tooling/bundler/src/bundle/platform.rs | 2 +- tooling/bundler/src/bundle/updater_bundle.rs | 4 +- .../plugin/backend/.github/workflows/test.yml | 40 +-------- .../with-api/.github/workflows/test.yml | 41 +--------- 18 files changed, 62 insertions(+), 626 deletions(-) diff --git a/.github/workflows/artifacts-updater.yml b/.github/workflows/artifacts-updater.yml index 2eb1dea7f..0c6d5d5c7 100644 --- a/.github/workflows/artifacts-updater.yml +++ b/.github/workflows/artifacts-updater.yml @@ -4,10 +4,8 @@ name: updater test artifacts on: - push: - branches: - - dev - - next + schedule: + - cron: '0 0 * * *' pull_request: paths: - '.github/workflows/artifacts-updater.yml' @@ -16,7 +14,6 @@ on: 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. concurrency: @@ -45,59 +42,12 @@ jobs: sudo apt-get update sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest' - - - name: Get current date - if: matrix.platform == 'windows-latest' - run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- - - - name: Cache core cargo target - uses: actions/cache@v2 - env: - cache-name: cargo-core - with: - path: target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }} - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- - - - name: Cache CLI cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_cli - with: - path: tooling/cli/target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }} - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- + cache-on-failure: true + workspaces: | + . + tooling/cli - name: build and install cli.rs run: cargo install --path tooling/cli --force @@ -108,6 +58,7 @@ jobs: run: | echo "Enable code signing: ${{ env.ENABLE_CODE_SIGNING != '' }}" echo "::set-output name=enabled::${{ env.ENABLE_CODE_SIGNING != '' }}" + # run only on tauri-apps/tauri repo (require secrets) - name: build sample artifacts + code signing (updater) if: steps.enablecodesigning.outputs.enabled == 'true' diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 3491db02b..52a45570e 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -9,7 +9,6 @@ on: 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. concurrency: @@ -52,54 +51,11 @@ jobs: sudo dpkg -i hyperfine_1.11.0_amd64.deb pip install memory_profiler - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- - - - name: Cache core cargo target - uses: actions/cache@v2 - env: - cache-name: cargo-core - with: - path: target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-${{ matrix.rust }}-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-${{ matrix.rust }}-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }} - ${{ matrix.platform }}-${{ matrix.rust }}-${{ env.cache-name }}- - ${{ matrix.platform }}-${{ matrix.rust }}- - ${{ matrix.platform }}- - - - name: cache cargo `tooling/bench/tests` target - uses: actions/cache@v2 - env: - cache-name: cargo_benches - with: - path: tooling/bench/tests/target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-${{ matrix.rust }}-${{ env.cache-name }}-${{ hashFiles('tooling/bench/tests/Cargo.lock') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-${{ matrix.rust }}-${{ env.cache-name }}-${{ hashFiles('tooling/bench/tests/Cargo.lock') }} - ${{ matrix.platform }}-${{ matrix.rust }}-${{ env.cache-name }}- - ${{ matrix.platform }}-${{ matrix.rust }}- - ${{ matrix.platform }}- + workspaces: | + . + tooling/bench/tests - name: run benchmarks run: | @@ -126,7 +82,7 @@ jobs: git commit --message "Update Tauri benchmarks" git push origin gh-pages - - name: Worker info + - name: Print worker info run: | cat /proc/cpuinfo cat /proc/meminfo diff --git a/.github/workflows/check-generated-files.yml b/.github/workflows/check-generated-files.yml index 58686ddee..538d464bc 100644 --- a/.github/workflows/check-generated-files.yml +++ b/.github/workflows/check-generated-files.yml @@ -44,6 +44,7 @@ jobs: if: needs.changes.outputs.bundle == 'true' steps: - uses: actions/checkout@v2 + - name: generate bundle working-directory: tooling/api run: yarn && yarn build @@ -57,7 +58,6 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions/checkout@v2 - name: install stable uses: actions-rs/toolchain@v1 with: @@ -69,39 +69,7 @@ jobs: sudo apt-get update sudo apt-get install -y libgtk-3-dev - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state - with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ubuntu-latest-stable-${{ env.cache-name }}- - ubuntu-latest-stable- - ubuntu-latest- - - - name: Cache core cargo target - uses: actions/cache@v2 - env: - cache-name: cargo-core - with: - path: target - # Add date to the cache to keep it up to date - key: ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }} - ubuntu-latest-stable-${{ env.cache-name }}- - ubuntu-latest-stable- - ubuntu-latest- + - uses: Swatinem/rust-cache@v2 - name: generate schema.json uses: actions-rs/cargo@v1 diff --git a/.github/workflows/covector-version-or-publish.yml b/.github/workflows/covector-version-or-publish.yml index f4c702f71..135fa3afa 100644 --- a/.github/workflows/covector-version-or-publish.yml +++ b/.github/workflows/covector-version-or-publish.yml @@ -16,8 +16,7 @@ jobs: strategy: fail-fast: false matrix: - # platform: [ubuntu-latest, macos-latest, windows-latest] - platform: [ubuntu-latest, macos-latest] + platform: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v2 @@ -33,59 +32,11 @@ jobs: sudo apt-get update sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest' - - - name: Get current date - if: matrix.platform == 'windows-latest' - run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- - - - name: Cache core cargo target - uses: actions/cache@v2 - env: - cache-name: cargo-core - with: - path: target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }} - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- - - - name: Cache CLI cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_cli - with: - path: tooling/cli/target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }} - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- + workspaces: | + . + tooling/cli - name: build CLI uses: actions-rs/cargo@v1 diff --git a/.github/workflows/lint-fmt-cli.yml b/.github/workflows/lint-fmt-cli.yml index 1ba2f3a70..6c5786919 100644 --- a/.github/workflows/lint-fmt-cli.yml +++ b/.github/workflows/lint-fmt-cli.yml @@ -16,7 +16,6 @@ on: 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. concurrency: @@ -55,44 +54,14 @@ jobs: override: true components: clippy - - name: install Linux dependencies + - name: install dependencies run: | sudo apt-get update sudo apt-get install -y libgtk-3-dev - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ubuntu-latest-stable-${{ env.cache-name }}- - ubuntu-latest-stable- - ubuntu-latest- - - - name: Cache CLI cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_cli - with: - path: tooling/cli/target - # Add date to the cache to keep it up to date - key: ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }} - ubuntu-latest-stable-${{ env.cache-name }}- - ubuntu-latest-stable- - ubuntu-latest- + workspaces: tooling/cli - uses: actions-rs/clippy-check@v1 with: diff --git a/.github/workflows/lint-fmt-core.yml b/.github/workflows/lint-fmt-core.yml index 6bc15c0fa..57c69eed4 100644 --- a/.github/workflows/lint-fmt-core.yml +++ b/.github/workflows/lint-fmt-core.yml @@ -18,7 +18,6 @@ on: 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. concurrency: @@ -59,7 +58,8 @@ jobs: steps: - uses: actions/checkout@v2 - - name: install webkit2gtk + + - name: install dependencies run: | sudo apt-get update sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf @@ -71,44 +71,7 @@ jobs: override: true components: clippy - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest' - - - name: Get current date - if: matrix.platform == 'windows-latest' - run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state - with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ubuntu-latest-stable-${{ env.cache-name }}- - ubuntu-latest-stable- - ubuntu-latest- - - - name: Cache core cargo target - uses: actions/cache@v2 - env: - cache-name: cargo-core - with: - path: target - # Add date to the cache to keep it up to date - key: ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ubuntu-latest-stable-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }} - ubuntu-latest-stable-${{ env.cache-name }}- - ubuntu-latest-stable- - ubuntu-latest- + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/clippy-check@v1 with: diff --git a/.github/workflows/test-bundler.yml b/.github/workflows/test-bundler.yml index 6239a2235..a39fd2717 100644 --- a/.github/workflows/test-bundler.yml +++ b/.github/workflows/test-bundler.yml @@ -16,7 +16,6 @@ on: 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. concurrency: @@ -34,49 +33,13 @@ jobs: steps: - uses: actions/checkout@v2 + - name: install stable uses: actions-rs/toolchain@v1 with: toolchain: stable - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest' - - - name: Get current date - if: matrix.platform == 'windows-latest' - run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state - with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- - - - name: Cache bundler cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_bundler - with: - path: tooling/bundler/target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/bundler/Cargo.lock') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/bundler/Cargo.lock') }} - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- + - uses: Swatinem/rust-cache@v2 - name: test run: | @@ -106,6 +69,7 @@ jobs: steps: - uses: actions/checkout@v2 + - name: install minimal stable with clippy and rustfmt uses: actions-rs/toolchain@v1 with: @@ -114,44 +78,9 @@ jobs: override: true components: rustfmt, clippy - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest' - - - name: Get current date - if: matrix.platform == 'windows-latest' - run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- - - - name: Cache bundler cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_bundler - with: - path: tooling/bundler/target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/bundler/Cargo.lock') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/bundler/Cargo.lock') }} - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- + workspaces: tooling/bundler - name: clippy check uses: actions-rs/clippy-check@v1 diff --git a/.github/workflows/test-cli-js.yml b/.github/workflows/test-cli-js.yml index 4b2496cad..20a4ee299 100644 --- a/.github/workflows/test-cli-js.yml +++ b/.github/workflows/test-cli-js.yml @@ -17,7 +17,6 @@ on: 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. concurrency: @@ -35,6 +34,7 @@ jobs: steps: - uses: actions/checkout@v2 + - name: install Rust stable uses: actions-rs/toolchain@v1 with: @@ -53,59 +53,11 @@ jobs: sudo apt-get update sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest' - - - name: Get current date - if: matrix.platform == 'windows-latest' - run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- - - - name: Cache CLI cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_cli - with: - path: tooling/cli/target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }} - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- - - - name: Cache template cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_template - with: - path: tooling/cli/node/test/jest/fixtures/empty/src-tauri/target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/templates/app/**') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/templates/app/**') }} - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- + workspaces: | + tooling/cli + tooling/cli/node/test/jest/fixtures/empty/src-tauri - name: test timeout-minutes: 30 diff --git a/.github/workflows/test-cli-rs.yml b/.github/workflows/test-cli-rs.yml index 9d4a70b0a..528de8517 100644 --- a/.github/workflows/test-cli-rs.yml +++ b/.github/workflows/test-cli-rs.yml @@ -16,7 +16,6 @@ on: 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. concurrency: @@ -34,6 +33,7 @@ jobs: steps: - uses: actions/checkout@v2 + - name: install stable uses: actions-rs/toolchain@v1 with: @@ -46,44 +46,9 @@ jobs: sudo apt-get update sudo apt-get install -y libgtk-3-dev - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - if: matrix.platform == 'macos-latest' || matrix.platform == 'ubuntu-latest' - - - name: Get current date - if: matrix.platform == 'windows-latest' - run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- - - - name: Cache CLI cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_cli - with: - path: tooling/cli/target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform }}-stable-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }} - ${{ matrix.platform }}-stable-${{ env.cache-name }}- - ${{ matrix.platform }}-stable- - ${{ matrix.platform }}- + workspaces: tooling/cli - name: build CLI uses: actions-rs/cargo@v1 diff --git a/.github/workflows/test-core.yml b/.github/workflows/test-core.yml index 92c294892..625e5e265 100644 --- a/.github/workflows/test-core.yml +++ b/.github/workflows/test-core.yml @@ -17,7 +17,6 @@ on: 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. concurrency: @@ -50,6 +49,7 @@ jobs: steps: - uses: actions/checkout@v2 + - name: install stable uses: actions-rs/toolchain@v1 with: @@ -62,44 +62,7 @@ jobs: sudo apt-get update sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - if: matrix.platform.os == 'macos-latest' || matrix.platform.os == 'ubuntu-latest' - - - name: Get current date - if: matrix.platform.os == 'windows-latest' - run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state - with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ matrix.platform.os }}-${{ matrix.platform.toolchain }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ${{ matrix.platform.os }}-${{ matrix.platform.toolchain }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ${{ matrix.platform.os }}-${{ matrix.platform.toolchain }}-${{ env.cache-name }}- - ${{ matrix.platform.os }}-${{ matrix.platform.toolchain }}- - ${{ matrix.platform.os }}- - - - name: Cache core cargo target - uses: actions/cache@v2 - env: - cache-name: cargo-core - with: - path: target - # Add date to the cache to keep it up to date - key: ${{ matrix.platform.os }}-${{ matrix.platform.toolchain }}-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.platform.os }}-${{ matrix.platform.toolchain }}-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }} - ${{ matrix.platform.os }}-${{ matrix.platform.toolchain }}-${{ env.cache-name }}- - ${{ matrix.platform.os }}-${{ matrix.platform.toolchain }}- - ${{ matrix.platform.os }}- + - uses: Swatinem/rust-cache@v2 - name: test run: | diff --git a/.github/workflows/udeps.yml b/.github/workflows/udeps.yml index 73255477f..f1e45281f 100644 --- a/.github/workflows/udeps.yml +++ b/.github/workflows/udeps.yml @@ -12,7 +12,6 @@ on: 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. concurrency: @@ -135,74 +134,17 @@ jobs: toolchain: nightly override: true - - name: install Linux dependencies + - name: install dependencies run: | sudo apt-get update sudo apt-get install -y libgtk-3-dev - - name: Get current date - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ubuntu-latest-nightly-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ubuntu-latest-nightly-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ubuntu-latest-nightly-${{ env.cache-name }}- - ubuntu-latest-nightly- - ubuntu-latest- - - - name: Cache core cargo target - uses: actions/cache@v2 - env: - cache-name: cargo-core - with: - path: target - # Add date to the cache to keep it up to date - key: ubuntu-latest-nightly-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ubuntu-latest-nightly-${{ env.cache-name }}-${{ hashFiles('core/**/Cargo.toml') }} - ubuntu-latest-nightly-${{ env.cache-name }}- - ubuntu-latest-nightly- - ubuntu-latest- - - - name: Cache bundler cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_bundler - with: - path: tooling/bundler/target - # Add date to the cache to keep it up to date - key: ubuntu-latest-nightly-${{ env.cache-name }}-${{ hashFiles('tooling/bundler/Cargo.lock') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ubuntu-latest-nightly-${{ env.cache-name }}-${{ hashFiles('tooling/bundler/Cargo.lock') }} - ubuntu-latest-nightly-${{ env.cache-name }}- - ubuntu-latest-nightly- - ubuntu-latest- - - - name: Cache CLI cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_cli - with: - path: tooling/cli/target - # Add date to the cache to keep it up to date - key: ubuntu-latest-nightly-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ubuntu-latest-nightly-${{ env.cache-name }}-${{ hashFiles('tooling/cli/Cargo.lock') }} - ubuntu-latest-nightly-${{ env.cache-name }}- - ubuntu-latest-nightly- - ubuntu-latest- + workspaces: | + . + tooling/cli + tooling/bundler - name: Download udeps uses: actions/download-artifact@v3 diff --git a/tooling/bundler/src/bundle/common.rs b/tooling/bundler/src/bundle/common.rs index c2f9d66ed..19e91b15e 100644 --- a/tooling/bundler/src/bundle/common.rs +++ b/tooling/bundler/src/bundle/common.rs @@ -32,7 +32,7 @@ pub fn is_retina>(path: P) -> bool { /// needed. pub fn create_file(path: &Path) -> crate::Result> { if let Some(parent) = path.parent() { - fs::create_dir_all(&parent)?; + fs::create_dir_all(parent)?; } let file = File::create(path)?; Ok(BufWriter::new(file)) diff --git a/tooling/bundler/src/bundle/linux/debian.rs b/tooling/bundler/src/bundle/linux/debian.rs index c8e5fa207..826a79f8b 100644 --- a/tooling/bundler/src/bundle/linux/debian.rs +++ b/tooling/bundler/src/bundle/linux/debian.rs @@ -254,10 +254,10 @@ fn copy_custom_files(settings: &Settings, data_dir: &Path) -> crate::Result<()> common::copy_file(path, data_dir.join(deb_path))?; } else { let out_dir = data_dir.join(deb_path); - for entry in walkdir::WalkDir::new(&path) { + for entry in walkdir::WalkDir::new(path) { let entry_path = entry?.into_path(); if entry_path.is_file() { - let without_prefix = entry_path.strip_prefix(&path).unwrap(); + let without_prefix = entry_path.strip_prefix(path).unwrap(); common::copy_file(&entry_path, out_dir.join(without_prefix))?; } } @@ -319,7 +319,7 @@ fn create_file_with_data>(path: P, data: &str) -> crate::Result<( /// contents. fn total_dir_size(dir: &Path) -> crate::Result { let mut total: u64 = 0; - for entry in WalkDir::new(&dir) { + for entry in WalkDir::new(dir) { total += entry?.metadata()?.len(); } Ok(total) @@ -329,13 +329,13 @@ fn total_dir_size(dir: &Path) -> crate::Result { fn create_tar_from_dir, W: Write>(src_dir: P, dest_file: W) -> crate::Result { let src_dir = src_dir.as_ref(); let mut tar_builder = tar::Builder::new(dest_file); - for entry in WalkDir::new(&src_dir) { + for entry in WalkDir::new(src_dir) { let entry = entry?; let src_path = entry.path(); if src_path == src_dir { continue; } - let dest_path = src_path.strip_prefix(&src_dir)?; + let dest_path = src_path.strip_prefix(src_dir)?; if entry.file_type().is_dir() { tar_builder.append_dir(dest_path, src_path)?; } else { diff --git a/tooling/bundler/src/bundle/path_utils.rs b/tooling/bundler/src/bundle/path_utils.rs index f0cb4b4b7..efde257c2 100644 --- a/tooling/bundler/src/bundle/path_utils.rs +++ b/tooling/bundler/src/bundle/path_utils.rs @@ -182,7 +182,7 @@ where let dir_content = get_dir_info(from, &read_options)?; for directory in dir_content.directories { let tmp_to = Path::new(&directory).strip_prefix(from)?; - let dir = to.join(&tmp_to); + let dir = to.join(tmp_to); if !dir.exists() { if options.copy_files { create_all(dir, false)?; @@ -195,7 +195,7 @@ where for file in dir_content.files { let to = to.to_path_buf(); let tp = Path::new(&file).strip_prefix(from)?; - let path = to.join(&tp); + let path = to.join(tp); let file_options = FileOpts { overwrite: options.overwrite, diff --git a/tooling/bundler/src/bundle/platform.rs b/tooling/bundler/src/bundle/platform.rs index 5fa4d2cf5..d06300a3c 100644 --- a/tooling/bundler/src/bundle/platform.rs +++ b/tooling/bundler/src/bundle/platform.rs @@ -39,7 +39,7 @@ fn parse_rust_cfg(cfg: String) -> RustCfg { /// * Errors: /// * Unexpected system config pub fn target_triple() -> Result { - let arch_res = Command::new("rustc").args(&["--print", "cfg"]).output_ok(); + let arch_res = Command::new("rustc").args(["--print", "cfg"]).output_ok(); let arch = match arch_res { Ok(output) => parse_rust_cfg(String::from_utf8_lossy(&output.stdout).into()) diff --git a/tooling/bundler/src/bundle/updater_bundle.rs b/tooling/bundler/src/bundle/updater_bundle.rs index 10925472d..069efc3d4 100644 --- a/tooling/bundler/src/bundle/updater_bundle.rs +++ b/tooling/bundler/src/bundle/updater_bundle.rs @@ -230,7 +230,7 @@ fn create_tar_from_src, W: Write>(src_dir: P, dest_file: W) -> cr tar_builder.append_file(file_name, &mut src_file)?; } else { - for entry in walkdir::WalkDir::new(&src_dir) { + for entry in walkdir::WalkDir::new(src_dir) { let entry = entry?; let src_path = entry.path(); if src_path == src_dir { @@ -241,7 +241,7 @@ fn create_tar_from_src, W: Write>(src_dir: P, dest_file: W) -> cr // /dev/src-tauri/target/debug/bundle/osx/app.app // We need a tar with app.app/<...> (source root folder should be included) // safe to unwrap: the path has a parent - let dest_path = src_path.strip_prefix(&src_dir.parent().unwrap())?; + let dest_path = src_path.strip_prefix(src_dir.parent().unwrap())?; if entry.file_type().is_dir() { tar_builder.append_dir(dest_path, src_path)?; } else { diff --git a/tooling/cli/templates/plugin/backend/.github/workflows/test.yml b/tooling/cli/templates/plugin/backend/.github/workflows/test.yml index eb16ea83e..284e08cf9 100755 --- a/tooling/cli/templates/plugin/backend/.github/workflows/test.yml +++ b/tooling/cli/templates/plugin/backend/.github/workflows/test.yml @@ -31,49 +31,13 @@ jobs: toolchain: stable override: true - - name: Install gtk on Ubuntu + - name: Install Linux dependencies if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install -y webkit2gtk-4.0 - - name: Get current date - if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - - name: Get current date - if: matrix.os == 'windows-latest' - run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state - with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ${{ matrix.os }}-stable-${{ env.cache-name }}- - ${{ matrix.os }}-stable- - ${{ matrix.os }}- - - - name: Cache cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_build - with: - path: ${{ matrix.project}}/target - # Add date to the cache to keep it up to date - key: ${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }} - ${{ matrix.os }}-stable-${{ env.cache-name }}- - ${{ matrix.os }}-stable- - ${{ matrix.os }}- + - uses: Swatinem/rust-cache@v2 - name: Run tests uses: actions-rs/cargo@v1 diff --git a/tooling/cli/templates/plugin/with-api/.github/workflows/test.yml b/tooling/cli/templates/plugin/with-api/.github/workflows/test.yml index eb16ea83e..818230873 100644 --- a/tooling/cli/templates/plugin/with-api/.github/workflows/test.yml +++ b/tooling/cli/templates/plugin/with-api/.github/workflows/test.yml @@ -31,49 +31,12 @@ jobs: toolchain: stable override: true - - name: Install gtk on Ubuntu - if: matrix.os == 'ubuntu-latest' + - name: Install Linux dependencies run: | sudo apt-get update sudo apt-get install -y webkit2gtk-4.0 - - name: Get current date - if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' - run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV - - name: Get current date - if: matrix.os == 'windows-latest' - run: echo "CURRENT_DATE=$(Get-Date -Format "yyyy-MM-dd")" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - - name: Cache cargo state - uses: actions/cache@v2 - env: - cache-name: cargo_state - with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - restore-keys: | - ${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}- - ${{ matrix.os }}-stable-${{ env.cache-name }}- - ${{ matrix.os }}-stable- - ${{ matrix.os }}- - - - name: Cache cargo target - uses: actions/cache@v2 - env: - cache-name: cargo_build - with: - path: ${{ matrix.project}}/target - # Add date to the cache to keep it up to date - key: ${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }} - # Restore from outdated cache for speed - restore-keys: | - ${{ matrix.os }}-stable-${{ env.cache-name }}-${{ hashFiles('**/Cargo.toml') }} - ${{ matrix.os }}-stable-${{ env.cache-name }}- - ${{ matrix.os }}-stable- - ${{ matrix.os }}- + - uses: Swatinem/rust-cache@v2 - name: Run tests uses: actions-rs/cargo@v1