Merge pull request #3387 from jamesbt365/dotnet-8 #2
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: .NET CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
linuxpublish: | |
runs-on: ubuntu-latest | |
name: Linux Publish | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '8.0' | |
- name: Linux Publish | |
env: | |
runtime: linux-x64 | |
run: | | |
read -ra options <<< "--configuration Release -p:DebugType=embedded -p:PublishTrimmed=false --no-self-contained -p:SourceRevisionId=$(git rev-parse --short HEAD)" | |
dotnet publish OpenTabletDriver.Daemon "${options[@]}" --runtime "$runtime" -o "build/$runtime" | |
dotnet publish OpenTabletDriver.Console "${options[@]}" --runtime "$runtime" -o "build/$runtime" | |
dotnet publish OpenTabletDriver.UX.Gtk "${options[@]}" --runtime "$runtime" -o "build/$runtime" | |
- name: Upload Linux artifacts | |
uses: actions/[email protected] | |
with: | |
name: OpenTabletDriver linux-x64 | |
path: build/linux-x64 | |
- name: Generate udev Rules | |
run: ./generate-rules.sh > 70-opentabletdriver.rules | |
- name: Upload udev Rules | |
uses: actions/[email protected] | |
with: | |
name: udev Rules | |
path: 70-opentabletdriver.rules | |
macospublish: | |
runs-on: ubuntu-latest | |
name: MacOS Publish | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '8.0' | |
- name: MacOS Publish | |
env: | |
runtime: osx-x64 | |
run: | | |
read -ra options <<< "--configuration Release -p:DebugType=embedded -p:PublishTrimmed=false --no-self-contained -p:SourceRevisionId=$(git rev-parse --short HEAD)" | |
dotnet publish OpenTabletDriver.Daemon "${options[@]}" --runtime "$runtime" -o "build/$runtime" | |
dotnet publish OpenTabletDriver.Console "${options[@]}" --runtime "$runtime" -o "build/$runtime" | |
dotnet publish OpenTabletDriver.UX.MacOS "${options[@]}" --runtime "$runtime" -o "build/$runtime" | |
- name: Upload MacOS artifacts | |
uses: actions/[email protected] | |
with: | |
name: OpenTabletDriver osx-x64 | |
path: build/osx-x64 | |
windowspublish: | |
runs-on: windows-latest | |
name: Windows Publish | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '8.0' | |
- name: Windows Publish | |
env: | |
runtime: win-x64 | |
run: | | |
$options=@("--configuration", "Release", "-p:PublishSingleFile=true", "-p:DebugType=embedded", "--no-self-contained", "-p:SourceRevisionId=$(git rev-parse --short HEAD)") | |
dotnet publish OpenTabletDriver.Daemon $options --runtime $ENV:runtime -o build/$ENV:runtime | |
dotnet publish OpenTabletDriver.Console $options --runtime $ENV:runtime -o build/$ENV:runtime | |
dotnet publish OpenTabletDriver.UX.Wpf $options --runtime $ENV:runtime -o build/$ENV:runtime | |
- name: Upload Windows artifacts | |
uses: actions/[email protected] | |
with: | |
name: OpenTabletDriver win-x64 | |
path: build/win-x64 | |
linter: | |
name: Lint Code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Full git history is needed to get a proper list of changed files | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '8.0' | |
- name: Lint Changed Files | |
run: | | |
mapfile -t files < <(git diff --name-only --diff-filter=AM HEAD^ HEAD | grep '.*\.cs$') | |
if [ ${#files[@]} -ne 0 ]; then dotnet format OpenTabletDriver.sln --verify-no-changes --include "${files[@]}"; fi | |
unittests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '8.0' | |
- name: Run tests | |
run: dotnet test | |
slnf: | |
name: Validate Solution Filters | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '8.0' | |
- name: Windows | |
run: dotnet restore OpenTabletDriver.Windows.slnf | |
- name: Linux | |
run: dotnet restore OpenTabletDriver.Linux.slnf | |
- name: MacOS | |
run: dotnet restore OpenTabletDriver.MacOS.slnf |