Skip to content

Bump golang.org/x/crypto from 0.31.0 to 0.35.0 in /module/gobdk #118

Bump golang.org/x/crypto from 0.31.0 to 0.35.0 in /module/gobdk

Bump golang.org/x/crypto from 0.31.0 to 0.35.0 in /module/gobdk #118

Workflow file for this run

name: Build BDK
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- master
workflow_dispatch:
inputs:
bitcoin-sv-input:
description: 'Optionally build bdk with custom bitcoin-sv commit'
required: false
default: 394645fcba643e5f7090ff1beb246a2b72b3b172
env:
DEFAULT_BITCOIN_SV_COMMIT: 394645fcba643e5f7090ff1beb246a2b72b3b172
jobs:
build-bdk:
strategy:
matrix:
os: [linux-arm64-8-core, ubuntu-24.04, macos-15, macos-13, windows-2022]
fail-fast: false
outputs:
modified: ${{ steps.gobdk_change.outputs.modified }}
runs-on: ${{ matrix.os }}
env:
GO111MODULE : on
GOFLAGS : -mod=vendor
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Set up Python 3
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Define dependant bitcoin-sv commit
id: define-bitcoin-sv-commit
shell: bash
run: |
# Use dispatch input if present, otherwise default from env
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
bsvcommit="${{ github.event.inputs.bitcoin-sv-input }}"
else
bsvcommit="${{ env.DEFAULT_BITCOIN_SV_COMMIT }}"
fi
echo "Build using bsvcommit=$bsvcommit ..."
echo "bsvcommit=$bsvcommit" >> "$GITHUB_OUTPUT"
- name: Check out bitcoin-sv
shell: bash
run: |
echo "Checking out bitcoin-sv at commit ${{ steps.define-bitcoin-sv-commit.outputs.bsvcommit }} ..."
git clone https://x-access-token:${{ secrets.BITCOIN_SV_PAT }}@github.com/nchain-research/bitcoin-sv-staging.git bitcoin-sv
cd bitcoin-sv && git checkout ${{ steps.define-bitcoin-sv-commit.outputs.bsvcommit }} && git log -3 && pwd && cd ..
echo "Successfully checked out bitcoin-sv commit ${{ steps.define-bitcoin-sv-commit.outputs.bsvcommit }} to bitcoin-sv"
## Download and setup environment varialbe
## BSV_ROOT, BOOST_ROOT, OPENSSL_ROOT_DIR, JAVA_HOME
- name: Prepare Environment and Dependencies Unix
if: runner.os != 'Windows'
run: |
echo "BSV_ROOT=${{ github.workspace }}/bitcoin-sv" >> $GITHUB_ENV
python -m pip install --upgrade pip --break-system-packages
python -m pip install -U pytest junitparser mkdocs pymdown-extensions plantuml_markdown --break-system-packages
echo "OS_ARCH=$(uname -s | tr 'A-Z' 'a-z')_$(uname -m)" >> $GITHUB_ENV
if [[ ${{ matrix.os }} == *'ubuntu'* ]]; then
sudo apt-get update
sudo apt-get install -y build-essential g++ wget
wget https://github.com/bitcoin-sv/bdk/releases/download/depcy/dependancies_linux_x86_64.tar.gz
tar -xzf dependancies_linux_x86_64.tar.gz
echo "DEPENDENCIES_DIR=${{ github.workspace }}/dependancies_linux_x86_64" >> $GITHUB_ENV
echo "BOOST_ROOT=${{ github.workspace }}/dependancies_linux_x86_64/boost_1.85.0" >> $GITHUB_ENV
echo "OPENSSL_ROOT_DIR=${{ github.workspace }}/dependancies_linux_x86_64/openssl_3.4.0" >> $GITHUB_ENV
echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
fi
if [[ ${{ matrix.os }} == *'linux'* ]]; then
sudo apt-get update
sudo apt-get install -y build-essential g++ wget
wget https://github.com/bitcoin-sv/bdk/releases/download/depcy/dependancies_linux_aarch64.tar.gz
tar -xzf dependancies_linux_aarch64.tar.gz
echo "DEPENDENCIES_DIR=${{ github.workspace }}/dependancies_linux_aarch64" >> $GITHUB_ENV
echo "BOOST_ROOT=${{ github.workspace }}/dependancies_linux_aarch64/boost_1.85.0" >> $GITHUB_ENV
echo "OPENSSL_ROOT_DIR=${{ github.workspace }}/dependancies_linux_aarch64/openssl_3.4.0" >> $GITHUB_ENV
echo "JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-arm64" >> $GITHUB_ENV
fi
if [[ ${{ matrix.os }} == *'macos-15'* ]]; then
wget https://github.com/bitcoin-sv/bdk/releases/download/depcy/dependancies_darwin_arm64.tar.gz
tar -xzf dependancies_darwin_arm64.tar.gz
echo "DEPENDENCIES_DIR=${{ github.workspace }}/dependancies_darwin_arm64" >> $GITHUB_ENV
echo "BOOST_ROOT=${{ github.workspace }}/dependancies_darwin_arm64/boost_1.85.0" >> $GITHUB_ENV
echo "OPENSSL_ROOT_DIR=${{ github.workspace }}/dependancies_darwin_arm64/openssl_3.4.0" >> $GITHUB_ENV
echo "JAVA_HOME=$JAVA_HOME_17_arm64" >> $GITHUB_ENV
fi
if [[ ${{ matrix.os }} == *'macos-13'* ]]; then
wget https://github.com/bitcoin-sv/bdk/releases/download/depcy/dependancies_darwin_x86_64.tar.gz
tar -xzf dependancies_darwin_x86_64.tar.gz
echo "DEPENDENCIES_DIR=${{ github.workspace }}/dependancies_darwin_x86_64" >> $GITHUB_ENV
echo "BOOST_ROOT=${{ github.workspace }}/dependancies_darwin_x86_64/boost_1.85.0" >> $GITHUB_ENV
echo "OPENSSL_ROOT_DIR=${{ github.workspace }}/dependancies_darwin_x86_64/openssl_3.4.0" >> $GITHUB_ENV
#echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
fi
- name: Build and Test BDK Unix (all linux and mac arm)
if: runner.os != 'Windows' && matrix.os != 'macos-13'
run: |
mkdir -p "build"
rm -fR ./build/* && rm -fR test/golang/vendor/*
cmake -B build -S "." -DINSTALL_GOBDK_INSOURCE=ON
cmake --build build --parallel 4
ctest --output-on-failure --test-dir build
- name: Build and Test BDK Mac OS 13 (amd) with hot fix
if: matrix.os == 'macos-13'
run: |
echo "Hot fix for compilation with clang 15 on macos-13 runner ... "
sed -i '' 's/throw stack_overflow_error("\([^"]*\)");/throw stack_overflow_error(std::string("\1"));/g' $BSV_ROOT/src/script/limitedstack.cpp
sed -i '' '/#include <utility>/a\
#include <string>' $BSV_ROOT/src/script/limitedstack.cpp
echo "File $BSV_ROOT/src/script/limitedstack.cpp has been modified"
mkdir -p "build"
rm -fR ./build/* && rm -fR test/golang/vendor/*
cmake -B build -S "." -DINSTALL_GOBDK_INSOURCE=ON
cmake --build build --parallel 4
ctest --output-on-failure --test-dir build
- name: Check GoBDK has changed
id: gobdk_change
if: runner.os != 'Windows' && github.event_name != 'workflow_dispatch'
run: |
changed_files=$(git diff --name-only -- module/gobdk/bdkcgo/libGoBDK_*.a)
git status
if [[ -n "$changed_files" ]]; then
echo "Modified files detected : $changed_files"
echo "modified=true" >> "$GITHUB_OUTPUT"
else
echo "No modifications detected"
echo "modified=false" >> "$GITHUB_OUTPUT"
fi
- name: Upload GoBDK static libraries to artifact UNIX
if: runner.os != 'Windows' && github.event_name != 'workflow_dispatch' && steps.gobdk_change.outputs.modified == 'true'
uses: actions/upload-artifact@v4
with:
name: libGoBDK_${{ env.OS_ARCH }}.a
path: ./module/gobdk/bdkcgo/libGoBDK_${{ env.OS_ARCH }}.a
retention-days: 1
overwrite: true
- name: Prepare Environment and Dependencies for Windows
if: runner.os == 'Windows'
run: |
echo "BSV_ROOT=${{ github.workspace }}\bitcoin-sv" >> $GITHUB_ENV
Invoke-WebRequest -Uri "https://github.com/bitcoin-sv/bdk/releases/download/depcy/dependancies_windows_x86_64.zip" -OutFile "dependancies_windows_x86_64.zip"
Expand-Archive -Path "dependancies_windows_x86_64.zip" -DestinationPath "."
## On windows, build and test only core C++ module
- name: Build and Test BDK Windows
if: runner.os == 'Windows'
run: |
mkdir "build"
cmake -G"Visual Studio 17 2022" -A x64 -B "build" -S "." -DBUILD_MODULE_JAVA=OFF -DBUILD_MODULE_PYTHON=OFF -DBUILD_MODULE_GOLANG=OFF -DBOOST_ROOT="./dependancies_windows_x86_64/boost_1.85.0" -DOPENSSL_ROOT_DIR="./dependancies_windows_x86_64/openssl_3.0.14"
cmake --build build --config Debug --parallel 4
ctest --output-on-failure --test-dir build -C Debug --parallel 4
cmake --build build --config Release --parallel 4
ctest --output-on-failure --test-dir build -C Release --parallel 4
commit-static-gobdk:
runs-on: ubuntu-latest
needs: build-bdk
# Commit static libraries gobdk iff all matrix build succeeds and the commit does not contains [GoBDKUpdate]
# The commit containing [GoBDKUpdate] is submitted by the bot, we should prevent the infinit build loops
if: github.event_name != 'workflow_dispatch' && ${{ success() }} && needs.build-bdk.outputs.modified == 'true' && !contains(github.event.head_commit.message, '[GoBDKUpdate]')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Download all gobdk static libraries artifacts
uses: actions/download-artifact@v4
with:
# pattern: libGoBDK_*.a
path: ./tmp_artifact
- name: Copy and show ./module/gobdk/bdkcgo/
run: |
find ./tmp_artifact -type f -name 'libGoBDK_*_*.a' -exec mv {} ./module/gobdk/bdkcgo/ \;
ls ./module/gobdk/bdkcgo/
- name: Commit and push gobdk static libraries changes
run: |
# Stash all gobdk static libraries if any change
git add ./module/gobdk/bdkcgo/libGoBDK_*_*.a
git status
# Commit only if there are changes
if ! git diff --cached --quiet; then
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "[bot] [GoBDKUpdate] Update gobdk static libraries changes"
else
echo "No changes to commit"
fi
BRANCH_NAME=${{ github.head_ref }}
echo "BRANCH_NAME=$BRANCH_NAME"
git log -2
git push -u origin $BRANCH_NAME