feat(ci): cache (#1585)

This commit is contained in:
Lucas Fernandes Nogueira 2021-04-22 17:34:46 -03:00 committed by GitHub
parent a670d3a457
commit ef474e5635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 432 additions and 53 deletions

View File

@ -4,6 +4,9 @@
name: updater test artifacts
on:
push:
branches:
- develop
pull_request:
paths:
- '.github/workflows/artifacts-updater.yml'
@ -27,12 +30,65 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- run: cargo install --path ./tooling/cli.rs --force
- 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 registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache core cargo target
uses: actions/cache@v2
with:
path: target
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-core-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli.rs/target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}
${{ matrix.platform }}-stable-cargo-cli-
- name: install cli deps via yarn
working-directory: ./tooling/cli.js
run: yarn

View File

@ -5,6 +5,9 @@
name: clippy and fmt check
on:
push:
branches:
- develop
pull_request:
paths:
- '.github/workflows/core-lint-fmt.yml'
@ -22,18 +25,56 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- run: rustup component add clippy
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-index-
- name: Cache core cargo target
uses: actions/cache@v2
with:
path: target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-core-
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-targets --all-features -- -D warnings
name: workspace
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
@ -44,18 +85,56 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./tooling/cli.rs/Cargo.toml --all-targets --all-features -- -D warnings
name: cli
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt
components: rustfmt, clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./tooling/cli.rs/Cargo.toml --all-targets --all-features -- -D warnings
name: cli
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-index-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli.rs/target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}
ubuntu-latest-nightly-cargo-cli-
- uses: actions-rs/cargo@v1
with:
command: fmt
@ -73,7 +152,55 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- run: rustup component add clippy
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
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 registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-index-
- name: Cache core cargo target
uses: actions/cache@v2
with:
path: target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-core-
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -5,6 +5,9 @@
name: test bundler
on:
push:
branches:
- develop
pull_request:
paths:
- '.github/workflows/test-bundler.yml'
@ -27,11 +30,54 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- 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 registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache bundler cargo target
uses: actions/cache@v2
with:
path: tooling/bundler/target
# Add date to the cache to keep it up to date
key: ubuntu-latest-stable-cargo-bundler-${{ hashFiles('tooling/bundler/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-bundler-${{ hashFiles('tooling/bundler/Cargo.lock') }}
${{ matrix.platform }}-stable-cargo-bundler-
- name: test
run: |
cd ./tooling/bundler
@ -42,7 +88,14 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: rustup component add clippy
- name: install minimal nightly with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: rustfmt, clippy
- name: install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
@ -54,13 +107,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
args: --manifest-path ./tooling/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:

View File

@ -5,6 +5,9 @@
name: test core
on:
push:
branches:
- develop
pull_request:
paths:
- '.github/workflows/test-core.yml'
@ -35,6 +38,48 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- 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 registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache core cargo target
uses: actions/cache@v2
with:
path: target
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-core-
- name: test
run: |
cargo test
@ -54,9 +99,48 @@ jobs:
with:
toolchain: stable
override: true
- name: build api
working-directory: ./tooling/api
run: yarn && yarn build
- 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 registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli.rs/target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}
${{ matrix.platform }}-stable-cargo-cli-
- name: build CLI
uses: actions-rs/cargo@v1
with:
@ -78,6 +162,48 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- 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 registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
# Add date to the cache to keep it up to date
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('**/Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli.rs/target
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
${{ matrix.platform }}-stable-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}
${{ matrix.platform }}-stable-cargo-cli-
- name: test
timeout-minutes: 30
run: |

View File

@ -24,35 +24,63 @@ jobs:
toolchain: nightly
override: true
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/cache@v2
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-index-${{ hashFiles('**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-index-
- name: Cache core cargo target
uses: actions/cache@v2
with:
path: target
key: ubuntu-latest-nightly-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-core-${{ hashFiles('core/**/Cargo.toml') }}
ubuntu-latest-nightly-cargo-core-
- name: Cache bundler cargo target
uses: actions/cache@v2
with:
path: tooling/bundler/target
key: ubuntu-latest-nightly-cargo-build-bundler-target-${{ hashFiles('**/Cargo.toml') }}
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-bundler-${{ hashFiles('tooling/bundler/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-bundler-${{ hashFiles('tooling/bundler/Cargo.lock') }}
ubuntu-latest-nightly-cargo-bundler-
- name: Cache CLI cargo target
uses: actions/cache@v2
with:
path: tooling/cli.rs/target
key: ubuntu-latest-nightly-cargo-build-cli-target-${{ hashFiles('**/Cargo.toml') }}
# Add date to the cache to keep it up to date
key: ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}-${{ env.CURRENT_DATE }}
# Restore from outdated cache for speed
restore-keys: |
ubuntu-latest-nightly-cargo-cli-${{ hashFiles('tooling/cli.rs/Cargo.lock') }}
ubuntu-latest-nightly-cargo-cli-
- uses: actions-rs/cargo@v1
with:

View File

@ -161,7 +161,7 @@ pub(crate) mod export {
impl<P: Params> Window<P> {
/// Create a new window that is attached to the manager.
pub(crate) fn new(manager: WindowManager<P>, window: DetachedWindow<P>) -> Self {
Self { manager, window }
Self { window, manager }
}
/// The current window's dispatcher.

View File

@ -71,16 +71,14 @@ impl RemoteRelease {
};
// body is optional to build our update
let body = match release.get("notes") {
Some(notes) => Some(notes.as_str().unwrap_or("").to_string()),
None => None,
};
let body = release
.get("notes")
.map(|notes| notes.as_str().unwrap_or("").to_string());
// signature is optional to build our update
let mut signature = match release.get("signature") {
Some(signature) => Some(signature.as_str().unwrap_or("").to_string()),
None => None,
};
let mut signature = release
.get("signature")
.map(|signature| signature.as_str().unwrap_or("").to_string());
let download_url;
@ -103,10 +101,9 @@ impl RemoteRelease {
// make sure we have our target available
if let Some(current_target_data) = platforms.get(target) {
// use provided signature if available
signature = match current_target_data.get("signature") {
Some(found_signature) => Some(found_signature.as_str().unwrap_or("").to_string()),
None => None,
};
signature = current_target_data
.get("signature")
.map(|found_signature| found_signature.as_str().unwrap_or("").to_string());
// Download URL is required
download_url = current_target_data
.get("url")
@ -137,10 +134,10 @@ impl RemoteRelease {
// Return our formatted release
Ok(RemoteRelease {
version,
download_url,
date,
signature,
download_url,
body,
signature,
})
}
}

View File

@ -86,8 +86,8 @@ fn crate_latest_version(name: &str) -> Option<String> {
}
fn npm_latest_version(use_yarn: bool, name: &str) -> crate::Result<Option<String>> {
let mut cmd;
if use_yarn {
let mut cmd;
#[cfg(target_os = "windows")]
{
cmd = Command::new("cmd");
@ -112,7 +112,6 @@ fn npm_latest_version(use_yarn: bool, name: &str) -> crate::Result<Option<String
Ok(None)
}
} else {
let mut cmd;
#[cfg(target_os = "windows")]
{
cmd = Command::new("cmd");
@ -139,8 +138,8 @@ fn npm_package_version<P: AsRef<Path>>(
name: &str,
app_dir: P,
) -> crate::Result<Option<String>> {
let mut cmd;
let output = if use_yarn {
let mut cmd;
#[cfg(target_os = "windows")]
{
cmd = Command::new("cmd");
@ -159,7 +158,6 @@ fn npm_package_version<P: AsRef<Path>>(
.current_dir(app_dir)
.output()?
} else {
let mut cmd;
#[cfg(target_os = "windows")]
{
cmd = Command::new("cmd");