-
Notifications
You must be signed in to change notification settings - Fork 20
134 lines (130 loc) · 4.92 KB
/
CI.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
name: Extension build
on:
pull_request:
branches:
- master
push:
branches:
- master
workflow_dispatch:
jobs:
pre_job:
continue-on-error: true
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
skip_after_successful_duplicate: 'false'
paths_ignore: '["*.md", "docs/**"]'
build:
needs: pre_job
runs-on: windows-latest
strategy:
matrix:
VsTargetVersion: ['VS2019', 'VS2022']
env:
Configuration: Release
SolutionPath: src\Unitverse.sln
VsixPath: src\Unitverse\bin\${{ matrix.VsTargetVersion }}\Release\Unitverse${{ matrix.VsTargetVersion }}.vsix
VsTargetVersion: '${{ matrix.VsTargetVersion }}'
steps:
- uses: actions/checkout@v3
if: needs.pre_job.outputs.should_skip != 'true'
with:
fetch-depth: '0'
- name: Setup .NET Core
if: needs.pre_job.outputs.should_skip != 'true'
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'
- name: Derive version
if: needs.pre_job.outputs.should_skip != 'true'
run: |
./.github/workflows/AutoVersion.ps1
shell: pwsh
- name: Setup MSBuild.exe
if: needs.pre_job.outputs.should_skip != 'true'
uses: microsoft/[email protected]
- name: Restore NuGet Packages
if: needs.pre_job.outputs.should_skip != 'true'
run: nuget restore $env:SolutionPath -Verbosity quiet
- name: Set version for Visual Studio Extension
if: needs.pre_job.outputs.should_skip != 'true'
uses: cezarypiatek/[email protected]
with:
version: '${{env.AutoVersion_AssemblySemVer}}'
vsix-manifest-file: 'src\Unitverse\Manifests\${{ matrix.VsTargetVersion }}\source.extension.vsixmanifest'
- name: Set Help/About version
if: needs.pre_job.outputs.should_skip != 'true'
run: |
((Get-Content -path src\Unitverse\UnitTestGeneratorPackage.cs -Raw) -replace ', "1.0", ',', "${{env.AutoVersion_Major}}.${{env.AutoVersion_Minor}}", ') | Set-Content -Path src\Unitverse\UnitTestGeneratorPackage.cs
shell: pwsh
- name: Build extension
if: needs.pre_job.outputs.should_skip != 'true'
run: msbuild $env:SolutionPath /t:Rebuild -v:m
env:
DeployExtension: False
- name: Check changes in generated examples
if: needs.pre_job.outputs.should_skip != 'true'
run: |
./.github/workflows/CheckChanges.ps1
shell: pwsh
- name: Test extension
if: needs.pre_job.outputs.should_skip != 'true' && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main'
run: dotnet test --no-build --verbosity minimal $env:SolutionPath
- name: Collect artifacts - VSIX
if: needs.pre_job.outputs.should_skip != 'true'
uses: actions/upload-artifact@v3
with:
name: Unitverse-VSIX-${{ matrix.VsTargetVersion }}
path: ${{ env.VsixPath }}
release-extension:
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && needs.pre_job.outputs.should_skip != 'true'
needs: [build, pre_job]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- run: |
./.github/workflows/AutoVersion.ps1
shell: pwsh
- uses: actions/download-artifact@v3
with:
name: Unitverse-VSIX-VS2019
path: dist/
- uses: actions/download-artifact@v3
with:
name: Unitverse-VSIX-VS2022
path: dist/
- name: Create Github Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{env.AutoVersion_SemVer}}
name: ${{env.AutoVersion_SemVer}}
body: 'Unitverse v${{env.AutoVersion_SemVer}}'
draft: false
prerelease: false
files: |
dist/UnitverseVS2019.vsix
dist/UnitverseVS2022.vsix
- name: Publish 2022 extension to Marketplace
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
uses: cezarypiatek/[email protected]
with:
extension-file: 'dist/UnitverseVS2022.vsix'
publish-manifest-file: 'publishManifestVS2022.json'
personal-access-code: ${{ secrets.UNITVERSE_PUBLISHER_ACCESS_TOKEN }}
- name: Publish 2019 extension to Marketplace
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
uses: cezarypiatek/[email protected]
with:
extension-file: 'dist/UnitverseVS2019.vsix'
publish-manifest-file: 'publishManifestVS2019.json'
personal-access-code: ${{ secrets.UNITVERSE_PUBLISHER_ACCESS_TOKEN }}