Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR cognitiveservices/v2.0/luis] Fix json format by prettier #555

Open
wants to merge 8 commits into
base: sdkAutomationPPE/cognitiveservices_v2.0_luis
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 47 additions & 16 deletions .azure-pipelines/BuildTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,66 @@ jobs:
strategy:
matrix:
Linux_Go112:
vm.image: 'Ubuntu 18.04'
vm.image: 'ubuntu-18.04'
go.version: '1.12'
GOROOT: '/usr/local/go$(go.version)'
Linux_Go113:
vm.image: 'Ubuntu 18.04'
vm.image: 'ubuntu-18.04'
go.version: '1.13'
GOROOT: '/usr/local/go$(go.version)'

pool:
vmImage: $(vm.image)

variables:
GOPATH: '$(System.DefaultWorkingDirectory)/work'
sdkPath: '$(GOPATH)/src/github.com/Azure/azure-sdk-for-go'

steps:
- template: steps/InitWorkspace.yml
- template: steps/Vet.yml
parameters:
folder: '.'
- template: steps/Build.yml
parameters:
folder: '.'
- script: |
set -e
echo $(readlink -m $(System.DefaultWorkingDirectory))
mkdir -p '$(GOPATH)/bin'
mkdir -p '$(sdkPath)'
shopt -s dotglob extglob
mv !(work) '$(sdkPath)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
echo '##vso[task.prependpath]$(GOPATH)/bin'
displayName: 'Create Go Workspace'
- script: |
set -e
go version
curl -sSL https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure -v
go get -u golang.org/x/lint/golint
workingDirectory: '$(sdkPath)'
displayName: 'Install Dependencies'
- script: go vet $(go list ./... | grep -v vendor)
workingDirectory: '$(sdkPath)'
displayName: 'Vet'
- script: go build -v $(go list ./... | grep -v vendor)
workingDirectory: '$(sdkPath)'
displayName: 'Build'
- script: go test $(dirname $(find . -path ./vendor -prune -o -name '*_test.go' -print) | sort -u)
workingDirectory: '$(sdkPath)'
displayName: 'Run Tests'
- script: go run ./tools/pkgchk/main.go ./services --exceptions ./tools/pkgchk/exceptions.txt
workingDirectory: '$(sdkPath)'
displayName: 'Verify Package Directory'
- template: steps/CheckCopyrightHeader.yml
parameters:
folder: '.'
- template: steps/CheckFormat.yml
parameters:
folder: '.'
- template: steps/LinterCheck.yml
- script: grep -L -r --include *.go --exclude-dir vendor -P "Copyright (\d{4}|\(c\)) Microsoft" ./ | tee >&2
workingDirectory: '$(sdkPath)'
displayName: 'Copyright Header Check'
failOnStderr: true
condition: succeededOrFailed()
- script: gofmt -s -l -w $(find . -path ./vendor -prune -o -name '*.go' -print) >&2
workingDirectory: '$(sdkPath)'
displayName: 'Format Check'
failOnStderr: true
condition: succeededOrFailed()
- script: |
golint ./storage/... >&2
golint ./tools/... >&2
workingDirectory: '$(sdkPath)'
displayName: 'Linter Check'
failOnStderr: true
condition: succeededOrFailed()
68 changes: 53 additions & 15 deletions .azure-pipelines/ModuleRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,58 @@ jobs:

variables:
GOROOT: '/usr/local/go1.12'
GOPATH: '$(System.DefaultWorkingDirectory)/work'
sdkPath: '$(GOPATH)/src/github.com/Azure/azure-sdk-for-go'

steps:
- template: steps/InitWorkspace.yml
- template: steps/SetGithub.yml
- template: steps/GenerateProfiles.yml
- template: steps/Vet.yml
parameters:
folder: './profiles'
- template: steps/CheckFormat.yml
parameters:
folder: './profiles'
- template: steps/CheckCopyrightHeader.yml
parameters:
folder: './profiles'
- script: |
# Enable bash verbose logging
set -x
echo $(readlink -m $(System.DefaultWorkingDirectory))
mkdir -p '$(GOPATH)/bin'
mkdir -p '$(sdkPath)'
shopt -s dotglob extglob
mv !(work) '$(sdkPath)'
echo '##vso[task.prependpath]$(GOROOT)/bin'
echo '##vso[task.prependpath]$(GOPATH)/bin'
displayName: 'Create Go Workspace'
- script: |
set -x
go version
curl -sSL https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure -v
go get -u golang.org/x/lint/golint
workingDirectory: '$(sdkPath)'
displayName: 'Install Dependencies'
- script: |
# Echo error if github-pat is empty
[ -z $(github-pat) ] && echo "github-pat is empty!" && exit -1
echo $(Build.SourceBranchName)
# Enable bash verbose logging
set -x
git checkout $(Build.SourceBranchName)
git config user.email "azuresdkci@microsoft.com"
git config user.name "azuresdkci"
git config credential.helper store
echo https://$(github-pat):x-oauth-basic@github.com > ~/.git-credentials
displayName: 'Setup github'
workingDirectory: '$(sdkPath)'
- script: |
go generate ./profiles
gofmt -s -w ./profiles
workingDirectory: '$(sdkPath)'
displayName: 'Generate profiles'
- script: go vet $(go list ./profiles/... | grep -v vendor)
workingDirectory: '$(sdkPath)'
displayName: 'Vet in profiles'
- script: go build -v $(go list ./profiles/... | grep -v vendor)
workingDirectory: '$(sdkPath)'
displayName: 'Build'
- script: gofmt -s -l -w $(find ./profiles -path ./vendor -prune -o -name '*.go' -print) >&2
workingDirectory: '$(sdkPath)'
displayName: 'Format Check'
failOnStderr: true
condition: succeededOrFailed()
- script: |
# test if there are new profiles
if [ -z "$(git status --porcelain)" ]; then
Expand All @@ -28,7 +66,7 @@ jobs:
git push origin $(Build.SourceBranchName)
fi
workingDirectory: '$(sdkPath)'
displayName: 'Push Profiles'
displayName: 'Push profiles'
- script: go run ./tools/moduler/main.go ./services -v
displayName: 'Run Moduler'
workingDirectory: '$(sdkPath)'
displayName: 'Detecting new tag and push'
workingDirectory: '$(sdkPath)'
6 changes: 1 addition & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ trigger:
include:
- master

