Skip to content

Commit d0a9ae7

Browse files
committed
Add CI and CD workflows
1 parent daebbd5 commit d0a9ae7

4 files changed

Lines changed: 136 additions & 0 deletions

File tree

.github/workflows/cd.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CD
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
WORKING_DIR: ${{ github.workspace }}
8+
SOLUTION_PATH: '${{ github.workspace }}\Riverside.CompilerPlatform.slnx'
9+
10+
jobs:
11+
publish:
12+
runs-on: windows-latest
13+
14+
strategy:
15+
matrix:
16+
configuration: [CSharp, VisualBasic]
17+
18+
env:
19+
CONFIGURATION: ${{ matrix.configuration }}
20+
21+
steps:
22+
23+
- name: Checkout the repository
24+
uses: actions/checkout@v4
25+
- name: Setup MSBuild
26+
uses: microsoft/setup-msbuild@v2
27+
- name: Setup NuGet
28+
uses: NuGet/setup-nuget@v2
29+
- name: Setup .NET
30+
uses: actions/setup-dotnet@v4
31+
with:
32+
dotnet-version: 9.x
33+
34+
- name: Restore
35+
run: |
36+
msbuild $env:SOLUTION_PATH /t:Restore /p:Configuration=$env:CONFIGURATION
37+
38+
- name: Build
39+
run: |
40+
msbuild $env:SOLUTION_PATH /t:Build /p:Configuration=$env:CONFIGURATION /p:PackageOutputPath=$env:WORKING_DIR\bin
41+
42+
- name: Publish to NuGet
43+
run: dotnet nuget push .\bin\*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

.github/workflows/ci.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
env:
8+
WORKING_DIR: ${{ github.workspace }}
9+
SOLUTION_PATH: '${{ github.workspace }}\Riverside.CompilerPlatform.slnx'
10+
11+
jobs:
12+
build:
13+
runs-on: windows-latest
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
configuration: [CSharp, VisualBasic]
19+
project: [Analyzers, CodeFixers, HighPerformance, SourceGenerators]
20+
21+
env:
22+
PROJECT: ${{ matrix.project }}
23+
CONFIGURATION: ${{ matrix.configuration }}
24+
PROJECT_DIR: ${{ github.workspace }}\src\Riverside.CompilerPlatform.${{ matrix.project }}
25+
26+
steps:
27+
28+
- name: Checkout the repository
29+
uses: actions/checkout@v4
30+
- name: Setup MSBuild
31+
uses: microsoft/setup-msbuild@v2
32+
- name: Setup NuGet
33+
uses: NuGet/setup-nuget@v2
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v4
36+
with:
37+
dotnet-version: 9.x
38+
39+
- name: Restore
40+
run: |
41+
msbuild $env:SOLUTION_PATH /t:Restore /p:Configuration=$env:CONFIGURATION
42+
43+
- name: Build
44+
run: |
45+
msbuild $env:PROJECT_DIR /t:Build /p:Configuration=$env:CONFIGURATION
46+
47+
test:
48+
needs: [build]
49+
50+
runs-on: windows-latest
51+
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
configuration: [CSharp]
56+
57+
env:
58+
CONFIGURATION: ${{ matrix.configuration }}
59+
PROJECT_DIR: ${{ github.workspace }}\tests\Riverside.CompilerPlatform.${{ matrix.configuration }}.Tests
60+
61+
steps:
62+
63+
- name: Checkout the repository
64+
uses: actions/checkout@v4
65+
- name: Setup MSBuild
66+
uses: microsoft/setup-msbuild@v2
67+
- name: Setup NuGet
68+
uses: NuGet/setup-nuget@v2
69+
- name: Setup .NET
70+
uses: actions/setup-dotnet@v4
71+
with:
72+
dotnet-version: 9.x
73+
74+
- name: Restore
75+
run: |
76+
msbuild $env:SOLUTION_PATH /t:Restore /p:Configuration=$env:CONFIGURATION
77+
78+
- name: Build
79+
run: |
80+
msbuild $env:SOLUTION_PATH /t:Build /p:Configuration=$env:CONFIGURATION
81+
82+
- name: Test
83+
run: |
84+
dotnet test $env:PROJECT_DIR --configuration Release --no-build

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project>
22
<Import Project="$(MSBuildThisFileDirectory)\eng\LanguageInternals.props" Condition="!$(MSBuildProjectName.Contains('Tests'))" />
33
<Import Project="$(MSBuildThisFileDirectory)\eng\PackageMetadata.props" Condition="!$(MSBuildProjectName.Contains('Tests'))" />
4+
<Import Project="$(MSBuildThisFileDirectory)\eng\CurrentVersion.props" />
45
<PropertyGroup>
56
<RootDirectory>$(MSBuildThisFileDirectory)</RootDirectory>
67
<SourceDirectory>$(RootDirectory)\src</SourceDirectory>
@@ -14,6 +15,7 @@
1415

1516
<PropertyGroup>
1617
<Product>Riverside.CompilerPlatform</Product>
18+
<Version>$(MajorVersion).$(MinorVersion).$(PatchVersion)</Version>
1719
</PropertyGroup>
1820

1921
<ItemGroup>

eng/CurrentVersion.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project>
2+
<PropertyGroup>
3+
<MajorVersion>1</MajorVersion>
4+
<MinorVersion>0</MinorVersion>
5+
<PatchVersion>1</PatchVersion>
6+
</PropertyGroup>
7+
</Project>

0 commit comments

Comments
 (0)