-
Notifications
You must be signed in to change notification settings - Fork 20
153 lines (140 loc) · 6.5 KB
/
csharp.yml
File metadata and controls
153 lines (140 loc) · 6.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Continuous Integration
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
types: [ opened, synchronize, reopened, ready_for_review ]
jobs:
lintCodebase:
name: Lint Codebase if Not Draft
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Full git history is needed to get a proper list of changed files
fetch-depth: 0
- name: Run Super-Linter
uses: github/super-linter@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: master
VALIDATE_CSHARP: true
netFrameworksAndUnitTest:
name: Build Framework & Run Unit Tests
needs: [ lintCodebase ]
runs-on: windows-2022
env:
REPO_SLUG: ${{ github.repository }}
BUILD_NUMBER: ${{ github.run_id }}
ATTEMPT_NUM: ${{ github.run_attempt }}
RUN_NUMBER: ${{ github.run_number }}
EVENT_TYPE: ${{ github.event_name }}
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Setup NuGet
uses: NuGet/setup-nuget@v1
- name: Download and Extract .NET Framework Reference Assemblies
run: |
# Create temp directory
New-Item -ItemType Directory -Path "temp_ref_assemblies" -Force
# Download .NET 4.0 Reference Assemblies
echo "Downloading .NET 4.0 Reference Assemblies..."
Invoke-WebRequest -Uri "https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies.net40/1.0.3" -OutFile "temp_ref_assemblies/net40_ref.zip"
# Download .NET 4.5 Reference Assemblies
echo "Downloading .NET 4.5 Reference Assemblies..."
Invoke-WebRequest -Uri "https://www.nuget.org/api/v2/package/Microsoft.NETFramework.ReferenceAssemblies.net45/1.0.3" -OutFile "temp_ref_assemblies/net45_ref.zip"
# Extract .NET 4.0 Reference Assemblies
echo "Extracting .NET 4.0 Reference Assemblies..."
Expand-Archive -Path "temp_ref_assemblies/net40_ref.zip" -DestinationPath "temp_ref_assemblies/net40" -Force
if (Test-Path "temp_ref_assemblies/net40/build/.NETFramework/v4.0") {
echo "✓ .NET 4.0 Reference Assemblies extracted to workspace"
}
# Extract .NET 4.5 Reference Assemblies
echo "Extracting .NET 4.5 Reference Assemblies..."
Expand-Archive -Path "temp_ref_assemblies/net45_ref.zip" -DestinationPath "temp_ref_assemblies/net45" -Force
if (Test-Path "temp_ref_assemblies/net45/build/.NETFramework/v4.5") {
echo "✓ .NET 4.5 Reference Assemblies extracted to workspace"
}
- name: Restore NuGet packages
run: nuget restore ./OptimizelySDK.NETFramework.sln
- name: Build & strongly name assemblies
run: |
# Build with workspace-relative reference assembly paths
$Net40RefPath = "$(pwd)\temp_ref_assemblies\net40\build\.NETFramework\v4.0"
$Net45RefPath = "$(pwd)\temp_ref_assemblies\net45\build\.NETFramework\v4.5"
echo "Using .NET 4.0 Reference Assemblies from: $Net40RefPath"
echo "Using .NET 4.5 Reference Assemblies from: $Net45RefPath"
msbuild /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk /p:Configuration=Release /p:FrameworkPathOverride="$Net45RefPath" ./OptimizelySDK.NETFramework.sln
- name: Install & Run NUnit tests
run: |
nuget install NUnit.Console -Version 3.18.1 -DirectDownload -OutputDirectory .
# https://docs.nunit.org/articles/nunit/running-tests/Console-Command-Line.html
./NUnit.ConsoleRunner.3.18.1\tools\nunit3-console.exe /timeout 10000 /process Separate ./OptimizelySDK.Tests/bin/Release/OptimizelySDK.Tests.dll
- name: Cleanup reference assemblies
run: Remove-Item -Path "temp_ref_assemblies" -Recurse -Force
netStandard16:
name: Build Standard 1.6
needs: [ netFrameworksAndUnitTest ]
runs-on: windows-2022
env:
REPO_SLUG: ${{ github.repository }}
BUILD_NUMBER: ${{ github.run_id }}
ATTEMPT_NUM: ${{ github.run_attempt }}
RUN_NUMBER: ${{ github.run_number }}
EVENT_TYPE: ${{ github.event_name }}
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.x
- name: Restore dependencies
run: dotnet restore OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj
- name: Build & strongly name assemblies
run: dotnet build OptimizelySDK.NetStandard16/OptimizelySDK.NetStandard16.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk -c Release
netStandard20:
name: Build Standard 2.0
needs: [ netFrameworksAndUnitTest ]
runs-on: windows-2022
env:
REPO_SLUG: ${{ github.repository }}
BUILD_NUMBER: ${{ github.run_id }}
ATTEMPT_NUM: ${{ github.run_attempt }}
RUN_NUMBER: ${{ github.run_number }}
EVENT_TYPE: ${{ github.event_name }}
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 3.1.x
- name: Restore dependencies
run: dotnet restore OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj
- name: Build & strongly name assemblies
run: dotnet build OptimizelySDK.NetStandard20/OptimizelySDK.NetStandard20.csproj /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=$(pwd)/keypair.snk -c Release
integration_tests:
name: Run Integration Tests
needs: [ netFrameworksAndUnitTest, netStandard16, netStandard20 ]
uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master
secrets:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
fullstack_production_suite:
name: Run Performance Tests
needs: [ netFrameworksAndUnitTest, netStandard16, netStandard20 ]
uses: optimizely/csharp-sdk/.github/workflows/integration_test.yml@master
with:
FULLSTACK_TEST_REPO: ProdTesting
secrets:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}