60 lines
1.7 KiB
PowerShell
60 lines
1.7 KiB
PowerShell
$Skip = { param($n, $r) Write-Host ("skip " + $n + ": " + $r) }
|
|
|
|
if (Get-Command go -ErrorAction SilentlyContinue) {
|
|
Push-Location sdk/go
|
|
$unfmt = gofmt -l .
|
|
if ($unfmt) {
|
|
Write-Host $unfmt
|
|
Pop-Location
|
|
exit 1
|
|
}
|
|
go vet ./...
|
|
if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
|
|
go test ./...
|
|
if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
|
|
Pop-Location
|
|
} else {
|
|
& $Skip "sdk/go" "no go"
|
|
}
|
|
|
|
if ((Get-Command node -ErrorAction SilentlyContinue) -and (Test-Path "sdk/js/node_modules")) {
|
|
Push-Location sdk/js
|
|
npx --no-install tsc --noEmit
|
|
if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
|
|
npx --no-install vitest run
|
|
if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
|
|
Pop-Location
|
|
} else {
|
|
& $Skip "sdk/js" "no node or node_modules"
|
|
}
|
|
|
|
$py = Get-Command python -ErrorAction SilentlyContinue
|
|
if (-not $py) {
|
|
$py = Get-Command python3 -ErrorAction SilentlyContinue
|
|
}
|
|
if ($py) {
|
|
$env:PYTHONPATH = (Resolve-Path "sdk/python/src").Path
|
|
& $py.Source -c "import paho.mqtt.client"
|
|
if ($LASTEXITCODE -ne 0) {
|
|
& $Skip "sdk/python" "no paho-mqtt"
|
|
} else {
|
|
& $py.Source -m unittest discover -s sdk/python/tests -t sdk/python
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Remove-Item Env:PYTHONPATH -ErrorAction SilentlyContinue
|
|
exit $LASTEXITCODE
|
|
}
|
|
}
|
|
Remove-Item Env:PYTHONPATH -ErrorAction SilentlyContinue
|
|
} else {
|
|
& $Skip "sdk/python" "no python"
|
|
}
|
|
|
|
if (Get-Command mvn -ErrorAction SilentlyContinue) {
|
|
Push-Location sdk/java
|
|
mvn -q test
|
|
if ($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE }
|
|
Pop-Location
|
|
} else {
|
|
& $Skip "sdk/java" "no mvn"
|
|
}
|