Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 169 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: 'Build'

on:
push:
branches:
- master
tags:
- 'v*'
paths-ignore:
- '**/*.md'
- '**/*.aip'
- '.vscode/**'
- '**/*.json'
- 'setup/**'
pull_request:
branches:
- master
workflow_dispatch:

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: ${{ github.ref_type != 'tag' }}

env:
# Offset chosen to stay well above the last AppVeyor build counter (3.3.1251.0) at time of migration.
BUILD_VERSION_OFFSET: 2000
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
DOTNET_NOLOGO: 'true'
SCPLIB_ENABLE_TELEMETRY: 'false'
# Disabled by default; enabled per-job below only when the VCPKG_NUGET_TOKEN secret is present.
# GITHUB_TOKEN cannot push new packages under a personal-account GitHub Packages namespace, so a
# PAT with read:packages/write:packages is required. See:
# https://github.com/microsoft/vcpkg/issues/47470
VCPKG_BINARY_SOURCES: 'clear'

jobs:
build:
name: 'Platform: ${{ matrix.platform }}'
runs-on: windows-2022
permissions:
contents: read
env:
# Secrets can't be referenced directly in `if:` conditions, only in `env:`/`with:`,
# so promote it here and check env.VCPKG_NUGET_TOKEN in the step below instead.
VCPKG_NUGET_TOKEN: ${{ secrets.VCPKG_NUGET_TOKEN }}
strategy:
fail-fast: false
matrix:
platform: [x64, ARM64, x86]
outputs:
build-version: ${{ steps.version.outputs.build-version }}
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
submodules: recursive
lfs: true
Comment thread
coderabbitai[bot] marked this conversation as resolved.
persist-credentials: false

- name: 'Compute build version'
id: version
shell: pwsh
run: |
$buildVersion = "3.3.$([int]$env:BUILD_VERSION_OFFSET + ${{ github.run_number }}).0"
echo "BUILD_VERSION=$buildVersion" >> $env:GITHUB_ENV
echo "build-version=$buildVersion" >> $env:GITHUB_OUTPUT
Write-Output "Building version $buildVersion"

- name: 'Bootstrap vcpkg'
shell: cmd
run: .\XInputBridge\vcpkg\bootstrap-vcpkg.bat -disableMetrics

- name: 'Configure vcpkg NuGet binary cache'
if: ${{ env.VCPKG_NUGET_TOKEN != '' }}
shell: pwsh
run: |
$nugetExe = & .\XInputBridge\vcpkg\vcpkg.exe fetch nuget | Select-Object -Last 1
& $nugetExe sources add `
-Source "https://nuget.pkg.github.com/nefarius/index.json" `
-StorePasswordInClearText `
-Name "GitHubPackages" `
-UserName "nefarius" `
-Password "$env:VCPKG_NUGET_TOKEN"
& $nugetExe setapikey "$env:VCPKG_NUGET_TOKEN" `
-Source "https://nuget.pkg.github.com/nefarius/index.json"
echo "VCPKG_BINARY_SOURCES=clear;nuget,https://nuget.pkg.github.com/nefarius/index.json,readwrite" >> $env:GITHUB_ENV

