Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6 from torkelrogstad/2024-02-01-macos-ci
Browse files Browse the repository at this point in the history
ci: add macOS and Qt
  • Loading branch information
CryptAxe authored Feb 1, 2024
2 parents 50d32cb + c15441c commit 93b9209
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 7 deletions.
51 changes: 46 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
uses: actions/cache@v3
with:
path: ./depends
key: ${{ runner.os }}-${{ hashFiles('depends/packages/**') }}
key: linux-${{ hashFiles('depends/packages/**') }}

- name: download dependencies
run: make -C ./depends download-linux

- name: build dependencies
run: make -C ./depends NO_QT=1 -j4
run: make -C ./depends -j4

- run: ./autogen.sh

Expand All @@ -43,6 +43,7 @@ jobs:
path: |
src/testchaind
src/testchain-cli
src/qt/testchain-qt
build-windows:
Expand Down Expand Up @@ -70,13 +71,13 @@ jobs:
uses: actions/cache@v3
with:
path: ./depends
key: ${{ runner.os }}-${{ hashFiles('depends/packages/**') }}
key: windows-${{ hashFiles('depends/packages/**') }}

- name: download dependencies
run: make -C ./depends download-win

- name: build dependencies
run: make -C ./depends HOST=x86_64-w64-mingw32 NO_QT=1 -j4
run: make -C ./depends HOST=x86_64-w64-mingw32 -j4

- run: ./autogen.sh

Expand All @@ -92,4 +93,44 @@ jobs:
if-no-files-found: error
path: |
src/testchaind.exe
src/testchain-cli.exe
src/testchain-cli.exe
src/qt/testchain-qt.exe
build-macos:
name: Build macOS binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ./depends
key: macos-${{ hashFiles('depends/packages/**') }}

- name: download dependencies
run: make -C ./depends download-osx

- name: Run build in Docker
uses: addnab/docker-run-action@v3
with:
image: barebitcoin/testchain-macos-builder
options: -v ${{ github.workspace }}:/testchain --workdir=/testchain
shell: bash
run: |
set -e
make -C depends -j4
export CONFIG_SITE=$PWD/depends/x86_64-apple-darwin11/share/config.site
./autogen.sh
./configure
make -j4 # Limit the concurrency to prevent OOM
- uses: actions/upload-artifact@v4
with:
name: binaries-macOS
if-no-files-found: error
path: |
src/testchaind
src/testchain-cli
src/qt/testchain-qt
92 changes: 90 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Testchain is a template sidechain that can be used as the starting point for creating Drivechain sidechains.

Drivechain (BIPs 300+301)
## Drivechain (BIPs 300+301)
Drivechain allows Bitcoin to create, delete, send BTC to, and receive BTC from “Layer-2”s called “sidechains”. Sidechains are Altcoins that lack a native “coin” – instead, BTC must first be sent over.

BIP 300: https://github.com/bitcoin/bips/blob/master/bip-0300.mediawiki
Expand All @@ -11,5 +11,93 @@ Learn more about Drivechain here: http://drivechain.info

For an example sidechain implementation, see: https://github.com/drivechain-project/sidechains

License
## Building Testchain

Testchain is built and released for Linux, macOS and Windows. The only supported
way of building Testchain is through cross-compiling from Linux. If you only want
to build node binaries, you can disable building the UI through passing `NO_QT=1`
to the `make -C ./depends` call. If the build crashes unexpectedly, try reducing
the amount of concurrency by removing the `-j` parameter.

### Linux

These instructions have been tested with Ubuntu 20.04 (Focal).

```bash
# install build dependencies
$ sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3

# compile dependencies
$ make -C ./depends -j

# Compile binaries
$ ./autogen.sh
$ export CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site
$ ./configure
$ ./make -j

# binaries are located in src/testchaind, src/testchain-cli and src/qt/testchain-qt
```

### macOS

Building Testchain requires a very old version of Ubuntu. A version that is
known to work is 14.04 (Jerry). An old version of the macOS SDK is also required.
For convenience, a [Docker image](https://hub.docker.com/r/barebitcoin/testchain-macos-builder)
is provided that has all the required build dependencies pre-installed.
If you want to set up your local environment to match this, it is recommended
to take a look at the [Dockerfile](./contrib/Dockerfile.macosbuilder) that
produced this image.

```bash
# start the Docker container that will build the binaries
$ docker run --rm -it \
--workdir /testchain -v $PWD:/testchain \
barebitcoin/testchain-macos-builder bash

# from within the Docker container shell

# compile dependencies
$ make -C ./depends -j

# compile the binaries
$ export CONFIG_SITE=$PWD/depends/x86_64-apple-darwin11/share/config.site
$ ./autogen.sh
$ ./configure.sh
$ make -j

# binaries are located (on the host machine)
# at src/testchaind, src/testchain-cli and src/qt/testchain-qt
```

### Windows

These instructions have been tested with Ubuntu 20.04 (Focal).

```bash
# install dependencies
$ sudo apt install g++-mingw-w64-x86-64 \
build-essential libtool autotools-dev automake \
libssl-dev libevent-dev \
pkg-config bsdmainutils curl git \
python3-setuptools python-is-python3 \

# configure the Windows toolchain
$ sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix

# compile dependencies
$ make -C ./depends HOST=x86_64-w64-mingw32 -j

# compile the binaries
$ export CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site
$ ./autogen.sh
$ ./configure.sh
$ make -j

# binaries are located at src/testchaind.exe, src/testchain-cli.exe and
# src/qt/testchain-qt.exe
```


## License
Bitcoin Core (and Drivechain) are released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT.
27 changes: 27 additions & 0 deletions contrib/Dockerfile.macosbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM ubuntu:trusty

RUN mkdir -p /work/SDKs

WORKDIR /work

RUN apt-get update

# Needed for TLS to work
RUN apt-get install ca-certificates

# General Linux deps
RUN apt-get -y install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3

# macOS cross-compilation deps
RUN apt-get -y install curl librsvg2-bin libtiff-tools bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python-setuptools

ARG SDK_VERSION=10.11
ARG SDK_FILE=MacOSX${SDK_VERSION}.sdk

RUN curl --fail https://bitcoincore.org/depends-sources/sdks/${SDK_FILE}.tar.gz \
--output ${SDK_FILE}.tar.gz \
--insecure

RUN tar -C /work/SDKs -xf ${SDK_FILE}.tar.gz

ENV HOST=x86_64-apple-darwin11 SDK_PATH=/work/SDKs

0 comments on commit 93b9209

Please sign in to comment.