-
Notifications
You must be signed in to change notification settings - Fork 0
/
project.ps1
40 lines (37 loc) · 1.45 KB
/
project.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
switch ($args[0]) {
'build' {
$IdfImageTag = $args[1]
$SonarScannerVersion = $args[2]
&docker buildx build --build-arg IDF_IMAGE_TAG=$IdfImageTag --build-arg SONAR_SCANNER_VERSION=$SonarScannerVersion --tag esp32-docker-sonar:$IdfImageTag --no-cache ./src
}
'test' {
$IdfImageTag = $args[1]
$SonarScannerOrganization = $args[2]
$SonarScannerToken = $args[3]
$ProjectPath = $args[4]
&docker run --rm `
--env SONARCLOUD_ORGANIZATION=$SonarScannerOrganization `
--env SONARCLOUD_TOKEN=$SonarScannerToken `
-v $ProjectPath\:/project `
-w /project `
esp32-docker-sonar:$IdfImageTag `
idf.py build
}
'test-no-sonar' {
$IdfImageTag = $args[1]
$ProjectPath = $args[2]
&docker run --rm `
--env SONARCLOUD_ORGANIZATION= `
--env SONARCLOUD_TOKEN= `
-v $ProjectPath\:/project `
-w /project `
esp32-docker-sonar:$IdfImageTag `
idf.py build
}
Default {
Write-Host "Command not recognized. Valid commands:"
Write-Host "`t* build {imageTag} {sonarScannerVersion}: build the image"
Write-Host "`t* test {imageTag} {sonarScannerOrganization} {sonarScannerToken} {projectPath}: test the image with Sonar Cloud"
Write-Host "`t* test-no-sonar {imageTag} {projectPath}: test the image without Sonar Cloud"
}
}