Skip to content

Fix Windows, macOS builds and .deb dependencies #5

Fix Windows, macOS builds and .deb dependencies

Fix Windows, macOS builds and .deb dependencies #5

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
# ---------- Linux tar.gz ----------
build-linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libtool autotools-dev autoconf \
pkg-config libssl-dev libboost-all-dev \
libdb5.3-dev libdb5.3++-dev \
libminiupnpc-dev libzmq3-dev libevent-dev
- name: Build
run: |
./autogen.sh
./configure --without-gui --with-incompatible-bdb --disable-zmq
make -j$(nproc)
strip src/faircoind src/faircoin-cli src/faircoin-tx
- name: Package tar.gz
run: |
mkdir -p faircoin-${{ github.ref_name }}-linux-x86_64
cp src/faircoind src/faircoin-cli src/faircoin-tx faircoin-${{ github.ref_name }}-linux-x86_64/
cp COPYING README.md doc/GENERATE-KEYS.md faircoin-${{ github.ref_name }}-linux-x86_64/
tar czf faircoin-${{ github.ref_name }}-linux-x86_64.tar.gz faircoin-${{ github.ref_name }}-linux-x86_64/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-tarball
path: faircoin-${{ github.ref_name }}-linux-x86_64.tar.gz
# ---------- Debian .deb package ----------
build-deb:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libtool autotools-dev autoconf \
pkg-config libssl-dev libboost-all-dev \
libdb5.3-dev libdb5.3++-dev \
libminiupnpc-dev libzmq3-dev libevent-dev \
dpkg-dev fakeroot
- name: Build
run: |
./autogen.sh
./configure --without-gui --with-incompatible-bdb --disable-zmq
make -j$(nproc)
strip src/faircoind src/faircoin-cli src/faircoin-tx
- name: Create .deb package
run: |
VERSION="${GITHUB_REF_NAME#v}"
PKG="faircoin_${VERSION}_amd64"
mkdir -p $PKG/DEBIAN $PKG/usr/bin $PKG/usr/share/doc/faircoin
# Binaries
cp src/faircoind src/faircoin-cli src/faircoin-tx $PKG/usr/bin/
# Docs
cp COPYING README.md doc/GENERATE-KEYS.md $PKG/usr/share/doc/faircoin/
# Auto-detect shared library dependencies
dpkg-shlibdeps -O $PKG/usr/bin/faircoind $PKG/usr/bin/faircoin-cli $PKG/usr/bin/faircoin-tx 2>/dev/null | sed 's/^shlibs:Depends=//' > /tmp/deps.txt
AUTODEPS=$(cat /tmp/deps.txt)
# Control file
cat > $PKG/DEBIAN/control <<EOF
Package: faircoin
Version: ${VERSION}
Section: net
Priority: optional
Architecture: amd64
Depends: ${AUTODEPS}
Maintainer: FairCoin Official <contact@fairco.in>
Description: FairCoin cryptocurrency daemon and CLI
FairCoin is a cryptocurrency with masternodes, coin mixing,
and hybrid PoW/PoS consensus. This package provides the
faircoind daemon and faircoin-cli/faircoin-tx tools.
Homepage: https://fairco.in
EOF
dpkg-deb --build --root-owner-group $PKG
ls -la $PKG.deb
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-deb
path: faircoin_*_amd64.deb
# ---------- Windows .exe (cross-compile) ----------
build-windows:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install cross-compile dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libtool autotools-dev autoconf \
pkg-config bsdmainutils curl python3 \
g++-mingw-w64-x86-64 mingw-w64-x86-64-dev \
nsis
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
- name: Build depends for Windows
run: |
cd depends
make HOST=x86_64-w64-mingw32 NO_QT=1 -j$(nproc)
- name: Build FairCoin for Windows
run: |
./autogen.sh
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/ --without-gui --disable-zmq
make -j$(nproc)
x86_64-w64-mingw32-strip src/faircoind.exe src/faircoin-cli.exe src/faircoin-tx.exe
- name: Package Windows ZIP
run: |
mkdir -p faircoin-${{ github.ref_name }}-windows-x86_64
cp src/faircoind.exe src/faircoin-cli.exe src/faircoin-tx.exe faircoin-${{ github.ref_name }}-windows-x86_64/
cp COPYING README.md doc/GENERATE-KEYS.md faircoin-${{ github.ref_name }}-windows-x86_64/
zip -r faircoin-${{ github.ref_name }}-windows-x86_64.zip faircoin-${{ github.ref_name }}-windows-x86_64/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-zip
path: faircoin-${{ github.ref_name }}-windows-x86_64.zip
# ---------- macOS (native build via depends) ----------
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
brew install automake libtool pkg-config
- name: Build depends
run: |
cd depends
make NO_QT=1 -j$(sysctl -n hw.ncpu) \
darwin_CC="clang" \
darwin_CXX="clang++ -stdlib=libc++"
- name: Build
run: |
HOST=$(depends/config.guess)
./autogen.sh
CONFIG_SITE=$PWD/depends/${HOST}/share/config.site ./configure --prefix=/ --without-gui --disable-zmq
make -j$(sysctl -n hw.ncpu)
strip src/faircoind src/faircoin-cli src/faircoin-tx
- name: Package macOS
run: |
ARCH=$(uname -m)
mkdir -p faircoin-${{ github.ref_name }}-macos-${ARCH}
cp src/faircoind src/faircoin-cli src/faircoin-tx faircoin-${{ github.ref_name }}-macos-${ARCH}/
cp COPYING README.md doc/GENERATE-KEYS.md faircoin-${{ github.ref_name }}-macos-${ARCH}/
tar czf faircoin-${{ github.ref_name }}-macos-${ARCH}.tar.gz faircoin-${{ github.ref_name }}-macos-${ARCH}/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-tarball
path: faircoin-${{ github.ref_name }}-macos-*.tar.gz
# ---------- Create GitHub Release ----------
create-release:
needs: [build-linux, build-deb, build-windows, build-macos]
if: always()
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: List artifacts
run: find artifacts -type f || echo "No artifacts found"
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: FairCoin ${{ github.ref_name }}
draft: false
prerelease: false
generate_release_notes: true
fail_on_unmatched_files: false
files: |
artifacts/linux-tarball/*.tar.gz
artifacts/linux-deb/*.deb
artifacts/windows-zip/*.zip
artifacts/macos-tarball/*.tar.gz