standardize project settings and package versions #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/vstest-action@main | |
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 ).conclusion }}' | |
color: ${{ env.BADGE_COLOR }} | |
path: StringResourceVisualizer.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: jpontdia/append-gist-action@master | |
with: | |
token: ${{ secrets.GIST_TOKEN }} | |
gistURL: https://gist.githubusercontent.com/mrlacey/c586ff0f495b4a8dd76ab0dbdf9c89e0 | |
file: StringResourceVisualizer.badge.svg |