Skip to content

Commit 281f59e

Browse files
committed
Merge branch 'static-dev' into static
# Conflicts: # configure.ac # src/test-komodo/test_parse_args.cpp
2 parents 61447b5 + 88f8e8c commit 281f59e

26 files changed

+733
-165
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM ubuntu:20.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
ENV TZ=Europe/Amsterdam
5+
6+
RUN \
7+
apt-get update && apt-get install --no-install-recommends -y ca-certificates curl &&\
8+
apt-get install --no-install-recommends -y build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python bison zlib1g-dev wget libcurl4-gnutls-dev bsdmainutils automake &&\
9+
apt-get install --no-install-recommends -y mingw-w64 &&\
10+
echo 1 | update-alternatives --config x86_64-w64-mingw32-gcc &&\
11+
echo 1 | update-alternatives --config x86_64-w64-mingw32-g++ &&\
12+
apt-get install --no-install-recommends -y librsvg2-bin libtiff-tools cmake imagemagick libcap-dev libz-dev libbz2-dev python3-setuptools libtinfo5 xorriso sudo
13+
RUN \
14+
apt-get clean && rm -rf /var/lib/apt/lists/*
15+
16+
COPY entrypoint.sh /entrypoint.sh
17+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action
2+
name: 'Build project in docker'
3+
description: 'Create docker image with build environment and build the project'
4+
inputs:
5+
builder-name:
6+
required: true
7+
default: 'builder'
8+
builder-uid:
9+
required: true
10+
default: 1000
11+
builder-gid:
12+
required: true
13+
default: 1000
14+
runs:
15+
using: 'docker'
16+
image: 'Dockerfile.focal.ci'
17+
env:
18+
BUILDER_NAME: ${{ inputs.builder-name }}
19+
BUILDER_UID: ${{ inputs.builder-uid }}
20+
BUILDER_GID: ${{ inputs.builder-gid }}
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
#!/usr/bin/env bash
2+
3+
groupadd --gid ${BUILDER_GID} --force ${BUILDER_NAME}
4+
adduser --disabled-password --gecos '' --no-create-home $BUILDER_NAME --uid ${BUILDER_UID} --gid ${BUILDER_GID}
5+
adduser $BUILDER_NAME sudo
6+
echo "$BUILDER_NAME ALL=(ALL:ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/$BUILDER_NAME
7+
8+
# there may be a better way to continue building as a user builder with the same UID and GID as the host runner
9+
su -m $BUILDER_NAME << 'EOF'
10+
echo "User: $(whoami)"
11+
WORKSPACE=$(pwd)
12+
echo "Workspace directory: ${WORKSPACE}"
13+
14+
delete_linux_depends=false
15+
16+
build_focal=true
17+
build_windows=true
18+
build_macos=true
19+
20+
download_and_check_macos_sdk() {
21+
url="https://bitcoincore.org/depends-sources/sdks/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz"
22+
output_file="Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz"
23+
expected_checksum="be17f48fd0b08fb4dcd229f55a6ae48d9f781d210839b4ea313ef17dd12d6ea5"
24+
25+
# Check if file exists
26+
if [[ -f "$output_file" ]]; then
27+
# Calculate checksum of the file
28+
actual_checksum=$(sha256sum "$output_file" 2>/dev/null | awk '{print $1}')
29+
if [[ -n $actual_checksum ]]; then
30+
# Compare checksums
31+
if [[ "$actual_checksum" == "$expected_checksum" ]]; then
32+
echo "MacOS SDK already exists and has the correct checksum. Skipping download."
33+
return
34+
fi
35+
fi
36+
fi
37+
38+
echo "Downloading MacOS SDK ..."
39+
# Download the file
40+
curl -L -o "$output_file" "$url"
41+
42+
# Calculate checksum of the downloaded file
43+
actual_checksum=$(sha256sum "$output_file" | awk '{print $1}')
44+
45+
# Compare checksums
46+
if [[ "$actual_checksum" != "$expected_checksum" ]]; then
47+
echo "ERROR: Downloaded MacOS SDK has an invalid checksum."
48+
exit 1
49+
fi
50+
51+
echo "MacOS SDK downloaded successfully and has a valid checksum."
52+
}
53+
54+
delete_artefacts() {
55+
local release_name=$1
56+
57+
if [[ "$release_name" = "windows" ]]; then
58+
ext=".exe"
59+
else
60+
ext=""
61+
fi
62+
63+
mkdir -p ${WORKSPACE}/releases/${release_name}
64+
65+
binaries=(
66+
"src/komodod"
67+
"src/wallet-utility"
68+
"src/komodo-tx"
69+
"src/komodo-cli"
70+
"src/komodo-test"
71+
"src/qt/komodo-qt"
72+
)
73+
74+
for binary in "${binaries[@]}"
75+
do
76+
rm -f "${WORKSPACE}/${binary}${ext}" || false
77+
done
78+
79+
echo "Deleting artefacts from ${WORKSPACE} ..."
80+
# delete possible artefacts from previous build(s)
81+
find ${WORKSPACE}/src \( -name "*.a" -o -name "*.la" -o -name "*.o" -o -name "*.lo" -o -name "*.Plo" -o -name "*.Po" -o -name "*.lai" -o -name "*.dirstamp" \) -delete
82+
find ${WORKSPACE}/src \( -name "*.a" -o -name "*.la" -o -name "*.o" -o -name "*.lo" -o -name "*.Plo" -o -name "*.Po" -o -name "*.lai" -o -name "*.dirstamp" \) -path "*/.*" -delete
83+
rm -f ${WORKSPACE}/src/qt/moc_*.cpp # delete meta object code files, otherwise we will have MacOS after Linux/Windows build error
84+
}
85+
86+
copy_release() {
87+
local release_name=$1
88+
89+
if [[ "$release_name" = "windows" ]]; then
90+
ext=".exe"
91+
else
92+
ext=""
93+
fi
94+
95+
mkdir -p ${WORKSPACE}/releases/${release_name}
96+
97+
binaries=(
98+
"src/komodod"
99+
"src/wallet-utility"
100+
"src/komodo-tx"
101+
"src/komodo-cli"
102+
"src/qt/komodo-qt"
103+
)
104+
105+
for binary in "${binaries[@]}"
106+
do
107+
case $release_name in
108+
windows)
109+
bash -c "/usr/bin/x86_64-w64-mingw32-strip ${WORKSPACE}/${binary}${ext}" || false
110+
;;
111+
macos)
112+
bash -c "${WORKSPACE}/depends/x86_64-apple-darwin/native/bin/x86_64-apple-darwin-strip ${WORKSPACE}/${binary}${ext}" || false
113+
;;
114+
*)
115+
strip "${WORKSPACE}/${binary}${ext}" || false
116+
;;
117+
esac
118+
cp -f "${WORKSPACE}/${binary}${ext}" "${WORKSPACE}/releases/${release_name}/"
119+
done
120+
121+
case $release_name in
122+
xenial)
123+
echo "Performing actions for Xenial..."
124+
mv "${WORKSPACE}/releases/${release_name}/komodo-qt" "${WORKSPACE}/releases/${release_name}/komodo-qt-linux"
125+
;;
126+
focal)
127+
echo "Performing actions for Focal..."
128+
mv "${WORKSPACE}/releases/${release_name}/komodo-qt" "${WORKSPACE}/releases/${release_name}/komodo-qt-linux"
129+
;;
130+
windows)
131+
echo "Performing actions for Windows..."
132+
mv "${WORKSPACE}/releases/${release_name}/komodo-qt${ext}" "${WORKSPACE}/releases/${release_name}/komodo-qt-windows${ext}"
133+
;;
134+
macos)
135+
echo "Performing actions for MacOS..."
136+
bash -c "make deploy" || false
137+
cp -f ${WORKSPACE}/*.dmg "${WORKSPACE}/releases/${release_name}/"
138+
mv "${WORKSPACE}/releases/${release_name}/komodo-qt${ext}" "${WORKSPACE}/releases/${release_name}/komodo-qt-mac${ext}"
139+
;;
140+
*)
141+
echo "Unknown release name: $release_name"
142+
;;
143+
esac
144+
}
145+
146+
emulate_build() {
147+
for folder in macos windows focal; do
148+
mkdir -p ${WORKSPACE}/releases/${folder}
149+
for file in komodo-qt komodo-cli komodo-tx wallet-utility komodod; do
150+
extension=""
151+
case ${folder} in
152+
focal)
153+
[[ "$file" == "komodo-qt" ]] && file=${file}-linux
154+
;;
155+
macos)
156+
[[ "$file" == "komodo-qt" ]] && file=${file}-mac
157+
;;
158+
windows)
159+
extension=".exe"
160+
[[ "$file" == "komodo-qt" ]] && file=${file}-windows
161+
;;
162+
esac
163+
echo test > ${WORKSPACE}/releases/${folder}/${file}${extension}
164+
done
165+
done
166+
echo test > ${WORKSPACE}/releases/macos/KomodoOcean-0.8.1-beta1.dmg
167+
}
168+
169+
if true; then
170+
# Check if awk command exists
171+
command -v awk >/dev/null 2>&1 || { echo >&2 "ERROR: awk command not found."; exit 1; }
172+
# Check if sha256sum command exists
173+
command -v sha256sum >/dev/null 2>&1 || { echo >&2 "ERROR: sha256sum command not found."; exit 1; }
174+
175+
### focal
176+
if [[ "${build_focal}" = "true" ]]; then
177+
178+
# delete old depends binaries (from previous linux version, bcz it's x86_64-unknown-linux-gnu also)
179+
if [[ "${delete_linux_depends}" = true ]]; then
180+
rm -rf ${WORKSPACE}/depends/built/x86_64-unknown-linux-gnu
181+
rm -rf ${WORKSPACE}/depends/x86_64-unknown-linux-gnu
182+
fi
183+
# delete possible artefacts from previous build(s)
184+
delete_artefacts focal
185+
bash -c 'zcutil/build.sh -j'$(expr $(nproc) - 1)
186+
copy_release focal
187+
fi
188+
189+
### windows
190+
if [[ "${build_windows}" = "true" ]]; then
191+
delete_artefacts windows
192+
bash -c 'zcutil/build-win.sh -j'$(expr $(nproc) - 1)
193+
copy_release windows
194+
fi
195+
196+
### macos
197+
if [[ "${build_macos}" = "true" ]]; then
198+
download_and_check_macos_sdk
199+
delete_artefacts macos
200+
bash -c 'zcutil/build-mac-cross.sh -j'$(expr $(nproc) - 1)
201+
copy_release macos
202+
fi
203+
else
204+
emulate_build
205+
# all environment variables of docker container are accessible here,
206+
# you can use BUILDER_NAME or GITHUB_SHA, or GITHUB_ACTOR, etc.
207+
fi
208+
EOF
209+
210+

.github/workflows/build-project.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
on:
2+
pull_request:
3+
types:
4+
- opened
5+
- synchronize
6+
- reopened
7+
branches:
8+
- static-experimental
9+
- static
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-project-job:
14+
# Execute on pull requests within the same repository (and not forks) or on manual dispatch
15+
if: ${{ github.actor == 'DeckerSU' && (github.event_name == 'workflow_dispatch' || (github.event.pull_request.head.repo.full_name == github.repository)) }}
16+
runs-on: [self-hosted, Linux, X64]
17+
name: Build project job
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Set variables
23+
run: |
24+
echo "branch=$(echo ${{ github.ref }} | sed 's/refs\/heads\///g')" >> $GITHUB_OUTPUT
25+
echo "sha_short=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT
26+
echo "builder_name=$(echo $USER)" >> $GITHUB_OUTPUT
27+
echo "builder_uid=$(id -u)" >> $GITHUB_OUTPUT
28+
echo "builder_gid=$(id -g)" >> $GITHUB_OUTPUT
29+
echo "is_fork=${{ github.event.pull_request.head.repo.fork }}" >> $GITHUB_OUTPUT
30+
id: set_variables_step
31+
32+
- name: Print variables
33+
run: |
34+
echo "Event Type: ${{ github.event_name }}"
35+
echo "Repository name: ${{ github.event.repository.name }}"
36+
echo "Branch: ${{ steps.set_variables_step.outputs.branch }}"
37+
echo "Commit: ${{ steps.set_variables_step.outputs.sha_short }}"
38+
echo "builder_name: ${{ steps.set_variables_step.outputs.builder_name }}"
39+
echo "builder_uid: ${{ steps.set_variables_step.outputs.builder_uid }}"
40+
echo "builder_gid: ${{ steps.set_variables_step.outputs.builder_gid }}"
41+
echo "is_fork: ${{ steps.set_variables_step.outputs.is_fork }}"
42+
43+
- name: Build app in docker container
44+
uses: ./.github/actions/build-project-docker
45+
id: build-in-docker
46+
with:
47+
builder-name: '${{ steps.set_variables_step.outputs.builder_name }}'
48+
builder-uid: '${{ steps.set_variables_step.outputs.builder_uid }}'
49+
builder-gid: '${{ steps.set_variables_step.outputs.builder_gid }}'
50+
51+
# we don't want use strategy / matrix here, bcz in this case matrix will be used
52+
# for entire job and docker containet will be rebuild several times
53+
- name: Archive artifacts (Linux)
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: komodoocean-linux-${{ steps.set_variables_step.outputs.sha_short }}
57+
path: |
58+
./releases/focal
59+
60+
- name: Archive artifacts (Windows)
61+
uses: actions/upload-artifact@v3
62+
with:
63+
name: komodoocean-windows-${{ steps.set_variables_step.outputs.sha_short }}
64+
path: |
65+
./releases/windows
66+
67+
- name: Archive artifacts (MacOS)
68+
uses: actions/upload-artifact@v3
69+
with:
70+
name: komodoocean-macos-${{ steps.set_variables_step.outputs.sha_short }}
71+
path: |
72+
./releases/macos
73+
74+
- name: Cleanup workspace after build
75+
if: always()
76+
shell: bash
77+
run: |
78+
rm -rf ${{ github.workspace }}/*
79+

Dockerfile.focal.ci

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ENV TZ=Europe/Amsterdam
2020
RUN \
2121
apt-get update && apt-get install --no-install-recommends -y apt-transport-https ca-certificates curl &&\
2222
sed -i 's/archive\.ubuntu\.com/mirror\.nl\.leaseweb\.net/g' /etc/apt/sources.list &&\
23+
sed -i 's/security\.ubuntu\.com/mirror\.nl\.leaseweb\.net/g' /etc/apt/sources.list &&\
2324
sed -i 's/http:/https:/g' /etc/apt/sources.list &&\
2425
apt-get update && apt-get install -y sudo &&\
2526
groupadd --gid ${BUILDER_GID} --force ${BUILDER_NAME} &&\

Dockerfile.xenial.ci

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ENV TZ=Europe/Amsterdam
2020
RUN \
2121
apt-get update && apt-get install --no-install-recommends -y apt-transport-https ca-certificates curl &&\
2222
sed -i 's/archive\.ubuntu\.com/mirror\.nl\.leaseweb\.net/g' /etc/apt/sources.list &&\
23+
sed -i 's/security\.ubuntu\.com/mirror\.nl\.leaseweb\.net/g' /etc/apt/sources.list &&\
2324
sed -i 's/http:/https:/g' /etc/apt/sources.list &&\
2425
apt-get update && apt-get install -y sudo &&\
2526
groupadd --gid ${BUILDER_GID} --force ${BUILDER_NAME} &&\

build_releases.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ copy_release() {
142142
check_image_focal() {
143143
if [[ "${force_rebuild_containers}" == "true" || "$(docker images --format '{{.Repository}}' | grep -c ocean_focal_builder)" -eq 0 ]]; then
144144
echo "Container 'ocean_focal_builder' rebuilding ..."
145-
docker build -f Dockerfile.focal.ci --build-arg BUILDER_NAME=$USER --build-arg BUILDER_UID=$(id -u) --build-arg BUILDER_GID=$(id -g) -t ocean_focal_builder .
145+
docker build --no-cache -f Dockerfile.focal.ci --build-arg BUILDER_NAME=$USER --build-arg BUILDER_UID=$(id -u) --build-arg BUILDER_GID=$(id -g) -t ocean_focal_builder .
146146
fi
147147
}
148148

149149
check_image_xenial() {
150150
if [[ "${force_rebuild_containers}" == "true" || "$(docker images --format '{{.Repository}}' | grep -c ocean_xenial_builder)" -eq 0 ]]; then
151151
echo "Container 'ocean_xenial_builder' rebuilding ..."
152-
docker build -f Dockerfile.xenial.ci --build-arg BUILDER_NAME=$USER --build-arg BUILDER_UID=$(id -u) --build-arg BUILDER_GID=$(id -g) -t ocean_xenial_builder .
152+
docker build --no-cache -f Dockerfile.xenial.ci --build-arg BUILDER_NAME=$USER --build-arg BUILDER_UID=$(id -u) --build-arg BUILDER_GID=$(id -g) -t ocean_xenial_builder .
153153
fi
154154
}
155155

configure.ac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
22
AC_PREREQ([2.60])
33
define(_CLIENT_VERSION_MAJOR, 0)
44
define(_CLIENT_VERSION_MINOR, 8)
5-
define(_CLIENT_VERSION_REVISION, 1)
6-
define(_CLIENT_VERSION_BUILD, 1)
5+
define(_CLIENT_VERSION_REVISION, 2)
6+
define(_CLIENT_VERSION_BUILD, 0)
77
define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50)))
88
define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1)))
99
define(_CLIENT_VERSION_IS_RELEASE, true)
10-
define(_COPYRIGHT_YEAR, 2023)
10+
define(_COPYRIGHT_YEAR, 2024)
1111
define(_COPYRIGHT_HOLDERS, "The %s developers")
1212
define(_COPYRIGHT_HOLDERS_SUBSTITUTION, "Ocean and Decker")
1313

depends/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SDK_PATH ?= $(BASEDIR)/SDKs
66
NO_QT ?=
77
NO_WALLET ?=
88
NO_UPNP ?=
9-
FALLBACK_DOWNLOAD_PATH ?= https://supernet/depends-sources
9+
FALLBACK_DOWNLOAD_PATH ?= https://download.kmd.sh/depends-sources
1010

1111
BUILD ?= $(shell ./config.guess)
1212
HOST ?= $(BUILD)

depends/funcs.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ endef
2222
define fetch_file
2323
(test -f $$($(1)_source_dir)/$(4) || \
2424
( mkdir -p $$($(1)_download_dir) && echo Fetching $(1)... && \
25-
( $(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(PRIORITY_DOWNLOAD_PATH)/$(4)" || \
26-
$(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(2)/$(3)" ) && \
25+
( $(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(2)/$(3)" || \
26+
$(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(FALLBACK_DOWNLOAD_PATH)/$(4)" ) && \
2727
echo "$(5) $$($(1)_download_dir)/$(4).temp" > $$($(1)_download_dir)/.$(4).hash && \
2828
$(build_SHA256SUM) -c $$($(1)_download_dir)/.$(4).hash && \
2929
mv $$($(1)_download_dir)/$(4).temp $$($(1)_source_dir)/$(4) && \

0 commit comments

Comments
 (0)