Skip to content

Commit 7c54eda

Browse files
[EngSys] adding triggers on eng for internal and azcore (#15161)
* adding eng for internal and azcore * adding a parameter for specifying the service directory * fixing script * fixing pipeline * do not run golangci on tests * adding false flag silencer * run lint on tests
1 parent e7e795b commit 7c54eda

File tree

6 files changed

+19
-6
lines changed

6 files changed

+19
-6
lines changed

eng/.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
run:
33
# default is true. Enables skipping of directories:
44
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
5-
skip-dirs-use-default: true
5+
skip-dirs-use-default: true

eng/pipelines/templates/steps/build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ steps:
4747
env:
4848
GO111MODULE: 'on'
4949
50-
- pwsh: ../eng/scripts/create_coverage.ps1
50+
- pwsh: ../eng/scripts/create_coverage.ps1 ${{parameters.ServiceDirectory}}
5151
displayName: 'Generate Coverage XML'
5252
workingDirectory: '${{parameters.GoWorkspace}}sdk'
5353

eng/scripts/create_coverage.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#Requires -Version 7.0
22

3+
Param(
4+
[string] $serviceDirectory
5+
)
6+
7+
Write-Host $serviceDirectory
8+
39
$coverageFiles = [Collections.Generic.List[String]]@()
410
Get-ChildItem -recurse -path . -filter coverage.txt | ForEach-Object {
511
$covFile = $_.FullName
@@ -16,4 +22,4 @@ Get-Content ./coverage.json | gocov-xml > ./coverage.xml
1622
Get-Content ./coverage.json | gocov-html > ./coverage.html
1723

1824
# use internal tool to fail if coverage is too low
19-
go run ../tools/internal/coverage/main.go
25+
go run ../tools/internal/coverage/main.go -serviceDirectory $serviceDirectory

sdk/azcore/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ trigger:
33
paths:
44
include:
55
- sdk/azcore/
6+
- eng/
67

78
pr:
89
paths:
910
include:
1011
- sdk/azcore/
12+
- eng/
1113

1214

1315
stages:

sdk/azcore/log.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ func (l *Logger) Writef(cls LogClassification, format string, a ...interface{})
9292
l.lst(cls, fmt.Sprintf(format, a...))
9393
}
9494

95-
// for testing purposes
96-
func (l *Logger) resetClassifications() {
95+
// for testing purposes, nolint is a false positive
96+
func (l *Logger) resetClassifications() { //nolint:unused
9797
l.cls = nil
9898
}
9999

tools/internal/coverage/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"encoding/json"
5+
"flag"
56
"fmt"
67
"io/ioutil"
78
"log"
@@ -79,14 +80,18 @@ func findCoverageGoal(covFiles []string, configData *CodeCoverage) float64 {
7980
}
8081

8182
func main() {
83+
84+
serviceDir := flag.String("serviceDirectory", "", "Service Directory")
85+
flag.Parse()
86+
8287
coverageFiles = make([]string, 0)
8388
rootPath, err := filepath.Abs(".")
8489
check(err)
8590

8691
FindCoverageFiles(rootPath)
8792

8893
configData := ReadConfigData()
89-
coverageGoal := findCoverageGoal(coverageFiles, configData)
94+
coverageGoal := findCoverageGoal([]string{*serviceDir}, configData)
9095

9196
fmt.Printf("Failing if the coverage is below %.2f\n", coverageGoal)
9297

0 commit comments

Comments
 (0)