1
+ trigger :
2
+ branches :
3
+ include :
4
+ - ' *'
5
+
6
+ pr :
7
+ autoCancel : true
8
+
9
+ pool :
10
+ vmImage : ubuntu-latest
11
+
12
+ # Plugins need to be built if either
13
+ # - push to main
14
+ # - PR
15
+ # Only specific plugin needs to be build if
16
+ # - change to it's folder
17
+ # Otherwise skip
18
+ variables :
19
+ buildPlugins : $[or(in(variables['Build.Reason'], 'Manual', 'PullRequest')), eq(variables['Build.SourceBranch'], 'refs/heads/main'))]
20
+
21
+ jobs :
22
+ - job : buildGo
23
+ displayName : " Build WhaleLint"
24
+ steps :
25
+ - task : GoTool@0
26
+ displayName : " Install Go"
27
+ inputs :
28
+ version : ' 1.15.6'
29
+ - task : Go@0
30
+ displayName : " Install Go dependencies"
31
+ inputs :
32
+ command : ' get'
33
+ arguments : ' -d'
34
+ workingDirectory : ' $(System.DefaultWorkingDirectory)'
35
+ - task : Go@0
36
+ displayName : " Build WhaleLint"
37
+ inputs :
38
+ command : ' build'
39
+ workingDirectory : ' $(System.DefaultWorkingDirectory)'
40
+ - task : Go@0
41
+ inputs :
42
+ command : ' test'
43
+ arguments : ' -v ./...'
44
+ workingDirectory : ' $(System.DefaultWorkingDirectory)'
45
+ displayName : " Run tests"
46
+ - task : Go@0
47
+ displayName : " Generate coverage"
48
+ inputs :
49
+ command : ' test'
50
+ arguments : " -coverprofile=coverage.txt -covermode=atomic ./..."
51
+ - task : PublishPipelineArtifact@1
52
+ inputs :
53
+ targetPath : $(System.DefaultWorkingDirectory)/whalelint
54
+ artifactName : whalelint
55
+
56
+ - job : BuildVSCodeExtension
57
+ displayName : " Build VSCode Extension"
58
+ dependsOn : buildGo
59
+ condition : $(buildPlugins)
60
+ steps :
61
+ - task : NodeTool@0
62
+ displayName : ' Install Node.js'
63
+ inputs :
64
+ versionSpec : ' 15.6.x'
65
+ - task : CmdLine@2
66
+ displayName : ' npm install'
67
+ inputs :
68
+ script : |
69
+ npm install && \
70
+ npm install -g vsce
71
+ workingDirectory : ' $(System.DefaultWorkingDirectory)/plugins/vscode/'
72
+ - task : DownloadPipelineArtifact@2
73
+ inputs :
74
+ artifact : whalelint
75
+ path : $(System.DefaultWorkingDirectory)/plugins/vscode/
76
+ - task : CmdLine@2
77
+ displayName : ' Package Extension'
78
+ inputs :
79
+ script : vsce package -o whalelint.vsix
80
+ workingDirectory : ' $(System.DefaultWorkingDirectory)/plugins/vscode/'
81
+ - task : PublishPipelineArtifact@1
82
+ inputs :
83
+ targetPath : ' $(System.DefaultWorkingDirectory)/plugins/vscode/whalelint.vsix'
84
+ artifactName : whalelint-vscode
85
+
86
+ - job : BuildJetBrainsPlugin
87
+ displayName : " Build JetBrains Plugin"
88
+ dependsOn : buildGo
89
+ condition : $(buildPlugins)
90
+ steps :
91
+ - task : DownloadPipelineArtifact@2
92
+ inputs :
93
+ artifact : whalelint
94
+ path : $(System.DefaultWorkingDirectory)/
95
+ - task : Gradle@2
96
+ inputs :
97
+ workingDirectory : ' $(System.DefaultWorkingDirectory)/plugins/jetbrains/'
98
+ gradleWrapperFile : ' $(System.DefaultWorkingDirectory)/plugins/jetbrains/gradlew'
99
+ gradleOptions : ' -Xmx3072m'
100
+ publishJUnitResults : false
101
+ tasks : ' buildPlugin'
102
+ - task : PublishPipelineArtifact@1
103
+ inputs :
104
+ targetPath : ' $(System.DefaultWorkingDirectory)/plugins/jetbrains/build/distributions/'
105
+ artifactName : whalelint-jetbrains
106
+
0 commit comments