Merge pull request #1251 from SteamRE/dependabot/nuget/SteamKit2/Micr… #633
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
name: CI/CD | |
on: | |
push: | |
branches: [ master, gh-actions ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
steamkit2: | |
name: SteamKit2 on ${{ matrix.os }} - ${{ matrix.configuration }} (SDK ${{ matrix.sdk }}) | |
strategy: | |
matrix: | |
os: [ windows-latest, macos-latest, ubuntu-latest ] | |
sdk: [ 6.0.x ] | |
configuration: [ Debug, Release ] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.sdk }} | |
- name: Build SteamKit2 | |
run: dotnet build --configuration ${{ matrix.configuration }} SteamKit2/SteamKit2/SteamKit2.csproj | |
- name: Build SteamLanguageParser | |
run: dotnet build --configuration ${{ matrix.configuration }} Resources/SteamLanguageParser/SteamLanguageParser.csproj | |
- name: Build ProtobufGen | |
run: dotnet build --configuration ${{ matrix.configuration }} Resources/ProtobufGen/ProtobufGen.sln | |
- name: Build ProtobufDumper | |
run: dotnet build --configuration ${{ matrix.configuration }} Resources/ProtobufDumper/ProtobufDumper.sln | |
- name: Build Samples | |
run: dotnet build --configuration ${{ matrix.configuration }} Samples/Samples.sln | |
- name: Build NetHookAnalyzer2 | |
run: dotnet build --configuration ${{ matrix.configuration }} Resources/NetHookAnalyzer2/NetHookAnalyzer2.sln | |
if: matrix.os == 'windows-latest' | |
- name: Run Tests | |
if: matrix.configuration == 'Debug' | |
run: dotnet test --verbosity normal --framework net6.0 SteamKit2/Tests/Tests.csproj | |
- name: Run Tests (.NET Framework) | |
if: matrix.configuration == 'Debug' && startsWith(matrix.os, 'windows-') | |
run: dotnet test --verbosity normal --framework net48 SteamKit2/Tests/Tests.csproj | |
steamkit2-artifacts: | |
name: Create NuGet Package | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Create NuGet Package | |
run: dotnet pack --configuration Release SteamKit2/SteamKit2/SteamKit2.csproj | |
- name: Upload NuGet Package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: SteamKit2.nupkg | |
path: 'SteamKit2/SteamKit2/bin/Release/*.nupkg' | |
nha2-artifacts: | |
name: Create NetHookAnalyzer2 Release | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Publish NetHookAnalyzer2 | |
run: dotnet publish --configuration Release --runtime win-x64 --self-contained Resources/NetHookAnalyzer2/NetHookAnalyzer2/NetHookAnalyzer2.csproj /p:PublishSingleFile=True | |
- name: Upload NetHookAnalyzer2 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: NetHookAnalyzer2 | |
path: 'Resources/NetHookAnalyzer2/NetHookAnalyzer2/bin/Release/win-x64/publish/*' | |
nethook2: | |
name: NetHook2 - ${{ matrix.configuration }} | |
strategy: | |
matrix: | |
configuration: [ Debug, Release ] | |
fail-fast: false | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v1 | |
- name: Cache vcpkg | |
id: cache-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\vcpkg | |
key: vcpkg-${{ hashFiles('Resources/NetHook2/NetHook2/vcpkg.json') }} | |
- name: Configure Dependencies | |
run: pwsh -File Resources/NetHook2/SetupDependencies.ps1 | |
- name: Build NetHook2 | |
run: msbuild /p:Configuration=${{ matrix.configuration }} Resources/NetHook2/NetHook2.sln | |
- name: Upload NetHook2 | |
uses: actions/upload-artifact@v3 | |
if: matrix.configuration == 'Release' | |
with: | |
name: NetHook2 | |
path: 'Resources/NetHook2/Release/*.dll' | |
gh-packages: | |
name: Publish to GitHub Packages | |
if: github.event_name != 'pull_request' | |
permissions: | |
packages: write | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Create NuGet Package | |
run: dotnet pack --configuration Release SteamKit2/SteamKit2/SteamKit2.csproj | |
- name: Publish NuGet Package to GitHub Packages | |
run: | | |
dotnet nuget push SteamKit2\SteamKit2\bin\Release\SteamKit2.*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/SteamRE/index.json |