Skip to content

Updating CI to include 2019 release #348

Updating CI to include 2019 release

Updating CI to include 2019 release #348

Workflow file for this run

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/setup-msbuild@v1.1
- 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/VsixVersionAction@1.1
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/VsixPublisherAction@1.0
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/VsixPublisherAction@1.0
with:
extension-file: 'dist/UnitverseVS2019.vsix'
publish-manifest-file: 'publishManifestVS2019.json'
personal-access-code: ${{ secrets.UNITVERSE_PUBLISHER_ACCESS_TOKEN }}