Merge pull request #114 from tqphan/tqphan-patch-1 #458
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: Build Packages | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v*.*.* | |
- v*.*.*-preview.* | |
workflow_dispatch: | |
env: | |
SHARPHOOK_VERSION: v5.3.7 | |
DOTNET_VERSION: 8.0.x | |
jobs: | |
libuiohook-macos-arm64: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Compile | |
env: | |
CC: clang | |
CFLAGS: '-O2 -g -target arm64-apple-macos10.15 -flto -fomit-frame-pointer -fno-stack-protector -pipe' | |
LDFLAGS: '-Wl,-dead_strip_dylibs' | |
shell: bash | |
run: | | |
cd libuiohook | |
cmake -B ${{github.workspace}}/build \ | |
-G "Unix Makefiles" \ | |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/dist/darwin/arm64 \ | |
-D CMAKE_VERBOSE_MAKEFILE=true \ | |
-D CMAKE_OSX_ARCHITECTURES='arm64' \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D USE_EPOCH_TIME=ON | |
cmake --build ${{github.workspace}}/build \ | |
--parallel 2 \ | |
--config RelWithDebInfo \ | |
--clean-first | |
cmake --install ${{github.workspace}}/build --config RelWithDebInfo | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libuiohook-macos-arm64 | |
path: ${{github.workspace}}/dist/**/* | |
libuiohook-macos-x64: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Compile | |
env: | |
CC: clang | |
CFLAGS: '-O2 -g -target x86_64-apple-macos10.15 -flto -fomit-frame-pointer -fno-stack-protector -pipe' | |
LDFLAGS: '-Wl,-dead_strip_dylibs' | |
shell: bash | |
run: | | |
cd libuiohook | |
cmake -B ${{github.workspace}}/build \ | |
-G "Unix Makefiles" \ | |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/dist/darwin/x86_64 \ | |
-D CMAKE_VERBOSE_MAKEFILE=true \ | |
-D CMAKE_OSX_ARCHITECTURES='x86_64' \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D USE_EPOCH_TIME=ON | |
cmake --build ${{github.workspace}}/build \ | |
--parallel 2 \ | |
--config RelWithDebInfo \ | |
--clean-first | |
cmake --install ${{github.workspace}}/build --config RelWithDebInfo | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libuiohook-macos-x64 | |
path: ${{github.workspace}}/dist/**/* | |
libuiohook-mac-catalyst-arm64: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Compile | |
env: | |
CC: clang | |
CFLAGS: '-O2 -g -target arm64-apple-ios13.1-macabi -miphoneos-version-min=13.1 -fembed-bitcode' | |
shell: bash | |
run: | | |
cd libuiohook | |
cmake -B ${{github.workspace}}/build \ | |
-G "Unix Makefiles" \ | |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/dist/catalyst/arm64 \ | |
-D CMAKE_VERBOSE_MAKEFILE=true \ | |
-D CMAKE_OSX_ARCHITECTURES='arm64' \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D MAC_CATALYST=ON \ | |
-D USE_APPLICATION_SERVICES=OFF \ | |
-D USE_APPKIT=OFF \ | |
-D USE_EPOCH_TIME=ON | |
cmake --build ${{github.workspace}}/build \ | |
--parallel 2 \ | |
--config RelWithDebInfo \ | |
--clean-first | |
cmake --install ${{github.workspace}}/build --config RelWithDebInfo | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libuiohook-mac-catalyst-arm64 | |
path: ${{github.workspace}}/dist/**/* | |
libuiohook-mac-catalyst-x64: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Compile | |
env: | |
CC: clang | |
CFLAGS: '-O2 -g -target x86_64-apple-ios13.1-macabi -miphoneos-version-min=13.1 -fembed-bitcode' | |
shell: bash | |
run: | | |
cd libuiohook | |
cmake -B ${{github.workspace}}/build \ | |
-G "Unix Makefiles" \ | |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/dist/catalyst/x86_64 \ | |
-D CMAKE_VERBOSE_MAKEFILE=true \ | |
-D CMAKE_OSX_ARCHITECTURES='x86_64' \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D MAC_CATALYST=ON \ | |
-D USE_APPLICATION_SERVICES=OFF \ | |
-D USE_APPKIT=OFF \ | |
-D USE_EPOCH_TIME=ON | |
cmake --build ${{github.workspace}}/build \ | |
--parallel 2 \ | |
--config RelWithDebInfo \ | |
--clean-first | |
cmake --install ${{github.workspace}}/build --config RelWithDebInfo | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libuiohook-mac-catalyst-x64 | |
path: ${{github.workspace}}/dist/**/* | |
libuiohook-linux-arm: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup | |
shell: bash | |
run: | | |
sudo rm -Rf /etc/apt/sources.list.d | |
sudo bash -c 'source /etc/lsb-release && echo " | |
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME} main universe | |
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME}-updates main universe | |
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME}-backports main universe | |
deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${DISTRIB_CODENAME} main universe | |
deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${DISTRIB_CODENAME}-updates main universe | |
deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${DISTRIB_CODENAME}-backports main universe | |
" > /etc/apt/sources.list' | |
sudo dpkg --add-architecture armhf | |
sudo apt update -m | |
sudo apt install -qy \ | |
binutils-arm-linux-gnueabihf \ | |
gcc-arm-linux-gnueabihf | |
sudo apt install -qy \ | |
libx11-dev:armhf \ | |
libxtst-dev:armhf \ | |
libxt-dev:armhf \ | |
libxinerama-dev:armhf \ | |
libx11-xcb-dev:armhf \ | |
libxkbcommon-dev:armhf \ | |
libxkbcommon-x11-dev:armhf \ | |
libxkbfile-dev:armhf | |
- name: Compile | |
env: | |
CC: arm-linux-gnueabihf-gcc | |
CFLAGS: '-Os -march=armv7ve -mfpu=vfp -mfloat-abi=hard -g -flto -fomit-frame-pointer -fno-stack-protector -pipe' | |
LDFLAGS: '-fuse-ld=gold -Wl,-O1 -Wl,--as-needed' | |
PKG_CONFIG_PATH: '/usr/lib/arm-linux-gnueabihf/pkgconfig' | |
shell: bash | |
run: | | |
cd libuiohook | |
cmake -B ${{github.workspace}}/build \ | |
-G "Unix Makefiles" \ | |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/dist/linux/arm \ | |
-D CMAKE_VERBOSE_MAKEFILE=true \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D USE_EPOCH_TIME=ON | |
cmake --build ${{github.workspace}}/build \ | |
--parallel 2 \ | |
--config RelWithDebInfo \ | |
--clean-first | |
cmake --install ${{github.workspace}}/build --config RelWithDebInfo | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libuiohook-linux-arm | |
path: ${{github.workspace}}/dist/**/* | |
libuiohook-linux-arm64: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup | |
shell: bash | |
run: | | |
sudo rm -Rf /etc/apt/sources.list.d/* | |
sudo bash -c 'source /etc/lsb-release && echo " | |
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME} main universe | |
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME}-updates main universe | |
deb [arch=amd64,i386] http://us.archive.ubuntu.com/ubuntu ${DISTRIB_CODENAME}-backports main universe | |
deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${DISTRIB_CODENAME} main universe | |
deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${DISTRIB_CODENAME}-updates main universe | |
deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports ${DISTRIB_CODENAME}-backports main universe | |
" > /etc/apt/sources.list' | |
sudo dpkg --add-architecture arm64 | |
sudo apt update -m | |
sudo apt install -qy \ | |
binutils-aarch64-linux-gnu \ | |
gcc-aarch64-linux-gnu | |
sudo apt install -qy \ | |
libx11-dev:arm64 \ | |
libxtst-dev:arm64 \ | |
libxt-dev:arm64 \ | |
libxinerama-dev:arm64 \ | |
libx11-xcb-dev:arm64 \ | |
libxkbcommon-dev:arm64 \ | |
libxkbcommon-x11-dev:arm64 \ | |
libxkbfile-dev:arm64 | |
- name: Compile | |
env: | |
CC: aarch64-linux-gnu-gcc | |
CFLAGS: '-Os -march=armv8-a+crc -mtune=cortex-a53 -g -flto -fomit-frame-pointer -fno-stack-protector -pipe' | |
LDFLAGS: '-fuse-ld=gold -Wl,-O1 -Wl,--as-needed' | |
PKG_CONFIG_PATH: '/usr/lib/aarch64-linux-gnu/pkgconfig' | |
shell: bash | |
run: | | |
cd libuiohook | |
cmake -B ${{github.workspace}}/build \ | |
-G "Unix Makefiles" \ | |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/dist/linux/arm64 \ | |
-D CMAKE_VERBOSE_MAKEFILE=true \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D USE_EPOCH_TIME=ON | |
cmake --build ${{github.workspace}}/build \ | |
--parallel 2 \ | |
--config RelWithDebInfo \ | |
--clean-first | |
cmake --install ${{github.workspace}}/build --config RelWithDebInfo | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libuiohook-linux-arm64 | |
path: ${{github.workspace}}/dist/**/* | |
libuiohook-linux-x64: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup | |
shell: bash | |
run: | | |
sudo apt update -qy | |
sudo apt install -qy \ | |
libx11-dev:amd64 \ | |
libxtst-dev:amd64 \ | |
libxt-dev:amd64 \ | |
libxinerama-dev:amd64 \ | |
libx11-xcb-dev:amd64 \ | |
libxkbcommon-dev:amd64 \ | |
libxkbcommon-x11-dev:amd64 \ | |
libxkbfile-dev:amd64 | |
- name: Compile | |
env: | |
CC: x86_64-linux-gnu-gcc | |
CFLAGS: '-O2 -march=x86-64 -mtune=generic -g -fomit-frame-pointer -flto -fno-stack-protector -pipe' | |
LDFLAGS: '-fuse-ld=gold -Wl,-O1 -Wl,--as-needed' | |
PKG_CONFIG_PATH: '/usr/lib/x86_64-linux-gnu/pkgconfig' | |
shell: bash | |
run: | | |
cd libuiohook | |
cmake -B ${{github.workspace}}/build \ | |
-G "Unix Makefiles" \ | |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/dist/linux/x86_64 \ | |
-D CMAKE_VERBOSE_MAKEFILE=true \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D USE_EPOCH_TIME=ON | |
cmake --build ${{github.workspace}}/build \ | |
--parallel 2 \ | |
--config RelWithDebInfo \ | |
--clean-first | |
cmake --install ${{github.workspace}}/build --config RelWithDebInfo | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libuiohook-linux-x64 | |
path: ${{github.workspace}}/dist/**/* | |
libuiohook-windows-arm64: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64_arm64 | |
- name: Compile | |
shell: pwsh | |
run: | | |
cd libuiohook | |
cmake -B ${{github.workspace}}\build ` | |
-G "Visual Studio 17 2022" -A ARM64 ` | |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}\dist\windows\arm64 ` | |
-D CMAKE_VERBOSE_MAKEFILE=true ` | |
-D BUILD_SHARED_LIBS=ON ` | |
-D CMAKE_POLICY_DEFAULT_CMP0091=NEW ` | |
-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ` | |
-D USE_EPOCH_TIME=ON | |
cmake --build ${{github.workspace}}\build ` | |
--parallel 2 ` | |
--config RelWithDebInfo ` | |
--clean-first | |
cmake --install ${{github.workspace}}\build --config RelWithDebInfo | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libuiohook-windows-arm64 | |
path: ${{github.workspace}}/dist/**/* | |
libuiohook-windows-x86: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64_x86 | |
- name: Compile | |
shell: pwsh | |
run: | | |
cd libuiohook | |
cmake -B ${{github.workspace}}\build ` | |
-G "Visual Studio 17 2022" -A Win32 ` | |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}\dist\windows\x86 ` | |
-D CMAKE_VERBOSE_MAKEFILE=true ` | |
-D BUILD_SHARED_LIBS=ON ` | |
-D CMAKE_POLICY_DEFAULT_CMP0091=NEW ` | |
-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ` | |
-D USE_EPOCH_TIME=ON | |
cmake --build ${{github.workspace}}\build ` | |
--parallel 2 ` | |
--config RelWithDebInfo ` | |
--clean-first | |
cmake --install ${{github.workspace}}\build --config RelWithDebInfo | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libuiohook-windows-x86 | |
path: ${{github.workspace}}/dist/**/* | |
libuiohook-windows-x64: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64 | |
- name: Compile | |
shell: pwsh | |
run: | | |
cd libuiohook | |
cmake -B ${{github.workspace}}\build ` | |
-G "Visual Studio 17 2022" -A x64 ` | |
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}\dist\windows\x86_64 ` | |
-D CMAKE_VERBOSE_MAKEFILE=true ` | |
-D BUILD_SHARED_LIBS=ON ` | |
-D CMAKE_POLICY_DEFAULT_CMP0091=NEW ` | |
-D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ` | |
-D USE_EPOCH_TIME=ON | |
cmake --build ${{github.workspace}}\build ` | |
--parallel 2 ` | |
--config RelWithDebInfo ` | |
--clean-first | |
cmake --install ${{github.workspace}}\build --config RelWithDebInfo | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libuiohook-windows-x64 | |
path: ${{github.workspace}}/dist/**/* | |
merge-libuiohook-artifacts: | |
runs-on: windows-latest | |
needs: | |
- libuiohook-macos-arm64 | |
- libuiohook-macos-x64 | |
- libuiohook-mac-catalyst-arm64 | |
- libuiohook-mac-catalyst-x64 | |
- libuiohook-linux-arm | |
- libuiohook-linux-arm64 | |
- libuiohook-linux-x64 | |
- libuiohook-windows-arm64 | |
- libuiohook-windows-x86 | |
- libuiohook-windows-x64 | |
steps: | |
- uses: actions/upload-artifact/merge@v4 | |
with: | |
name: libuiohook-build | |
pattern: libuiohook-* | |
delete-merged: true | |
sharphook: | |
runs-on: windows-latest | |
needs: | |
- merge-libuiohook-artifacts | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Setup docfx | |
shell: pwsh | |
run: dotnet tool update --global docfx | |
- name: Fetch libuiohook | |
uses: actions/download-artifact@v4 | |
with: | |
name: libuiohook-build | |
path: libuiohook-build | |
- name: Move libuiohook | |
shell: pwsh | |
run: | | |
mv libuiohook-build\linux\arm\lib\libuiohook.so SharpHook\lib\linux-arm\ | |
mv libuiohook-build\linux\arm64\lib\libuiohook.so SharpHook\lib\linux-arm64\ | |
mv libuiohook-build\linux\x86_64\lib\libuiohook.so SharpHook\lib\linux-x64\ | |
mv libuiohook-build\catalyst\arm64\lib\libuiohook.dylib SharpHook\lib\maccatalyst-arm64\ | |
mv libuiohook-build\catalyst\x86_64\lib\libuiohook.dylib SharpHook\lib\maccatalyst-x64\ | |
mv libuiohook-build\darwin\arm64\lib\libuiohook.dylib SharpHook\lib\osx-arm64\ | |
mv libuiohook-build\darwin\x86_64\lib\libuiohook.dylib SharpHook\lib\osx-x64\ | |
mv libuiohook-build\windows\arm64\bin\uiohook.dll SharpHook\lib\win-arm64\ | |
mv libuiohook-build\windows\x86\bin\uiohook.dll SharpHook\lib\win-x86\ | |
mv libuiohook-build\windows\x86_64\bin\uiohook.dll SharpHook\lib\win-x64\ | |
- name: Build SharpHook | |
shell: pwsh | |
run: | | |
cd SharpHook | |
dotnet build --nologo -c Release /p:ContinuousIntegrationBuild=true | |
cd ..\SharpHook.Reactive | |
dotnet build --nologo -c Release /p:ContinuousIntegrationBuild=true | |
cd ..\SharpHook.Tests | |
dotnet build --nologo -c Release /p:ContinuousIntegrationBuild=true | |
- name: Test SharpHook | |
shell: pwsh | |
run: | | |
cd SharpHook.Tests | |
dotnet test --no-build --nologo -c Release | |
- name: Pack SharpHook | |
shell: pwsh | |
run: | | |
cd SharpHook | |
dotnet pack --no-build --nologo -c Release -o ${{github.workspace}}\build\ | |
cd ..\SharpHook.Reactive | |
dotnet pack --no-build --nologo -c Release -o ${{github.workspace}}\build\ | |
- name: Upload SharpHook | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sharphook-build | |
path: ${{github.workspace}}\build\* | |
- name: Build Docs | |
shell: pwsh | |
working-directory: docs | |
run: docfx docfx.json | |
continue-on-error: false | |
- name: Publish Docs | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_site/ | |
destination_dir: ${{ env.SHARPHOOK_VERSION }} | |
user_name: "Tolik Pylypchuk" | |
user_email: "[email protected]" | |
commit_message: "Deploy docs to GitHub Pages" | |
publish: | |
runs-on: windows-latest | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
needs: [sharphook] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Fetch Packages | |
uses: actions/download-artifact@v4 | |
with: | |
name: sharphook-build | |
path: sharphook-build | |
- name: Publish Packages | |
shell: pwsh | |
run: | | |
cd .\sharphook-build | |
dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |