forked from ip-gpu/KomodoOcean
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'static-dev' into static
# Conflicts: # configure.ac # src/test-komodo/test_parse_args.cpp
- Loading branch information
Showing
26 changed files
with
733 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV TZ=Europe/Amsterdam | ||
|
||
RUN \ | ||
apt-get update && apt-get install --no-install-recommends -y ca-certificates curl &&\ | ||
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 &&\ | ||
apt-get install --no-install-recommends -y mingw-w64 &&\ | ||
echo 1 | update-alternatives --config x86_64-w64-mingw32-gcc &&\ | ||
echo 1 | update-alternatives --config x86_64-w64-mingw32-g++ &&\ | ||
apt-get install --no-install-recommends -y librsvg2-bin libtiff-tools cmake imagemagick libcap-dev libz-dev libbz2-dev python3-setuptools libtinfo5 xorriso sudo | ||
RUN \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action | ||
name: 'Build project in docker' | ||
description: 'Create docker image with build environment and build the project' | ||
inputs: | ||
builder-name: | ||
required: true | ||
default: 'builder' | ||
builder-uid: | ||
required: true | ||
default: 1000 | ||
builder-gid: | ||
required: true | ||
default: 1000 | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile.focal.ci' | ||
env: | ||
BUILDER_NAME: ${{ inputs.builder-name }} | ||
BUILDER_UID: ${{ inputs.builder-uid }} | ||
BUILDER_GID: ${{ inputs.builder-gid }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
#!/usr/bin/env bash | ||
|
||
groupadd --gid ${BUILDER_GID} --force ${BUILDER_NAME} | ||
adduser --disabled-password --gecos '' --no-create-home $BUILDER_NAME --uid ${BUILDER_UID} --gid ${BUILDER_GID} | ||
adduser $BUILDER_NAME sudo | ||
echo "$BUILDER_NAME ALL=(ALL:ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/$BUILDER_NAME | ||
|
||
# there may be a better way to continue building as a user builder with the same UID and GID as the host runner | ||
su -m $BUILDER_NAME << 'EOF' | ||
echo "User: $(whoami)" | ||
WORKSPACE=$(pwd) | ||
echo "Workspace directory: ${WORKSPACE}" | ||
delete_linux_depends=false | ||
build_focal=true | ||
build_windows=true | ||
build_macos=true | ||
download_and_check_macos_sdk() { | ||
url="https://bitcoincore.org/depends-sources/sdks/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz" | ||
output_file="Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz" | ||
expected_checksum="be17f48fd0b08fb4dcd229f55a6ae48d9f781d210839b4ea313ef17dd12d6ea5" | ||
# Check if file exists | ||
if [[ -f "$output_file" ]]; then | ||
# Calculate checksum of the file | ||
actual_checksum=$(sha256sum "$output_file" 2>/dev/null | awk '{print $1}') | ||
if [[ -n $actual_checksum ]]; then | ||
# Compare checksums | ||
if [[ "$actual_checksum" == "$expected_checksum" ]]; then | ||
echo "MacOS SDK already exists and has the correct checksum. Skipping download." | ||
return | ||
fi | ||
fi | ||
fi | ||
echo "Downloading MacOS SDK ..." | ||
# Download the file | ||
curl -L -o "$output_file" "$url" | ||
# Calculate checksum of the downloaded file | ||
actual_checksum=$(sha256sum "$output_file" | awk '{print $1}') | ||
# Compare checksums | ||
if [[ "$actual_checksum" != "$expected_checksum" ]]; then | ||
echo "ERROR: Downloaded MacOS SDK has an invalid checksum." | ||
exit 1 | ||
fi | ||
echo "MacOS SDK downloaded successfully and has a valid checksum." | ||
} | ||
delete_artefacts() { | ||
local release_name=$1 | ||
if [[ "$release_name" = "windows" ]]; then | ||
ext=".exe" | ||
else | ||
ext="" | ||
fi | ||
mkdir -p ${WORKSPACE}/releases/${release_name} | ||
binaries=( | ||
"src/komodod" | ||
"src/wallet-utility" | ||
"src/komodo-tx" | ||
"src/komodo-cli" | ||
"src/komodo-test" | ||
"src/qt/komodo-qt" | ||
) | ||
for binary in "${binaries[@]}" | ||
do | ||
rm -f "${WORKSPACE}/${binary}${ext}" || false | ||
done | ||
echo "Deleting artefacts from ${WORKSPACE} ..." | ||
# delete possible artefacts from previous build(s) | ||
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 | ||
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 | ||
rm -f ${WORKSPACE}/src/qt/moc_*.cpp # delete meta object code files, otherwise we will have MacOS after Linux/Windows build error | ||
} | ||
copy_release() { | ||
local release_name=$1 | ||
if [[ "$release_name" = "windows" ]]; then | ||
ext=".exe" | ||
else | ||
ext="" | ||
fi | ||
mkdir -p ${WORKSPACE}/releases/${release_name} | ||
binaries=( | ||
"src/komodod" | ||
"src/wallet-utility" | ||
"src/komodo-tx" | ||
"src/komodo-cli" | ||
"src/qt/komodo-qt" | ||
) | ||
for binary in "${binaries[@]}" | ||
do | ||
case $release_name in | ||
windows) | ||
bash -c "/usr/bin/x86_64-w64-mingw32-strip ${WORKSPACE}/${binary}${ext}" || false | ||
;; | ||
macos) | ||
bash -c "${WORKSPACE}/depends/x86_64-apple-darwin/native/bin/x86_64-apple-darwin-strip ${WORKSPACE}/${binary}${ext}" || false | ||
;; | ||
*) | ||
strip "${WORKSPACE}/${binary}${ext}" || false | ||
;; | ||
esac | ||
cp -f "${WORKSPACE}/${binary}${ext}" "${WORKSPACE}/releases/${release_name}/" | ||
done | ||
case $release_name in | ||
xenial) | ||
echo "Performing actions for Xenial..." | ||
mv "${WORKSPACE}/releases/${release_name}/komodo-qt" "${WORKSPACE}/releases/${release_name}/komodo-qt-linux" | ||
;; | ||
focal) | ||
echo "Performing actions for Focal..." | ||
mv "${WORKSPACE}/releases/${release_name}/komodo-qt" "${WORKSPACE}/releases/${release_name}/komodo-qt-linux" | ||
;; | ||
windows) | ||
echo "Performing actions for Windows..." | ||
mv "${WORKSPACE}/releases/${release_name}/komodo-qt${ext}" "${WORKSPACE}/releases/${release_name}/komodo-qt-windows${ext}" | ||
;; | ||
macos) | ||
echo "Performing actions for MacOS..." | ||
bash -c "make deploy" || false | ||
cp -f ${WORKSPACE}/*.dmg "${WORKSPACE}/releases/${release_name}/" | ||
mv "${WORKSPACE}/releases/${release_name}/komodo-qt${ext}" "${WORKSPACE}/releases/${release_name}/komodo-qt-mac${ext}" | ||
;; | ||
*) | ||
echo "Unknown release name: $release_name" | ||
;; | ||
esac | ||
} | ||
emulate_build() { | ||
for folder in macos windows focal; do | ||
mkdir -p ${WORKSPACE}/releases/${folder} | ||
for file in komodo-qt komodo-cli komodo-tx wallet-utility komodod; do | ||
extension="" | ||
case ${folder} in | ||
focal) | ||
[[ "$file" == "komodo-qt" ]] && file=${file}-linux | ||
;; | ||
macos) | ||
[[ "$file" == "komodo-qt" ]] && file=${file}-mac | ||
;; | ||
windows) | ||
extension=".exe" | ||
[[ "$file" == "komodo-qt" ]] && file=${file}-windows | ||
;; | ||
esac | ||
echo test > ${WORKSPACE}/releases/${folder}/${file}${extension} | ||
done | ||
done | ||
echo test > ${WORKSPACE}/releases/macos/KomodoOcean-0.8.1-beta1.dmg | ||
} | ||
if true; then | ||
# Check if awk command exists | ||
command -v awk >/dev/null 2>&1 || { echo >&2 "ERROR: awk command not found."; exit 1; } | ||
# Check if sha256sum command exists | ||
command -v sha256sum >/dev/null 2>&1 || { echo >&2 "ERROR: sha256sum command not found."; exit 1; } | ||
### focal | ||
if [[ "${build_focal}" = "true" ]]; then | ||
# delete old depends binaries (from previous linux version, bcz it's x86_64-unknown-linux-gnu also) | ||
if [[ "${delete_linux_depends}" = true ]]; then | ||
rm -rf ${WORKSPACE}/depends/built/x86_64-unknown-linux-gnu | ||
rm -rf ${WORKSPACE}/depends/x86_64-unknown-linux-gnu | ||
fi | ||
# delete possible artefacts from previous build(s) | ||
delete_artefacts focal | ||
bash -c 'zcutil/build.sh -j'$(expr $(nproc) - 1) | ||
copy_release focal | ||
fi | ||
### windows | ||
if [[ "${build_windows}" = "true" ]]; then | ||
delete_artefacts windows | ||
bash -c 'zcutil/build-win.sh -j'$(expr $(nproc) - 1) | ||
copy_release windows | ||
fi | ||
### macos | ||
if [[ "${build_macos}" = "true" ]]; then | ||
download_and_check_macos_sdk | ||
delete_artefacts macos | ||
bash -c 'zcutil/build-mac-cross.sh -j'$(expr $(nproc) - 1) | ||
copy_release macos | ||
fi | ||
else | ||
emulate_build | ||
# all environment variables of docker container are accessible here, | ||
# you can use BUILDER_NAME or GITHUB_SHA, or GITHUB_ACTOR, etc. | ||
fi | ||
EOF | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
branches: | ||
- static-experimental | ||
- static | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-project-job: | ||
# Execute on pull requests within the same repository (and not forks) or on manual dispatch | ||
if: ${{ github.actor == 'DeckerSU' && (github.event_name == 'workflow_dispatch' || (github.event.pull_request.head.repo.full_name == github.repository)) }} | ||
runs-on: [self-hosted, Linux, X64] | ||
name: Build project job | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set variables | ||
run: | | ||
echo "branch=$(echo ${{ github.ref }} | sed 's/refs\/heads\///g')" >> $GITHUB_OUTPUT | ||
echo "sha_short=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT | ||
echo "builder_name=$(echo $USER)" >> $GITHUB_OUTPUT | ||
echo "builder_uid=$(id -u)" >> $GITHUB_OUTPUT | ||
echo "builder_gid=$(id -g)" >> $GITHUB_OUTPUT | ||
echo "is_fork=${{ github.event.pull_request.head.repo.fork }}" >> $GITHUB_OUTPUT | ||
id: set_variables_step | ||
|
||
- name: Print variables | ||
run: | | ||
echo "Event Type: ${{ github.event_name }}" | ||
echo "Repository name: ${{ github.event.repository.name }}" | ||
echo "Branch: ${{ steps.set_variables_step.outputs.branch }}" | ||
echo "Commit: ${{ steps.set_variables_step.outputs.sha_short }}" | ||
echo "builder_name: ${{ steps.set_variables_step.outputs.builder_name }}" | ||
echo "builder_uid: ${{ steps.set_variables_step.outputs.builder_uid }}" | ||
echo "builder_gid: ${{ steps.set_variables_step.outputs.builder_gid }}" | ||
echo "is_fork: ${{ steps.set_variables_step.outputs.is_fork }}" | ||
- name: Build app in docker container | ||
uses: ./.github/actions/build-project-docker | ||
id: build-in-docker | ||
with: | ||
builder-name: '${{ steps.set_variables_step.outputs.builder_name }}' | ||
builder-uid: '${{ steps.set_variables_step.outputs.builder_uid }}' | ||
builder-gid: '${{ steps.set_variables_step.outputs.builder_gid }}' | ||
|
||
# we don't want use strategy / matrix here, bcz in this case matrix will be used | ||
# for entire job and docker containet will be rebuild several times | ||
- name: Archive artifacts (Linux) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: komodoocean-linux-${{ steps.set_variables_step.outputs.sha_short }} | ||
path: | | ||
./releases/focal | ||
- name: Archive artifacts (Windows) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: komodoocean-windows-${{ steps.set_variables_step.outputs.sha_short }} | ||
path: | | ||
./releases/windows | ||
- name: Archive artifacts (MacOS) | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: komodoocean-macos-${{ steps.set_variables_step.outputs.sha_short }} | ||
path: | | ||
./releases/macos | ||
- name: Cleanup workspace after build | ||
if: always() | ||
shell: bash | ||
run: | | ||
rm -rf ${{ github.workspace }}/* | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.