159 lines
4.9 KiB
YAML
159 lines
4.9 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- ".gitea/workflows/build.yml"
|
|
- "CMakeLists.txt"
|
|
- "cmake/**"
|
|
- "scripts/**"
|
|
- "src/**"
|
|
- "res/**"
|
|
workflow_dispatch:
|
|
inputs:
|
|
target_ref:
|
|
description: "Git ref to build"
|
|
required: false
|
|
default: "master"
|
|
|
|
jobs:
|
|
build-linux:
|
|
name: Build Linux CPU
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout push ref
|
|
uses: actions/checkout@v4
|
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
|
|
|
- name: Checkout requested ref
|
|
uses: actions/checkout@v4
|
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
with:
|
|
ref: ${{ inputs.target_ref }}
|
|
|
|
- name: Install deps
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential cmake libuv1-dev
|
|
|
|
- name: Configure
|
|
run: |
|
|
cmake -S . -B build \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DWITH_TLS=OFF \
|
|
-DWITH_HWLOC=OFF \
|
|
-DWITH_OPENCL=OFF \
|
|
-DWITH_CUDA=OFF \
|
|
-DWITH_NVML=OFF \
|
|
-DWITH_ADL=OFF
|
|
|
|
- name: Build
|
|
run: cmake --build build -j"$(nproc)"
|
|
|
|
- name: Package
|
|
run: |
|
|
mkdir -p dist/linux
|
|
BIN=""
|
|
if [ -x build/xmrig ]; then
|
|
BIN="build/xmrig"
|
|
elif [ -x build/xmrig-notls ]; then
|
|
BIN="build/xmrig-notls"
|
|
else
|
|
echo "No Linux xmrig binary found in build/"
|
|
find build -maxdepth 2 -type f | sort
|
|
exit 1
|
|
fi
|
|
cp "$BIN" dist/linux/xmrig
|
|
cp src/config.json dist/linux/config.json
|
|
cp README.md LICENSE dist/linux/
|
|
tar -C dist/linux -czf xmrig-peya-linux-x86_64.tar.gz .
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: xmrig-peya-linux-x86_64
|
|
path: xmrig-peya-linux-x86_64.tar.gz
|
|
|
|
build-windows:
|
|
name: Build Windows CPU
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout push ref
|
|
uses: actions/checkout@v4
|
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
|
|
|
- name: Checkout requested ref
|
|
uses: actions/checkout@v4
|
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
with:
|
|
ref: ${{ inputs.target_ref }}
|
|
|
|
- name: Ensure vcpkg
|
|
shell: cmd
|
|
run: |
|
|
if exist C:\vcpkg (
|
|
echo Using existing vcpkg at C:\vcpkg
|
|
) else (
|
|
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
|
|
call C:\vcpkg\bootstrap-vcpkg.bat
|
|
)
|
|
C:\vcpkg\vcpkg.exe install libuv:x64-windows-static
|
|
|
|
- name: Resolve CMake
|
|
shell: cmd
|
|
run: |
|
|
set "CMAKE_EXE="
|
|
for %%I in (cmake.exe) do set "CMAKE_EXE=%%~$PATH:I"
|
|
if not defined CMAKE_EXE if exist "C:\Program Files\CMake\bin\cmake.exe" set "CMAKE_EXE=C:\Program Files\CMake\bin\cmake.exe"
|
|
if not defined CMAKE_EXE if exist "C:\Program Files (x86)\CMake\bin\cmake.exe" set "CMAKE_EXE=C:\Program Files (x86)\CMake\bin\cmake.exe"
|
|
if not defined CMAKE_EXE (
|
|
echo CMake not found on runner PATH or standard install locations.
|
|
exit /b 1
|
|
)
|
|
echo Using CMake: %CMAKE_EXE%
|
|
echo CMAKE_EXE=%CMAKE_EXE%>>%GITHUB_ENV%
|
|
|
|
- name: Configure
|
|
shell: cmd
|
|
run: |
|
|
"%CMAKE_EXE%" -S . -B build -A x64 ^
|
|
-DCMAKE_BUILD_TYPE=Release ^
|
|
-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake ^
|
|
-DVCPKG_TARGET_TRIPLET=x64-windows-static ^
|
|
-DWITH_TLS=OFF ^
|
|
-DWITH_HWLOC=OFF ^
|
|
-DWITH_OPENCL=OFF ^
|
|
-DWITH_CUDA=OFF ^
|
|
-DWITH_NVML=OFF ^
|
|
-DWITH_ADL=OFF
|
|
|
|
- name: Build
|
|
shell: cmd
|
|
run: '"%CMAKE_EXE%" --build build --config Release'
|
|
|
|
- name: Package
|
|
shell: cmd
|
|
run: |
|
|
if not exist dist\windows mkdir dist\windows
|
|
set BIN_PATH=
|
|
if exist build\Release\xmrig.exe set BIN_PATH=build\Release\xmrig.exe
|
|
if not defined BIN_PATH if exist build\Release\xmrig-notls.exe set BIN_PATH=build\Release\xmrig-notls.exe
|
|
if not defined BIN_PATH (
|
|
echo Could not find xmrig.exe or xmrig-notls.exe in build\Release
|
|
dir build\Release
|
|
exit /b 1
|
|
)
|
|
copy %BIN_PATH% dist\windows\xmrig.exe
|
|
copy src\config.json dist\windows\config.json
|
|
copy README.md dist\windows\
|
|
copy LICENSE dist\windows\
|
|
powershell -NoProfile -Command "Compress-Archive -Path dist\\windows\\* -DestinationPath xmrig-peya-windows-x86_64.zip -Force"
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: xmrig-peya-windows-x86_64
|
|
path: xmrig-peya-windows-x86_64.zip
|