- name: 'Cache NuGet packages'
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/*.csproj', 'nuget.config') }}
restore-keys: |
nuget-${{ runner.os }}-

- name: 'Install vpatch'
run: dotnet tool install --global Nefarius.Tools.Vpatch

- name: 'Stamp version into driver and XInputBridge'
shell: cmd
run: |
vpatch --stamp-version "%BUILD_VERSION%" --target-file ".\driver\dshidmini.vcxproj" --vcxproj.inf-time-stamp
vpatch --stamp-version "%BUILD_VERSION%" --target-file ".\driver\dshidmini.rc" --resource.file-version --resource.product-version
vpatch --stamp-version "%BUILD_VERSION%" --target-file ".\XInputBridge\XInputBridge.rc" --resource.file-version --resource.product-version

- name: 'Restore managed projects'
# msbuild's /t:Rebuild over the whole solution does not implicitly restore SDK-style
# projects; these two dotnet restore calls also transitively restore the SDK project
# referenced by both. Mirrors appveyor.yml's former before_build steps.
shell: cmd
run: |
dotnet restore .\ControlApp\
dotnet restore .\ipctest\

- name: 'Build'
shell: cmd
run: .\build.cmd --target-platform ${{ matrix.platform }}

- name: 'Publish ControlApp'
if: matrix.platform == 'x64'
shell: cmd
run: .\build.cmd PublishControlApp --skip Compile

- name: 'Pack driver CAB'
if: matrix.platform != 'x86'
shell: cmd
run: makecab.exe /f .\DsHidMini_${{ matrix.platform }}.ddf

- name: 'Upload artifacts'
uses: actions/upload-artifact@v4
with:
name: dshidmini-${{ matrix.platform }}
if-no-files-found: error
path: |
disk1/*.cab
bin/**/dshidmini/*.inf
bin/**/dshidmini/*.cat
bin/**/dshidmini/*.dll
bin/**/*.pdb
bin/**/*.dll
bin/*.exe

release:
name: 'Draft release'
needs: build
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 'Download artifacts'
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: dshidmini-*

- name: 'Create draft release'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REF_NAME: ${{ github.ref_name }}
run: |
gh release create "$REF_NAME" \
--repo "${{ github.repository }}" \
--title "$REF_NAME (build ${{ needs.build.outputs.build-version }})" \
--draft \
--generate-notes \
artifacts/dshidmini-x64/disk1/*.cab \
artifacts/dshidmini-ARM64/disk1/*.cab \
artifacts/dshidmini-x64/bin/*.exe
Comment thread
coderabbitai[bot] marked this conversation as resolved.
12 changes: 6 additions & 6 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"BuildSetup",
"Clean",
"Compile",
"DownloadAppVeyorArtifacts",
"DownloadCiArtifacts",
"PublishControlApp",
"Restore",
"SignProductionBinaries"
Expand Down Expand Up @@ -107,11 +107,11 @@
"properties": {
"ArtifactsPath": {
"type": "string",
"description": "Output path for DownloadAppVeyorArtifacts artifacts. Default: ./artifacts"
"description": "Output path for DownloadCiArtifacts artifacts. Default: ./artifacts"
},
"BuildVersion": {
"type": "string",
"description": "Build version or branch for DownloadAppVeyorArtifacts (AppVeyor artifact download)"
"description": "GitHub Actions run ID for DownloadCiArtifacts artifact download"
},
"Configuration": {
"type": "string",
Expand All @@ -123,7 +123,7 @@
},
"NoSigning": {
"type": "boolean",
"description": "Skip signing in DownloadAppVeyorArtifacts"
"description": "Skip signing in DownloadCiArtifacts"
},
"SetupVersion": {
"type": "string",
Expand All @@ -137,9 +137,9 @@
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Token": {
"TargetPlatform": {
"type": "string",
"description": "AppVeyor API token for DownloadAppVeyorArtifacts artifact download"
"description": "Target platform for BuildDmf on CI (x64, ARM64 or x86). Not needed for local builds."
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

<!-- Docs and symbols generation -->
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<!-- CI artifacts don't consume the local .nupkg; skip packing to avoid NU1012 on
net8.0-windows-targeted projects with unpinned/newer .NET SDKs (see dotnet/sdk). -->
<GeneratePackageOnBuild Condition="'$(CI)' == 'True'">false</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# <img src="assets/FireShock.png" align="left" alt="DsHidMini logo" />DsHidMini

[![Build status](https://ci.appveyor.com/api/projects/status/vmf09i95d06c8mbh/branch/master?svg=true)](https://ci.appveyor.com/project/nefarius/dshidmini/branch/master) [![GitHub All Releases](https://img.shields.io/github/downloads/nefarius/DsHidMini/total)](https://somsubhra.github.io/github-release-stats/?username=nefarius&repository=DsHidMini) ![GitHub issues](https://img.shields.io/github/issues/nefarius/DsHidMini) [![Discord](https://img.shields.io/discord/346756263763378176.svg)](https://discord.nefarius.at/) [![Website](https://img.shields.io/website-up-down-green-red/https/docs.nefarius.at.svg?label=docs.nefarius.at)](https://docs.nefarius.at/)
[![Build status](https://github.com/nefarius/DsHidMini/actions/workflows/build.yml/badge.svg)](https://github.com/nefarius/DsHidMini/actions/workflows/build.yml) [![GitHub All Releases](https://img.shields.io/github/downloads/nefarius/DsHidMini/total)](https://somsubhra.github.io/github-release-stats/?username=nefarius&repository=DsHidMini) ![GitHub issues](https://img.shields.io/github/issues/nefarius/DsHidMini) [![Discord](https://img.shields.io/discord/346756263763378176.svg)](https://discord.nefarius.at/) [![Website](https://img.shields.io/website-up-down-green-red/https/docs.nefarius.at.svg?label=docs.nefarius.at)](https://docs.nefarius.at/)

Virtual HID Mini user-mode driver for Sony DualShock 3 controllers on Windows 10/11.

Expand Down Expand Up @@ -84,4 +84,4 @@ Pre-built binaries and instructions: [releases](https://github.com/nefarius/DsHi
- **Related:** [ScpToolkit](https://github.com/nefarius/ScpToolkit), [FireShock](https://github.com/nefarius/FireShock), [AirBender](https://github.com/nefarius/AirBender), [WireShock](https://github.com/nefarius/WireShock), [EmuController](https://github.com/FirstPlatoLV/EmuController), [USB_Host_Shield_2.0 PS3 Info](https://github.com/felis/USB_Host_Shield_2.0/wiki/PS3-Information#USB)
- **Dependencies:** [DMF](https://github.com/microsoft/DMF), [cJSON](https://github.com/DaveGamble/cJSON), [HIDAPI](https://github.com/libusb/hidapi)
- **References:** [Eleccelerator DualShock 3](http://eleccelerator.com/wiki/index.php?title=DualShock_3), [HID Usage Tables](https://usb.org/sites/default/files/documents/hut1_12v2.pdf), [The HID Page](http://janaxelson.com/hidpage.htm), [CircumSpector/Research Sony DS3](https://github.com/CircumSpector/Research/tree/master/Sony%20DualShock%203), [linux hid-sony](https://github.com/torvalds/linux/blob/master/drivers/hid/hid-sony.c)
- **DevOps:** [AppVeyor](https://www.appveyor.com/), [NUKE](https://nuke.build/)
- **DevOps:** [GitHub Actions](https://github.com/features/actions), [NUKE](https://nuke.build/)
Loading
Loading