variables:
GOPATH: '$(System.DefaultWorkingDirectory)/work'
sdkPath: '$(GOPATH)/src/github.com/Azure/azure-sdk-for-go'

stages:
- stage: Build_Test
jobs:
- template: .azure-pipelines/BuildTest.yml

- stage: Module_Release
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI'))
condition: in(variables['Build.Reason'], 'IndividualCI')
jobs:
- template: .azure-pipelines/ModuleRelease.yml
2 changes: 1 addition & 1 deletion services/cognitiveservices/v2.0/luis/authoring/version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion services/cognitiveservices/v3.0/luis/runtime/version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions services/preview/cognitiveservices/v3.0/luis/runtime/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/Azure/azure-sdk-for-go/services/preview/cognitiveservices/v3.0/luis/runtime

go 1.12
21 changes: 0 additions & 21 deletions tools/moduler/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,6 @@ var (
"tools/testdata/scenarioe/foo/v1.1.0",
"tools/testdata/scenarioe/foo/v2.0.0",
"tools/testdata/scenarioe/foo/v2.1.0",
"tools/testdata/scenariog/foo/mgmt/2019-10-11/foo/v1.0.0",
"tools/testdata/scenarioh/foo/mgmt/2019-10-11/foo/v1.0.0",
"tools/testdata/scenarioh/foo/mgmt/2019-10-11/foo/v1.1.0",
"tools/testdata/scenarioh/foo/mgmt/2019-10-11/foo/v1.2.0",
"tools/testdata/scenarioi/foo/mgmt/2019-10-23/foo/v1.0.0",
"tools/testdata/scenarioi/foo/mgmt/2019-10-23/foo/v1.0.1",
"tools/testdata/scenarioi/foo/mgmt/2019-10-23/foo/v1.1.0",
"tools/testdata/scenarioi/foo/mgmt/2019-10-23/foo/v1.1.1",
"tools/testdata/scenarioi/foo/mgmt/2019-10-23/foo/v1.1.2",
"tools/testdata/scenarioj/foo/mgmt/2019-10-23/foo/v1.0.0",
"tools/testdata/scenarioj/foo/mgmt/2019-10-23/foo/v1.0.1",
"tools/testdata/scenarioj/foo/mgmt/2019-10-23/foo/v1.1.0",
"tools/testdata/scenarioj/foo/mgmt/2019-10-23/foo/v1.1.1",
"tools/testdata/scenarioj/foo/mgmt/2019-10-23/foo/v1.1.2",
"tools/testdata/scenarioj/foo/mgmt/2019-10-23/foo/v2.0.0",
}
)

