Skip to content

Merge pull request #1473 from SteamRE/dependabot/github_actions/codec… #1102

Merge pull request #1473 from SteamRE/dependabot/github_actions/codec…

Merge pull request #1473 from SteamRE/dependabot/github_actions/codec… #1102

name: CI/CD
on:
push:
branches: [ master, gh-actions ]
pull_request:
branches: [ master ]
jobs:
steamkit2:
name: SteamKit on ${{ matrix.os }} - ${{ matrix.configuration }}
strategy:
matrix:
os: [ windows-latest, macos-latest, macos-14, ubuntu-latest ]
configuration: [ Debug, Release ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- name: Build SteamKit
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
run: >
dotnet test
--configuration ${{ matrix.configuration }}
--verbosity normal
SteamKit2/Tests/Tests.csproj
/p:CollectCoverage=true
/p:CoverletOutputFormat=lcov
/p:CoverletOutput='./Coverage/lcov.info'
/p:Include="[SteamKit2]SteamKit*"
/p:Exclude="[SteamKit2]SteamKit2*Internal*"
- name: Upload test coverage
uses: codecov/codecov-action@v5
if: matrix.configuration == 'Debug'
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./SteamKit2/Tests/Coverage/lcov.info
fail_ci_if_error: false
verbose: true
steamkit2-artifacts:
name: Create NuGet Package
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- name: Create NuGet Package
run: dotnet pack --configuration Release SteamKit2/SteamKit2/SteamKit2.csproj
- name: Upload NuGet Package
uses: actions/upload-artifact@v4
with:
name: SteamKit2.nupkg
path: 'SteamKit2/SteamKit2/bin/Release/*.nupkg'
nha2-artifacts:
name: Create NetHookAnalyzer2 Release
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- 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@v4
with:
name: NetHookAnalyzer2
path: 'Resources/NetHookAnalyzer2/NetHookAnalyzer2/bin/Release/win-x64/publish/*'
nethook2:
name: NetHook2 - ${{ matrix.platform }} - ${{ matrix.configuration }}
permissions:
contents: write
strategy:
matrix:
configuration: [ Debug, Release ]
platform: [ Win32, x64 ]
fail-fast: false
runs-on: windows-2022
# https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Add cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Configure Dependencies
run: pwsh -File Resources/NetHook2/SetupDependencies.ps1
- name: Build NetHook2
run: msbuild /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} Resources/NetHook2/NetHook2.sln
- name: Upload NetHook2
uses: actions/upload-artifact@v4
if: matrix.configuration == 'Release'
with:
name: NetHook2-${{ matrix.platform }}
path: 'Resources/NetHook2/${{ matrix.platform }}/${{ matrix.configuration }}/*.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@v4
with:
submodules: recursive
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- 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