-
-
Notifications
You must be signed in to change notification settings - Fork 11
187 lines (160 loc) · 5.99 KB
/
cdp.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: cdp
on:
push:
branches: [master]
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
workflow_dispatch:
branches: [master]
env:
VsixFileName: RustAnalyzer.vsix
SolutionPath: src\RustAnalyzer.sln
VsixManifestPath: src\RustAnalyzer\source.extension.vsixmanifest
VsixManifestSourcePath: src\RustAnalyzer\source.extension.cs
TestAdapterNameNoExt: KS.RustAnalyzer.TestAdapter
RUSTANALYZER_TELEMETRY_DISABLED: 1
jobs:
build-test-deploy:
outputs:
version: ${{ steps.vsix_version.outputs.version-number }}
name: Build, Test & Deploy
runs-on: windows-2022
env:
Configuration: Release
DeployExtension: False
OutDir: \_built\
steps:
- uses: actions/checkout@v2
- name: Setup .NET build dependencies
uses: timheuer/bootstrap-dotnet@v1
with:
nuget: 'false'
sdk: 'false'
msbuild: 'true'
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: x86_64-pc-windows-msvc
default: true
components: rustfmt, clippy
- name: Increment VSIX version
id: vsix_version
uses: timheuer/vsix-version-stamp@v1
with:
manifest-file: ${{ env.VsixManifestPath }}
vsix-token-source-file: ${{ env.VsixManifestSourcePath }}
- name: Build
run: msbuild $env:SolutionPath /m /t:rebuild /restore /p:OutDir=$env:OutDir
- name: Zip TestAdapter
run: |
$files = @("${env:OutDir}${env:TestAdapterNameNoExt}.dll", "${env:OutDir}${env:TestAdapterNameNoExt}.pdb", "${env:OutDir}Microsoft.ApplicationInsights.dll", "${env:OutDir}Microsoft.ApplicationInsights.pdb", "${env:OutDir}Ensure.That.dll")
$dst = "${env:OutDir}${env:TestAdapterNameNoExt}.zip"
Compress-Archive -Path $files -DestinationPath $dst
# List contents for debugging purposes
Add-Type -assembly "system.io.compression.filesystem"
echo "listing files in zip..."
[io.compression.zipfile]::OpenRead($dst).Entries.Name | % { "- $_"}
shell: pwsh
- name: Test
uses: microsoft/[email protected]
with:
testAssembly: '*.UnitTests.dll'
searchFolder: '${{ env.OutDir }}'
runInParallel: true
resultLogsArtifactName: unit-tests-results-log
- name: Generate test report
uses: dorny/test-reporter@v1
with:
name: Tests Results
path: TestResults/*.trx
reporter: dotnet-trx
fail-on-error: true
- name: Upload VSIX
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}.zip
path: ${{ env.OutDir }}${{ env.VsixFileName }}
if-no-files-found: error
- name: Upload TestAdapter
uses: actions/upload-artifact@v3
with:
name: ${{ env.TestAdapterNameNoExt }}.zip
path: ${{ env.OutDir }}${{ env.TestAdapterNameNoExt }}.zip
if-no-files-found: warn
run-integration-tests:
name: Integration tests
needs: build-test-deploy
runs-on: windows-2022
env:
TestAdapterLocation: \testadapter
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: x86_64-pc-windows-msvc
default: true
components: rustfmt, clippy
- uses: darenm/[email protected]
- name: Download TestAdapter
id: itdownloadta
uses: actions/download-artifact@v3
with:
name: ${{ env.TestAdapterNameNoExt }}.zip
- name: Prepare for integration tests
run: |
$adapterPathNoExt = "${env:itdownloadta}\${env:TestAdapterNameNoExt}"
mkdir $env:TestAdapterLocation
Expand-Archive "${env:itdownloadta}\${env:TestAdapterNameNoExt}.zip" -DestinationPath $env:TestAdapterLocation
shell: pwsh
env:
itdownloadta: ${{ steps.itdownloadta.outputs.download-path }}
- name: Run integration tests
run: |
.\src\TestProjects\run-integrationtests.ps1 .\src\TestProjects\workspace_with_tests $env:TestAdapterLocation
shell: pwsh
publish:
name: Publish
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
needs: [build-test-deploy, run-integration-tests]
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
- name: Download VSIX
id: downloadvx
uses: actions/download-artifact@v3
with:
name: ${{ github.event.repository.name }}.zip
- name: Download TestAdapter
id: downloadta
uses: actions/download-artifact@v3
with:
name: ${{ env.TestAdapterNameNoExt }}.zip
- name: Upload to Open VSIX
uses: timheuer/openvsixpublish@v1
with:
vsix-file: '${{ steps.downloadvx.outputs.download-path }}\\${{ env.VsixFileName }}'
- name: Tag and Release
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[release]') }}
id: tag_release
uses: softprops/[email protected]
with:
generate_release_notes: true
tag_name: ${{ needs.build-test-deploy.outputs.version }}
name: Release ${{ needs.build-test-deploy.outputs.version }}
files: |
'${{ steps.downloadvx.outputs.download-path }}\\${{ env.VsixFileName }}'
'${{ steps.downloadta.outputs.download-path }}\\${{ env.TestAdapterNameNoExt }}.zip'
- name: Publish extension to Marketplace
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[release]') }}
uses: cezarypiatek/[email protected]
with:
extension-file: '${{ steps.downloadvx.outputs.download-path }}\\${{ env.VsixFileName }}'
publish-manifest-file: 'vs-publish.json'
personal-access-code: ${{ secrets.VS_PUBLISHER_ACCESS_TOKEN }}