|
| 1 | +name: Create release and build artifacts |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: false |
| 14 | + |
| 15 | +env: |
| 16 | + VERSION: ${{ github.ref_name }} |
| 17 | + |
| 18 | +jobs: |
| 19 | + windows: |
| 20 | + name: Build Windows artifacts |
| 21 | + runs-on: windows-2025-vs2026 |
| 22 | + timeout-minutes: 75 |
| 23 | + |
| 24 | + defaults: |
| 25 | + run: |
| 26 | + shell: msys2 {0} |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v5 |
| 31 | + |
| 32 | + - name: Setup MSYS2 UCRT64 |
| 33 | + uses: msys2/setup-msys2@v2 |
| 34 | + with: |
| 35 | + msystem: UCRT64 |
| 36 | + update: true |
| 37 | + cache: true |
| 38 | + install: >- |
| 39 | + base-devel |
| 40 | + git |
| 41 | + mingw-w64-ucrt-x86_64-7zip |
| 42 | + mingw-w64-ucrt-x86_64-cmake |
| 43 | + mingw-w64-ucrt-x86_64-gcc |
| 44 | + mingw-w64-ucrt-x86_64-ninja |
| 45 | + mingw-w64-ucrt-x86_64-nodejs |
| 46 | +
|
| 47 | + - name: Checkout XMRig deps |
| 48 | + run: git clone --depth 1 https://github.com/xmrig/xmrig-deps.git |
| 49 | + |
| 50 | + - name: Configure |
| 51 | + run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DXMRIG_DEPS="$PWD/xmrig-deps/gcc/x64" |
| 52 | + |
| 53 | + - name: Build |
| 54 | + run: cmake --build build --parallel 2 |
| 55 | + |
| 56 | + - name: Run safe test subset |
| 57 | + run: BUILD_PARALLEL=2 node run_tests.js --safe --build-dir build --cmake-generator Ninja |
| 58 | + |
| 59 | + - name: Package |
| 60 | + run: | |
| 61 | + mkdir -p package |
| 62 | + cp build/xmrig.exe package/ |
| 63 | + cp src/config.json package/ |
| 64 | + cp bin/WinRing0/WinRing0x64.sys package/ |
| 65 | + (cd package && 7z a -tzip -mx=9 "../xmrig-${VERSION}-win64.zip" xmrig.exe config.json WinRing0x64.sys) |
| 66 | +
|
| 67 | + - name: Upload artifact |
| 68 | + uses: actions/upload-artifact@v6 |
| 69 | + with: |
| 70 | + name: windows |
| 71 | + path: xmrig-${{ env.VERSION }}-win64.zip |
| 72 | + retention-days: 7 |
| 73 | + if-no-files-found: error |
| 74 | + |
| 75 | + ubuntu: |
| 76 | + name: Build Ubuntu artifacts |
| 77 | + runs-on: ubuntu-24.04 |
| 78 | + timeout-minutes: 60 |
| 79 | + |
| 80 | + steps: |
| 81 | + - name: Checkout code |
| 82 | + uses: actions/checkout@v5 |
| 83 | + |
| 84 | + - name: Install build dependencies |
| 85 | + run: | |
| 86 | + sudo apt-get update |
| 87 | + sudo apt-get install -y --no-install-recommends \ |
| 88 | + build-essential \ |
| 89 | + cmake \ |
| 90 | + git \ |
| 91 | + libhwloc-dev \ |
| 92 | + libssl-dev \ |
| 93 | + libuv1-dev |
| 94 | +
|
| 95 | + - name: Configure |
| 96 | + run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release |
| 97 | + |
| 98 | + - name: Build |
| 99 | + run: cmake --build build --parallel "$(nproc)" |
| 100 | + |
| 101 | + - name: Run safe test subset |
| 102 | + run: node run_tests.js --safe --build-dir build |
| 103 | + |
| 104 | + # Full local suite: node run_tests.js |
| 105 | + |
| 106 | + - name: Package |
| 107 | + run: | |
| 108 | + mkdir -p package |
| 109 | + cp build/xmrig package/ |
| 110 | + cp src/config.json package/ |
| 111 | + tar -C package -czf "xmrig-${VERSION}-lin64.tar.gz" xmrig config.json |
| 112 | +
|
| 113 | + - name: Upload artifact |
| 114 | + uses: actions/upload-artifact@v6 |
| 115 | + with: |
| 116 | + name: ubuntu |
| 117 | + path: xmrig-${{ env.VERSION }}-lin64.tar.gz |
| 118 | + retention-days: 7 |
| 119 | + if-no-files-found: error |
| 120 | + |
| 121 | + macos: |
| 122 | + name: Build macOS ${{ matrix.suffix }} artifacts |
| 123 | + runs-on: ${{ matrix.runner }} |
| 124 | + timeout-minutes: 90 |
| 125 | + |
| 126 | + strategy: |
| 127 | + fail-fast: false |
| 128 | + matrix: |
| 129 | + include: |
| 130 | + - runner: macos-15 |
| 131 | + suffix: mac-arm64 |
| 132 | + uname: arm64 |
| 133 | + - runner: macos-15-intel |
| 134 | + suffix: mac-intel |
| 135 | + uname: x86_64 |
| 136 | + |
| 137 | + steps: |
| 138 | + - name: Checkout code |
| 139 | + uses: actions/checkout@v5 |
| 140 | + |
| 141 | + - name: Verify runner architecture |
| 142 | + run: test "$(uname -m)" = "${{ matrix.uname }}" |
| 143 | + |
| 144 | + - name: Install build dependencies |
| 145 | + run: | |
| 146 | + missing=() |
| 147 | + for formula in autoconf automake cmake libtool libuv openssl@3; do |
| 148 | + brew list --formula "$formula" >/dev/null 2>&1 || missing+=("$formula") |
| 149 | + done |
| 150 | + if ((${#missing[@]})); then |
| 151 | + brew install "${missing[@]}" |
| 152 | + fi |
| 153 | +
|
| 154 | + - name: Build static hwloc |
| 155 | + run: | |
| 156 | + HWLOC_VERSION=2.12.1 |
| 157 | + curl -fsSLO "https://download.open-mpi.org/release/hwloc/v2.12/hwloc-${HWLOC_VERSION}.tar.gz" |
| 158 | + tar xzf "hwloc-${HWLOC_VERSION}.tar.gz" |
| 159 | + cd "hwloc-${HWLOC_VERSION}" |
| 160 | + ./configure --disable-shared --enable-static --disable-io --disable-libudev --disable-libxml2 |
| 161 | + make -j"$(sysctl -n hw.logicalcpu)" |
| 162 | +
|
| 163 | + - name: Configure |
| 164 | + run: | |
| 165 | + OPENSSL_ROOT="$(brew --prefix openssl@3)" |
| 166 | + cmake -S . -B build \ |
| 167 | + -DCMAKE_BUILD_TYPE=Release \ |
| 168 | + -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT" \ |
| 169 | + -DHWLOC_INCLUDE_DIR="$PWD/hwloc-2.12.1/include" \ |
| 170 | + -DHWLOC_LIBRARY="$PWD/hwloc-2.12.1/hwloc/.libs/libhwloc.a" |
| 171 | +
|
| 172 | + - name: Build |
| 173 | + run: cmake --build build --parallel "$(sysctl -n hw.logicalcpu)" |
| 174 | + |
| 175 | + - name: Run safe test subset |
| 176 | + run: node run_tests.js --safe --build-dir build |
| 177 | + |
| 178 | + # Full local suite: node run_tests.js |
| 179 | + |
| 180 | + - name: Package |
| 181 | + run: | |
| 182 | + mkdir -p package |
| 183 | + cp build/xmrig package/ |
| 184 | + cp src/config.json package/ |
| 185 | + tar -C package -czf "xmrig-${VERSION}-${{ matrix.suffix }}.tar.gz" xmrig config.json |
| 186 | +
|
| 187 | + - name: Upload artifact |
| 188 | + uses: actions/upload-artifact@v6 |
| 189 | + with: |
| 190 | + name: ${{ matrix.suffix }} |
| 191 | + path: xmrig-${{ env.VERSION }}-${{ matrix.suffix }}.tar.gz |
| 192 | + retention-days: 7 |
| 193 | + if-no-files-found: error |
| 194 | + |
| 195 | + ubuntu-compat: |
| 196 | + name: Build glibc 2.12 compatible artifacts |
| 197 | + runs-on: ubuntu-24.04 |
| 198 | + timeout-minutes: 180 |
| 199 | + |
| 200 | + steps: |
| 201 | + - name: Checkout code |
| 202 | + uses: actions/checkout@v5 |
| 203 | + |
| 204 | + - name: Prepare source archive |
| 205 | + run: tar --exclude=.git -czf /tmp/xmrig-source.tar.gz . |
| 206 | + |
| 207 | + - name: Run build inside manylinux2010 |
| 208 | + run: | |
| 209 | + mkdir -p /tmp/xmrig-docker |
| 210 | + cp /tmp/xmrig-source.tar.gz /tmp/xmrig-docker/source.tar.gz |
| 211 | + cat >/tmp/xmrig-docker/build.sh <<'EOF' |
| 212 | + set -eux |
| 213 | +
|
| 214 | + export PATH="/opt/rh/devtoolset-8/root/usr/bin:${PATH}" |
| 215 | + export CC=gcc |
| 216 | + export CXX=g++ |
| 217 | + JOBS="$(nproc)" |
| 218 | +
|
| 219 | + gcc --version |
| 220 | + g++ --version |
| 221 | + ldd --version | head -n 1 |
| 222 | + if ! command -v wget >/dev/null 2>&1; then |
| 223 | + cat >/usr/local/bin/wget <<'EOS' |
| 224 | + #!/bin/sh |
| 225 | + if [ "$2" = "-O" ] && [ -n "$3" ]; then |
| 226 | + exec curl -fsSL "$1" -o "$3" |
| 227 | + fi |
| 228 | + exec curl -fsSLO "$1" |
| 229 | + EOS |
| 230 | + chmod +x /usr/local/bin/wget |
| 231 | + fi |
| 232 | +
|
| 233 | + curl -fsSL https://cmake.org/files/v3.16/cmake-3.16.9.tar.gz | tar -xzC /tmp |
| 234 | + (cd /tmp/cmake-3.16.9 && ./bootstrap --parallel="${JOBS}" -- -DCMAKE_USE_OPENSSL=OFF && make -j"${JOBS}" && make install) |
| 235 | +
|
| 236 | + mkdir -p /tmp/xmrig |
| 237 | + tar -xzf /tmp/xmrig-docker/source.tar.gz -C /tmp/xmrig |
| 238 | + cd /tmp/xmrig |
| 239 | + (cd scripts && ./build.uv.sh && ./build.hwloc1.sh && ./build.openssl.sh) |
| 240 | + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DXMRIG_DEPS=scripts/deps |
| 241 | + cmake --build build --parallel "${JOBS}" |
| 242 | + cmake -S tests/hash -B build/hash-tests -DCMAKE_BUILD_TYPE=Release |
| 243 | + cmake --build build/hash-tests --target hash-tests --parallel "${JOBS}" |
| 244 | + cmake --build build/hash-tests --target check-hashes --parallel "${JOBS}" |
| 245 | +
|
| 246 | + if readelf --version-info build/xmrig | grep -E 'Name: GLIBC_2\.(1[3-9]|[2-9][0-9])'; then |
| 247 | + echo "compat binary requires a newer glibc than 2.12" |
| 248 | + exit 1 |
| 249 | + fi |
| 250 | +
|
| 251 | + if readelf --version-info build/xmrig | grep -E 'Name: (GLIBCXX_|CXXABI_)'; then |
| 252 | + echo "compat binary must not depend on dynamic libstdc++" |
| 253 | + exit 1 |
| 254 | + fi |
| 255 | +
|
| 256 | + mkdir -p /tmp/package |
| 257 | + cp build/xmrig /tmp/package/ |
| 258 | + cp src/config.json /tmp/package/ |
| 259 | + cp build/xmrig /tmp/xmrig-docker/xmrig-compat |
| 260 | + cp build/hash-tests/hash-tests /tmp/xmrig-docker/hash-tests-compat |
| 261 | + tar -C /tmp/package -czf "/tmp/xmrig-docker/xmrig-${VERSION}-lin64-compat.tar.gz" xmrig config.json |
| 262 | + EOF |
| 263 | + chmod +x /tmp/xmrig-docker/build.sh |
| 264 | + docker run --rm \ |
| 265 | + -e VERSION="${VERSION}" \ |
| 266 | + -v /tmp/xmrig-docker:/tmp/xmrig-docker \ |
| 267 | + quay.io/pypa/manylinux2010_x86_64 \ |
| 268 | + /bin/bash /tmp/xmrig-docker/build.sh |
| 269 | +
|
| 270 | + - name: Run compat artifact test suite |
| 271 | + run: node run_tests.js --safe --skip-build --hash-binary /tmp/xmrig-docker/hash-tests-compat --binary /tmp/xmrig-docker/xmrig-compat |
| 272 | + |
| 273 | + - name: Upload artifact |
| 274 | + uses: actions/upload-artifact@v6 |
| 275 | + with: |
| 276 | + name: ubuntu-compat |
| 277 | + path: /tmp/xmrig-docker/xmrig-${{ env.VERSION }}-lin64-compat.tar.gz |
| 278 | + retention-days: 7 |
| 279 | + if-no-files-found: error |
| 280 | + |
| 281 | + release: |
| 282 | + name: Create release and publish artifacts |
| 283 | + runs-on: ubuntu-24.04 |
| 284 | + needs: |
| 285 | + - windows |
| 286 | + - ubuntu |
| 287 | + - macos |
| 288 | + - ubuntu-compat |
| 289 | + |
| 290 | + steps: |
| 291 | + - name: Download artifacts |
| 292 | + uses: actions/download-artifact@v4 |
| 293 | + with: |
| 294 | + path: dist |
| 295 | + merge-multiple: true |
| 296 | + |
| 297 | + - name: Create release |
| 298 | + uses: softprops/action-gh-release@v2 |
| 299 | + with: |
| 300 | + files: dist/* |
| 301 | + fail_on_unmatched_files: true |
| 302 | + |
| 303 | + - name: Install packaging tools |
| 304 | + run: | |
| 305 | + sudo apt-get update |
| 306 | + sudo apt-get install -y --no-install-recommends unzip zip |
| 307 | +
|
| 308 | + - name: Update xmrig_setup repo |
| 309 | + env: |
| 310 | + SETUP_TOKEN: ${{ secrets.xmrig_setup_key }} |
| 311 | + run: | |
| 312 | + if [ -z "${SETUP_TOKEN}" ]; then |
| 313 | + echo "xmrig_setup_key is not configured; skipping xmrig_setup update." |
| 314 | + exit 0 |
| 315 | + fi |
| 316 | +
|
| 317 | + git clone "https://x-access-token:${SETUP_TOKEN}@github.com/MoneroOcean/xmrig_setup.git" |
| 318 | + cd xmrig_setup |
| 319 | + git config user.name MoneroOcean |
| 320 | + git config user.email support@moneroocean.stream |
| 321 | + cp "../dist/xmrig-${VERSION}-lin64-compat.tar.gz" xmrig.tar.gz |
| 322 | + cp "../dist/xmrig-${VERSION}-win64.zip" xmrig.zip |
| 323 | + unzip -o xmrig.zip |
| 324 | + zip -u offline_miner_setup.zip xmrig.exe config.json WinRing0x64.sys |
| 325 | + git add xmrig.tar.gz xmrig.zip offline_miner_setup.zip |
| 326 | + git commit -m "xmrig ${VERSION} based release" || exit 0 |
| 327 | + git push |
| 328 | +
|
| 329 | + - name: Update hiveos repo |
| 330 | + env: |
| 331 | + SETUP_TOKEN: ${{ secrets.xmrig_setup_key }} |
| 332 | + run: | |
| 333 | + if [ -z "${SETUP_TOKEN}" ]; then |
| 334 | + echo "xmrig_setup_key is not configured; skipping hiveos update." |
| 335 | + exit 0 |
| 336 | + fi |
| 337 | +
|
| 338 | + git clone "https://x-access-token:${SETUP_TOKEN}@github.com/MoneroOcean/hiveos.git" |
| 339 | + cd hiveos |
| 340 | + git config user.name MoneroOcean |
| 341 | + git config user.email support@moneroocean.stream |
| 342 | + tar xf "../dist/xmrig-${VERSION}-lin64-compat.tar.gz" |
| 343 | + mv xmrig mo_xmrig/xmrig |
| 344 | + mv config.json mo_xmrig/config_global.json |
| 345 | + VER="${VERSION//-/_}" |
| 346 | + tar -zcvf "mo_xmrig-${VER}.tar.gz" mo_xmrig |
| 347 | + git add "mo_xmrig-${VER}.tar.gz" mo_xmrig/xmrig mo_xmrig/config_global.json |
| 348 | + git commit -m "xmrig ${VERSION} based release" || exit 0 |
| 349 | + git push |
0 commit comments