Expand Down Expand Up @@ -100,9 +85,6 @@ func Test_findAllVersionFiles(t *testing.T) {
"../../testdata/scenariog/foo/mgmt/2019-10-11/foo/v2/version.go",
"../../testdata/scenarioh/foo/mgmt/2019-10-11/foo/version.go",
"../../testdata/scenarioh/foo/mgmt/2019-10-11/foo/v2/version.go",
"../../testdata/scenarioi/foo/mgmt/2019-10-23/foo/version.go",
"../../testdata/scenarioj/foo/mgmt/2019-10-23/foo/version.go",
"../../testdata/scenarioj/foo/mgmt/2019-10-23/foo/v2/version.go",
}
root, err := filepath.Abs("../../testdata")
if err != nil {
Expand Down Expand Up @@ -182,9 +164,6 @@ func Test_readNewTags(t *testing.T) {
"tools/testdata/scenariof/foo/v1.0.0",
"tools/testdata/scenariog/foo/mgmt/2019-10-11/foo/v2.0.0",
"tools/testdata/scenarioh/foo/mgmt/2019-10-11/foo/v2.0.0",
"tools/testdata/scenarioi/foo/mgmt/2019-10-23/foo/v1.1.2",
"tools/testdata/scenarioj/foo/mgmt/2019-10-23/foo/v1.1.2",
"tools/testdata/scenarioj/foo/mgmt/2019-10-23/foo/v2.0.0",
}
root, err := filepath.Abs("../../testdata")
if err != nil {
Expand Down
8 changes: 1 addition & 7 deletions tools/testdata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,4 @@
| d | Yes | Yes | v1, v2 | Yes |
| e | Yes | No | v1, v2 | Yes |
| f | Yes | No | None | Yes |
| g | Yes | Yes | v1 | Yes |
| h | Yes | Yes | v1 | Yes |
| i | No | No | v1 | Yes |
| j | No | No | v1, v2 | Yes |

* For i, all files in v1 and stage are identical with each other. In this case, no version should be bumped.
* For j, all files in v2 and stage are identical with each other. In this case, no version should be bumped.
| g | Yes | Yes | v1 | Yes |
2 changes: 1 addition & 1 deletion tools/testdata/scenariog/foo/mgmt/2019-10-11/foo/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/Azure/azure-sdk-for-go/tools/testdata/scenariog/foo/mgmt/2019-10-11/foo
module github.com/Azure/azure-sdk-for-go/tools/testdata/scenariog/foo

go 1.12
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/Azure/azure-sdk-for-go/tools/testdata/scenariog/foo/mgmt/2019-10-11/foo
module github.com/Azure/azure-sdk-for-go/tools/testdata/scenariog/foo

go 1.12
2 changes: 1 addition & 1 deletion tools/testdata/scenarioh/foo/mgmt/2019-10-11/foo/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/Azure/azure-sdk-for-go/tools/testdata/scenarioh/foo/mgmt/2019-10-11/foo
module github.com/Azure/azure-sdk-for-go/tools/testdata/scenarioh/foo

go 1.12
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/Azure/azure-sdk-for-go/tools/testdata/scenarioh/foo/mgmt/2019-10-11/foo
module github.com/Azure/azure-sdk-for-go/tools/testdata/scenarioh/foo

go 1.12
2 changes: 0 additions & 2 deletions tools/versioner/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ func Test_findAllSubDirectories(t *testing.T) {
"../../testdata/scenariof/foo/stage",
"../../testdata/scenariog/foo/mgmt/2019-10-11/foo/stage",
"../../testdata/scenarioh/foo/mgmt/2019-10-11/foo/stage",
"../../testdata/scenarioi/foo/mgmt/2019-10-23/foo/stage",
"../../testdata/scenarioj/foo/mgmt/2019-10-23/foo/stage",
}
root, err := filepath.Abs("../../testdata")
if err != nil {
Expand Down
25 changes: 6 additions & 19 deletions tools/versioner/cmd/unstage.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ func theUnstageCommand(args []string) (string, error) {
if err != nil {
return "", fmt.Errorf("failed to create module info: %v", err)
}
if err := writeChangelog(stage, mod); err != nil {
return "", fmt.Errorf("failed to write changelog: %v", err)
}
var tag string
if mod.BreakingChanges() {
tag, err = forSideBySideRelease(stage, mod)
Expand Down Expand Up @@ -140,10 +143,6 @@ func forSideBySideRelease(stage string, mod modinfo.Provider) (string, error) {
if err := updateVersion(stage, tag); err != nil {
return "", fmt.Errorf("failed to update version.go: %v", err)
}
// write change log
if err := writeChangelog(stage, mod); err != nil {
return "", fmt.Errorf("failed to write changelog: %v", err)
}
// move staging to new LMV directory
if err = os.Rename(stage, mod.DestDir()); err != nil {
return "", fmt.Errorf("failed to rename '%s' to '%s': %v", stage, mod.DestDir(), err)
Expand Down Expand Up @@ -181,14 +180,6 @@ func forInplaceUpdate(lmv, stage string, mod modinfo.Provider) (string, error) {
if err := updateVersion(stage, tag); err != nil {
return "", fmt.Errorf("failed to update version.go: %v", err)
}
// write changelog
if hasChange, err := mod.HasChanges(); err != nil {
return "", fmt.Errorf("failed to check changes: %v", err)
} else if hasChange {
if err := writeChangelog(stage, mod); err != nil {
return "", fmt.Errorf("failed to write changelog: %v", err)
}
}
// move staging directory over the LMV by first deleting LMV then renaming stage
if modinfo.HasVersionSuffix(lmv) {
if err := os.RemoveAll(lmv); err != nil {
Expand Down Expand Up @@ -494,13 +485,9 @@ func calculateModuleTag(tags []string, mod modinfo.Provider) (string, error) {
n := sv.IncMinor()
sv = &n
} else {
// no new exports and has changes, this is a patch update
if hasChange, err := mod.HasChanges(); err != nil {
return "", err
} else if hasChange {
n := sv.IncPatch()
sv = &n
}
// no new exports, this is a patch update
n := sv.IncPatch()
sv = &n
}
return strings.Replace(tag, v, "v"+sv.String(), 1), nil
}
Loading