Skip to content

Commit

Permalink
V3 alpha4 fixes (#318)
Browse files Browse the repository at this point in the history
* Refactor CMake build files

* Created separate `bladebit_harvester` target meant
   to be used as a dependency.

* Spelling fixes and build fixes.

* Fixed CUDA harvesting qualities

* Updated CI to for new harvester target

* Other bug fixed

* Made harvester API more portable, and able to be dynamically loaded

* Add API to get compression info directly into the harvester API

* version bump alpha4

Co-authored-by:  Kyle Altendorf <k.altendorf@chia.net>
Co-authored-by:  William Allen <w.allen@chia.net>
  • Loading branch information
3 people authored May 9, 2023
1 parent e08ee8c commit ec28f18
Show file tree
Hide file tree
Showing 46 changed files with 1,437 additions and 2,458 deletions.
13 changes: 7 additions & 6 deletions .github/actions/build-asset-unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@ gcc --version

exe_name=bladebit
target=bladebit
if [[ compile_cuda ]]; then
if [[ compile_cuda -eq 1 ]]; then
target=bladebit_cuda
exe_name=bladebit_cuda
fi

mkdir build && cd build
cmake ..
set -x
mkdir build-${target} && cd build-${target}
cmake .. -DCMAKE_BUILD_TYPE=Release
bash -eo pipefail ../embed-version.sh
cmake --build . --target bladebit --config Release --target $target -j $thread_count
chmod +x ./bladebit
cmake --build . --config Release --target $target -j $thread_count
chmod +x ./${exe_name}

if [[ $OSTYPE == 'msys'* ]] || [[ $OSTYPE == 'cygwin'* ]]; then
ls -la Release
Expand All @@ -64,7 +65,7 @@ fi

tar --version
tar -czvf $artifact_name $exe_name
mkdir ../bin
mkdir -p ../bin
mv $artifact_name ../bin/
ls -la ../bin

44 changes: 44 additions & 0 deletions .github/actions/build-harvester-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -eo pipefail

artifact_name=green_reaper.tar.gz

while true; do
case $1 in
--artifact)
shift && artifact_name=$1 || exit 1
;;
esac
shift || break
done

echo "Harvester artifact: ${artifact_name}"
echo 'cmake --version'
cmake --version

mkdir -p build-harvester
pushd build-harvester
cmake .. -DCMAKE_BUILD_TYPE=Release -DBB_HARVESTER_ONLY=ON

cmake --build . --config Release --target bladebit_harvester -j$(nproc --all)
cmake --install . --prefix harvester_dist

pushd harvester_dist/green_reaper
artifact_files=$(find . -name '*.*' | cut -c3-)
sha256sum ${artifact_files} > sha256checksum

artifact_files="${artifact_files} sha256checksum"

tar --version
tar -czvf ${artifact_name} ${artifact_files}

popd
mv harvester_dist/green_reaper/${artifact_name} ./
sha256sum ${artifact_name} > ${artifact_name}.sha256.txt
ls -la
cat ${artifact_name}.sha256.txt

echo "harvester_artifact_path=$(pwd)/${artifact_name}*" >> $GITHUB_ENV

popd
ls -la
7 changes: 4 additions & 3 deletions .github/actions/get-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ if [[ "$os" == "windows" ]]; then
ext="zip"
fi

echo "::set-output name=BB_VERSION::$version"
echo "::set-output name=BB_ARTIFACT_NAME::bladebit-v${version}-${os}-${arch}.${ext}"
echo "::set-output name=BB_ARTIFACT_NAME_CUDA::bladebit-cuda-v${version}-${os}-${arch}.${ext}"
echo "BB_VERSION=$version" >> $GITHUB_ENV
echo "BB_ARTIFACT_NAME=bladebit-v${version}-${os}-${arch}.${ext}" >> $GITHUB_ENV
echo "BB_ARTIFACT_NAME_CUDA=bladebit-cuda-v${version}-${os}-${arch}.${ext}" >> $GITHUB_ENV


33 changes: 33 additions & 0 deletions .github/actions/install-cmake-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -eo pipefail
ref_cmake_sha256='39e1c2eccda989b0d000dc5f4ee2cb031bdda799163780d855acc0bd9eda9d92'
cmake_name='cmake-3.23.3-linux-x86_64'

curl -L https://github.com/Kitware/CMake/releases/download/v3.23.3/cmake-3.23.3-linux-x86_64.tar.gz > cmake.tar.gz

cmake_sh_sha256=$(sha256sum cmake.tar.gz | cut -f1 -d' ')
if [[ "${ref_cmake_sha256}" != "${cmake_sh_sha256}" ]]; then
2>&1 echo "sha256 mismatch!: "
2>&1 echo "Got : '${cmake_sh_sha256}'"
2>&1 echo "Expected: '${ref_cmake_sha256}'"
exit 1
fi

rm -f /usr/bin/cmake && rm -f /usr/local/bin/cmake
mkdir -p /usr/local/bin
mkdir -p /usr/local/share

cmake_prefix=$(pwd)/${cmake_name}
tar -xzvf cmake.tar.gz
ls -la
ls -la ${cmake_prefix}

cp -r ${cmake_prefix}/bin/* /usr/local/bin/
cp -r ${cmake_prefix}/share/* /usr/local/share/

echo 'Cmake Info:'
which cmake
cmake --version

echo 'Done.'
exit 0
4 changes: 3 additions & 1 deletion .github/workflows/attach-release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
bladebit-v${BB_VERSION}-windows-x86-64.zip
bladebit-v${BB_VERSION}-macos-arm64.tar.gz
bladebit-v${BB_VERSION}-macos-x86-64.tar.gz
green_reaper-v${BB_VERSION}-ubuntu-x86-64.tar.gz
green_reaper-v${BB_VERSION}-centos-x86-64.tar.gz
)
mkdir -p bin
Expand All @@ -59,4 +61,4 @@ jobs:
echo "Uploading release asset '${artifact_name}'"
node .github/actions/artifacts.mjs upload-release-asset $BB_VERSION $artifact_name bin/$artifact_name
done
Loading

0 comments on commit ec28f18

Please sign in to comment.