Add workflow #79
Workflow file for this run
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
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
pull_request: | |
env: | |
Configuration: Release | |
TreatWarningsAsErrors: true | |
WarningsNotAsErrors: 1591 | |
Deterministic: true | |
jobs: | |
common: | |
runs-on: ubuntu-20.04 | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
version3: ${{ steps.version.outputs.version3 }} | |
defaults: | |
run: | |
working-directory: src | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: echo ":/github/home/.dotnet/tools" >> $GITHUB_PATH | |
- run: dotnet tool install -g GitVersion.Tool --version 5.12.0 | |
- name: Resolve version | |
id: version | |
run: | | |
dotnet-gitversion > version.json | |
version="$(jq -r '.SemVer' version.json)" | |
version3="$(jq -r '.MajorMinorPatch' version.json)" | |
pr_version="$(jq -r '.MajorMinorPatch' version.json)-$(jq -r '.PreReleaseLabel' version.json).${{ github.run_number }}.${{ github.run_attempt }}" | |
if [ "${{ github.event_name }}" = "pull_request" ]; then version=$pr_version; fi | |
echo "Resolved version: $version" | |
echo "Resolved version3: $version3" | |
echo "version=${version}" >> $GITHUB_OUTPUT | |
echo "version3=${version3}" >> $GITHUB_OUTPUT | |
- run: | | |
dotnet format Roslynator.sln --no-restore --verify-no-changes --severity info --exclude-diagnostics \ | |
IDE0220 \ | |
IDE0251 \ | |
IDE0270 | |
# IDE0220 - 'foreach' statement implicitly converts type. Add an explicit cast to make intent clearer. | |
# IDE0251 - Property can be made read-only. | |
# IDE0270 - Null check can be simplified. | |
- run: dotnet restore Roslynator.sln | |
- run: dotnet build Roslynator.sln --no-restore | |
- run: dotnet tool install -g roslynator.dotnet.cli | |
- run: roslynator analyze Roslynator.sln --severity-level info --ignored-diagnostics CS1591 CS8019 | |
- run: dotnet test Roslynator.sln --no-build | |
build_framework_cli: | |
needs: common | |
runs-on: windows-latest | |
env: | |
WarningsNotAsErrors: ${{ github.env.WarningsNotAsErrors }},NU5128 | |
RoslynatorCommandLine: true | |
RoslynatorCliVersion: ${{ needs.common.outputs.version }} | |
RoslynatorCliPackageVersion: ${{ needs.common.outputs.version }} | |
defaults: | |
run: | |
working-directory: src/CommandLine | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: echo "Version=${{ needs.common.outputs.version }}" >> $GITHUB_ENV | |
- run: dotnet restore | |
- run: dotnet publish --no-restore | |
- run: dotnet pack --no-build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: nuget_packages | |
path: src/CommandLine/bin/Release/*.nupkg | |
build_core_cli: | |
needs: common | |
runs-on: ubuntu-20.04 | |
env: | |
RoslynatorDotNetCli: true | |
RoslynatorCliVersion: ${{ needs.common.outputs.version }} | |
RoslynatorCliPackageVersion: ${{ needs.common.outputs.version }} | |
defaults: | |
run: | |
working-directory: src/CommandLine | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: echo "Version=${{ needs.common.outputs.version }}" >> $GITHUB_ENV | |
- run: dotnet restore | |
- run: dotnet build --no-restore | |
- run: dotnet pack --no-build | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: nuget_packages | |
path: src/CommandLine/bin/Release/*.nupkg | |
build_core_and_testing: | |
needs: common | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: src | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: echo "Version=${{ needs.common.outputs.version }}" >> $GITHUB_ENV | |
- run: dotnet restore Roslynator.CoreAndTesting.slnf | |
- run: dotnet build Roslynator.CoreAndTesting.slnf --no-restore | |
- run: dotnet pack Roslynator.CoreAndTesting.slnf --no-build -o _nupkg | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: nuget_packages | |
path: src/_nupkg/*nupkg | |
build_analyzers: | |
needs: common | |
strategy: | |
matrix: | |
component: | |
- name: Analyzers | |
propertyName: Analyzers | |
- name: Formatting.Analyzers | |
propertyName: FormattingAnalyzers | |
- name: CodeAnalysis.Analyzers | |
propertyName: CodeAnalysisAnalyzers | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: src/Tests/${{ matrix.component.name }}.Tests | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: echo "Version=${{ needs.common.outputs.version }}" >> $GITHUB_ENV | |
- run: dotnet restore | |
- run: dotnet build --no-restore /p:Roslynator${{ matrix.component.propertyName }}NuGet=true | |
- run: dotnet pack --no-build | |
working-directory: src/${{ matrix.component.name }}.CodeFixes | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: nuget_packages | |
path: src/${{ matrix.component.name }}.CodeFixes/bin/Release/*.nupkg | |
build_vs_extension: | |
needs: common | |
runs-on: windows-latest | |
defaults: | |
run: | |
working-directory: src/VisualStudio | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: (Get-Content source.extension.vsixmanifest) -replace 'Version="1.0.0"', 'Version="${{ needs.common.outputs.version3 }}"' | Set-Content source.extension.vsixmanifest | |
- run: echo "Version=${{ needs.common.outputs.version }}" >> $GITHUB_ENV | |
- run: dotnet restore | |
- uses: microsoft/setup-msbuild@v1.1 # https://github.com/microsoft/setup-msbuild | |
- run: msbuild | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: vsix_packages | |
path: src/VisualStudio/bin/Release/net472/*.vsix | |
build_vs_code_extension: | |
needs: [ common, build_analyzers ] | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: src/VisualStudioCode | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: echo "Version=${{ needs.common.outputs.version }}" >> $GITHUB_ENV | |
- run: dotnet restore | |
- run: dotnet build --no-restore /p:DefineConstants=VSCODE | |
- run: | | |
cp bin/Release/netstandard2.0/Roslynator.Core.dll package/roslyn/common | |
cp bin/Release/netstandard2.0/Roslynator.Common.dll package/roslyn/common | |
cp bin/Release/netstandard2.0/Roslynator.CSharp.dll package/roslyn/common | |
cp bin/Release/netstandard2.0/Roslynator.Workspaces.Core.dll package/roslyn/common | |
cp bin/Release/netstandard2.0/Roslynator.Workspaces.Common.dll package/roslyn/common | |
cp bin/Release/netstandard2.0/Roslynator.CSharp.Workspaces.dll package/roslyn/common | |
mkdir package/roslyn/analyzers | |
cp bin/Release/netstandard2.0/Roslynator.CSharp.Analyzers.dll package/roslyn/analyzers | |
cp bin/Release/netstandard2.0/Roslynator.CSharp.Analyzers.CodeFixes.dll package/roslyn/analyzers | |
cp bin/Release/netstandard2.0/Roslynator.Formatting.Analyzers.dll package/roslyn/analyzers | |
cp bin/Release/netstandard2.0/Roslynator.Formatting.Analyzers.CodeFixes.dll package/roslyn/analyzers | |
mkdir package/roslyn/refactorings | |
cp bin/Release/netstandard2.0/Roslynator.CSharp.Refactorings.dll package/roslyn/refactorings | |
mkdir package/roslyn/fixes | |
cp bin/Release/netstandard2.0/Roslynator.CSharp.CodeFixes.dll package/roslyn/fixes | |
name: Copy DLLs to package | |
- run: > | |
sed -i 's/"version": "1.0.0"/"version": "${{ needs.common.outputs.version3 }}"/' package/package.json | |
- run: npm install | |
working-directory: src/VisualStudioCode/package | |
- run: npm install -g @vscode/vsce | |
- run: vsce package | |
working-directory: src/VisualStudioCode/package | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: vsix_packages | |
path: src/VisualStudioCode/package/*.vsix | |
- run: sed -i s/ms-dotnettools.csharp/muhammad-sammy.csharp/ package/package.json | |
- run: vsce package -o roslynator-${{ needs.common.outputs.version3 }}-ovsx.vsix | |
working-directory: src/VisualStudioCode/package | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: vsix_packages | |
path: src/VisualStudioCode/package/*.vsix |