Skip to content

Commit

Permalink
CI with deployment on version tag (#53)
Browse files Browse the repository at this point in the history
* Update hidapi submodule
  • Loading branch information
simon-wh authored Jan 3, 2023
1 parent e7b9474 commit b574ee7
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 1 deletion.
127 changes: 127 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Build

on: [push]

env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: windows/wooting-rgb-sdk.sln

# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release

permissions:
contents: read

jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: write

strategy:
matrix:
os: [macos-latest, ubuntu-latest]
include:
- os: windows-latest
target: x64
- os: windows-latest
target: x86

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Add MSBuild to PATH (Windows)
if: startsWith(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v1.1

- name: Install dependencies
uses: ConorMacBride/install-package@v1
with:
brew: hidapi
apt: libhidapi-dev libhidapi-hidraw0

- name: Build (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: cd linux && make

- name: Build (Mac)
if: startsWith(matrix.os, 'mac')
run: cd mac && make

# - name: Restore NuGet packages
# working-directory: ${{env.GITHUB_WORKSPACE}}
# run: nuget restore ${{env.SOLUTION_FILE_PATH}}

- name: Build (Windows)
if: startsWith(matrix.os, 'windows')
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{matrix.target}} ${{env.SOLUTION_FILE_PATH}}

- name: Gen Release name
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
VER=${GITHUB_REF##*v}
OS=${{matrix.os}}
OS_NAME=${OS%-*}
R_TARGET=${{matrix.target}}
TARGET=${R_TARGET:-x64}
echo "TAG_VERSION=$VER" >> $GITHUB_ENV
echo "RELEASE_NAME=wooting-rgb-sdk-v$VER-$OS_NAME-$TARGET" >> $GITHUB_ENV
- name: Init dist
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
mkdir dist
cp src/*.h dist/
- name: Copy dist files (Linux)
if: startsWith(github.ref, 'refs/tags/v') && startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
cp linux/*.pc dist/
cp linux/*.so dist/
- name: Copy dist files (Mac)
if: startsWith(github.ref, 'refs/tags/v') && startsWith(matrix.os, 'mac')
shell: bash
run: |
cp mac/*.pc dist/
cp mac/*.dylib dist/
- name: Copy dist files (Windows)
if: startsWith(github.ref, 'refs/tags/v') && startsWith(matrix.os, 'windows')
shell: bash
run: |
# Copy Windows x64 files
cp windows/x64/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk64.dll dist/ || true
cp windows/x64/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk64.lib dist/ || true
cp windows/x64/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk64.pdb dist/ || true
# Copy Windows x86 files
cp windows/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk.dll dist/ || true
cp windows/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk.lib dist/ || true
cp windows/${{env.BUILD_CONFIGURATION}}/wooting-rgb-sdk.pdb dist/ || true
- name: Zip files
if: startsWith(github.ref, 'refs/tags/v')
uses: vimtor/action-zip@v1
with:
files: dist/
recursive: true
dest: ${{env.RELEASE_NAME}}.zip

- name: Make Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
files: ${{env.RELEASE_NAME}}.zip
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
2 changes: 1 addition & 1 deletion hidapi
Submodule hidapi updated 61 files
+17 −21 .appveyor.yml
+18 −0 .builds/netbsd.yml
+193 −0 .github/workflows/builds.yml
+4 −0 .gitignore
+0 −13 .travis.yml
+1 −1 AUTHORS.txt
+114 −0 BUILD.autotools.md
+233 −0 BUILD.cmake.md
+121 −0 BUILD.md
+61 −0 CMakeLists.txt
+1 −0 HACKING.txt
+61 −251 README.md
+1 −1 VERSION
+12 −3 configure.ac
+ documentation/cmake-gui-drop-down.png
+ documentation/cmake-gui-highlights.png
+28 −4 hidapi/hidapi.h
+24 −0 hidtest/CMakeLists.txt
+8 −0 hidtest/Makefile.am
+36 −6 hidtest/test.c
+67 −0 libusb/CMakeLists.txt
+1 −1 libusb/Makefile.am
+1 −1 libusb/Makefile.freebsd
+1 −1 libusb/Makefile.haiku
+1 −1 libusb/Makefile.linux
+309 −198 libusb/hid.c
+56 −0 libusb/hidapi_libusb.h
+38 −0 linux/CMakeLists.txt
+40 −10 linux/hid.c
+48 −0 mac/CMakeLists.txt
+1 −1 mac/Makefile-manual
+102 −163 mac/hid.c
+98 −0 mac/hidapi_darwin.h
+1 −0 pc/hidapi-hidraw.pc.in
+1 −0 pc/hidapi-libusb.pc.in
+1 −0 pc/hidapi.pc.in
+184 −0 src/CMakeLists.txt
+61 −0 src/cmake/hidapi-config.cmake.in
+1 −1 testgui/Makefile.mingw
+2 −2 testgui/testgui.vcproj
+36 −0 udev/69-hid.rules
+0 −33 udev/99-hid.rules
+45 −0 windows/CMakeLists.txt
+0 −1 windows/Makefile.am
+3 −3 windows/Makefile.mingw
+0 −2 windows/ddk_build/.gitignore
+0 −18 windows/ddk_build/hidapi.def
+0 −49 windows/ddk_build/makefile
+0 −23 windows/ddk_build/sources
+696 −547 windows/hid.c
+35 −0 windows/hidapi.rc
+0 −1 windows/hidapi.vcproj
+49 −9 windows/hidapi.vcxproj
+8 −0 windows/hidapi.vcxproj.filters
+69 −0 windows/hidapi_cfgmgr32.h
+38 −0 windows/hidapi_hidclass.h
+65 −0 windows/hidapi_hidpi.h
+60 −0 windows/hidapi_hidsdi.h
+58 −0 windows/hidapi_winapi.h
+2 −2 windows/hidtest.vcproj
+28 −8 windows/hidtest.vcxproj

0 comments on commit b574ee7

Please sign in to comment.