Skip to content

Update build.yaml - workaround vstest action issue #30

Update build.yaml - workaround vstest action issue

Update build.yaml - workaround vstest action issue #30

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Build"
on:
push:
branches: [main]
paths-ignore:
- '*.md'
pull_request:
branches: [main]
paths-ignore:
- '*.md'
jobs:
build:
outputs:
version: ${{ steps.vsix_version.outputs.version-number }}
name: Build
runs-on: windows-2022
env:
Configuration: Debug
DeployExtension: False
VsixManifestPath: src\source.extension.vsixmanifest
VsixManifestSourcePath: src\source.extension.cs
steps:
- uses: actions/checkout@v4
- name: Setup .NET build dependencies
uses: timheuer/bootstrap-dotnet@v2
with:
nuget: 'false'
sdk: 'false'
msbuild: 'true'
- name: Increment VSIX version
id: vsix_version
uses: timheuer/vsix-version-stamp@v2
with:
manifest-file: ${{ env.VsixManifestPath }}
vsix-token-source-file: ${{ env.VsixManifestSourcePath }}
- name: Build
run: msbuild /v:m -restore /p:OutDir=\_built
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}.vsix
path: /_built/**/*.vsix
- name: Run Tests
# See https://github.com/microsoft/vstest-action/issues/31
# uses: microsoft/[email protected]
uses: josepho0918/[email protected]
with:
searchFolder: /_built/
testAssembly: /**/*Tests.dll
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
id: test-results
with:
files: testresults\**\*.trx
- name: Set badge color
shell: bash
run: |
case ${{ fromJSON( steps.test-results.outputs.json ).conclusion }} in
success)
echo "BADGE_COLOR=31c653" >> $GITHUB_ENV
;;
failure)
echo "BADGE_COLOR=800000" >> $GITHUB_ENV
;;
neutral)
echo "BADGE_COLOR=696969" >> $GITHUB_ENV
;;
esac
- name: Create badge
uses: emibcn/badge-action@808173dd03e2f30c980d03ee49e181626088eee8
with:
label: Tests
status: '${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.tests }} tests, ${{ fromJSON( steps.test-results.outputs.json ).formatted.stats.runs }} runs: ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}'
color: ${{ env.BADGE_COLOR }}
path: badge.svg
- name: Upload badge to Gist
# Upload only for main branch
if: >
github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == 'main' ||
github.event_name != 'workflow_run' && github.ref == 'refs/heads/main'
uses: andymckay/append-gist-action@6e8d64427fe47cbacf4ab6b890411f1d67c07f3e
with:
token: ${{ secrets.GIST_TOKEN }}
gistURL: https://gist.githubusercontent.com/mrlacey/c586ff0f495b4a8dd76ab0dbdf9c89e0
file: badge.svg