Update target frameworks #178
Workflow file for this run
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' | |
on: | |
workflow_dispatch: | |
inputs: | |
publish_release: | |
description: If this build should publish nuget packages | |
required: true | |
type: boolean | |
version_suffix: | |
description: Suffix of the version number. Can be used to create a preview package. | |
required: true | |
type: string | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
env: | |
configuration: Release | |
publish_release: ${{ github.event.inputs.publish_release }} | |
version_suffix: ${{ github.event.inputs.version_suffix }} | |
tester_framework: net8.0 | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ windows-latest, macos-latest, ubuntu-latest ] | |
steps: | |
- name: Checkout with submodules | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Prepare .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Build solution | |
run: dotnet build --nologo -c ${{ env.configuration }} | |
working-directory: './src' | |
- name: Verify code format | |
if: matrix.os == 'ubuntu-latest' | |
run: dotnet format --no-restore --verify-no-changes | |
working-directory: './src' | |
- name: Run unit tests | |
run: dotnet test --no-restore -c ${{ env.configuration }} | |
working-directory: './src' | |
- name: Test Linux 64 bit | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get install libhidapi-hidraw0 | |
dotnet run --framework ${{ env.tester_framework }} -- --requireOsPlatform LINUX --require64bit | |
working-directory: './src/HidApi.Net.Tester' | |
- name: Test OSX 64 bit | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install hidapi | |
dotnet run --framework ${{ env.tester_framework }} -- --requireOsPlatform OSX --require64bit | |
working-directory: './src/HidApi.Net.Tester' | |
- name: Setup Windows 64 bit | |
if: matrix.os == 'windows-latest' | |
uses: msys2/setup-msys2@v2 | |
with: | |
path-type: inherit | |
update: true | |
install: >- | |
mingw-w64-x86_64-hidapi | |
- name: Test Windows 64 bit | |
if: matrix.os == 'Windows-latest' | |
run: dotnet run --framework ${{ env.tester_framework }} -- --requireOsPlatform WINDOWS --require64bit | |
shell: msys2 {0} | |
working-directory: './src/HidApi.Net.Tester' | |
- name: Pack release version | |
if: env.publish_release == 'true' && matrix.os == 'ubuntu-latest' | |
run: dotnet pack HidApi.Net/HidApi.Net.csproj --no-build --nologo -c ${{ env.configuration }} --version-suffix ${{ env.version_suffix }} -o ../Nuget | |
working-directory: './src' | |
- name: Publish to nuget org | |
if: env.publish_release == 'true' && matrix.os == 'ubuntu-latest' | |
run: dotnet nuget push "*.nupkg" -k ${{ secrets.NUGET_API_KEY }} -s nuget.org | |
working-directory: './Nuget' |