tauri/.scripts/cargo-check.ps1
Amr Bashir fc2e4083b0
ci: check for change tag (#7149)
* ci: check for change tag

* fix workflow

* Update .scripts/ci/check-change-tags.js

* feat: also check if tag is known

seems like covector does not check that so we can do it here for now

* remove push run

* only check changed files

* add missing tag

---------

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
2023-06-07 16:32:36 +03:00

56 lines
1.1 KiB
PowerShell
Executable File

#!/usr/bin/env pwsh
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
# note: you can pass in the cargo sub-commands used to check manually.
# allowed commands: check, clippy, fmt, test
# default: clippy, fmt, test
# set the script arguments if none are found
if(-Not $args) {
$args=@("clippy","fmt","test")
}
# exit the script early if the last command returned an error
function check_error {
if($LASTEXITCODE -ne 0 ) {
Exit $LASTEXITCODE
}
}
function run {
$command, $_args = $args
Write-Output "[$command]"
cargo $command --workspace --all-targets --all-features $_args
check_error
}
foreach ($command in $args) {
Switch ($command) {
"check" {
run check
break
}
"test" {
run test
break
}
"clippy" {
run clippy "--" -D warnings
break
}
"fmt" {
Write-Output "[$command] checking formatting"
cargo +nightly fmt "--" --check
check_error
}
default {
Write-Output "[cargo-check.ps1] Unknown cargo sub-command: $command"
Exit 1
}
}
}