feat(ci): use Swatinem/rust-cache@v2 (#5547)

This commit is contained in:
Lucas Fernandes Nogueira 2022-11-04 18:26:30 -03:00 committed by GitHub
parent aa119f2836
commit b41447b811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 62 additions and 626 deletions

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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: |

View File

@ -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

View File

@ -32,7 +32,7 @@ pub fn is_retina<P: AsRef<Path>>(path: P) -> bool {
/// needed.
pub fn create_file(path: &Path) -> crate::Result<BufWriter<File>> {
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))

View File

@ -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<P: AsRef<Path>>(path: P, data: &str) -> crate::Result<(
/// contents.
fn total_dir_size(dir: &Path) -> crate::Result<u64> {
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<u64> {
fn create_tar_from_dir<P: AsRef<Path>, W: Write>(src_dir: P, dest_file: W) -> crate::Result<W> {
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 {

View File

@ -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,

View File

@ -39,7 +39,7 @@ fn parse_rust_cfg(cfg: String) -> RustCfg {
/// * Errors:
/// * Unexpected system config
pub fn target_triple() -> Result<String, crate::Error> {
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())

View File

@ -230,7 +230,7 @@ fn create_tar_from_src<P: AsRef<Path>, 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<P: AsRef<Path>, 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 {

View File

@ -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

View File

@ -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