v0.15.2-py40 #43
Workflow file for this run
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
name: Build and upload assets | |
on: | |
release: | |
types: [ published ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# Build gnu-linux on ubuntu-18.04 and musl on ubuntu latest | |
# os: [ ubuntu-18.04, ubuntu-latest, windows-latest, macos-latest ] | |
os: [ ubuntu-latest, windows-latest, macos-latest ] | |
name: Building, ${{ matrix.os }} | |
steps: | |
- name: Fix CRLF on Windows | |
if: runner.os == 'Windows' | |
run: git config --global core.autocrlf false | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache Cargo Build Outputs | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache Toolchain | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/x-tools | |
key: ${{ runner.os }}-musl-${{ hashFiles('**/musl-toolchain/preset.sh') }} | |
restore-keys: | | |
${{ runner.os }}-musl- | |
- name: Build on Linux | |
if: runner.os == 'Linux' | |
# We're using musl to make the binaries statically linked and portable | |
run: | | |
# Run build script for musl toolchain | |
source musl-toolchain/build.sh | |
# Go back to the workspace | |
cd $GITHUB_WORKSPACE | |
# Build for musl | |
cargo --verbose build --bin kaspad --bin rothschild --bin kaspa-wallet --release --target x86_64-unknown-linux-musl | |
mkdir bin || true | |
cp target/x86_64-unknown-linux-musl/release/kaspad bin/ | |
cp target/x86_64-unknown-linux-musl/release/rothschild bin/ | |
cp target/x86_64-unknown-linux-musl/release/kaspa-wallet bin/ | |
archive="bin/rusty-kaspa-${{ github.event.release.tag_name }}-linux-amd64.zip" | |
asset_name="rusty-kaspa-${{ github.event.release.tag_name }}-linux-amd64.zip" | |
zip -r "${archive}" ./bin/* | |
echo "archive=${archive}" >> $GITHUB_ENV | |
echo "asset_name=${asset_name}" >> $GITHUB_ENV | |
- name: Build on Windows | |
if: runner.os == 'Windows' | |
shell: bash | |
run: | | |
cargo build --bin kaspad --release | |
cargo build --bin rothschild --release | |
cargo build --bin kaspa-wallet --release | |
mkdir bin || true | |
cp target/release/kaspad.exe bin/ | |
cp target/release/rothschild.exe bin/ | |
cp target/release/kaspa-wallet.exe bin/ | |
archive="bin/rusty-kaspa-${{ github.event.release.tag_name }}-win64.zip" | |
asset_name="rusty-kaspa-${{ github.event.release.tag_name }}-win64.zip" | |
powershell "Compress-Archive bin/* \"${archive}\"" | |
echo "archive=${archive}" >> $GITHUB_ENV | |
echo "asset_name=${asset_name}" >> $GITHUB_ENV | |
- name: Build on MacOS | |
if: runner.os == 'macOS' | |
run: | | |
cargo build --bin kaspad --release | |
cargo build --bin rothschild --release | |
cargo build --bin kaspa-wallet --release | |
mkdir bin || true | |
cp target/release/kaspad bin/ | |
cp target/release/rothschild bin/ | |
cp target/release/kaspa-wallet bin/ | |
archive="bin/rusty-kaspa-${{ github.event.release.tag_name }}-osx.zip" | |
asset_name="rusty-kaspa-${{ github.event.release.tag_name }}-osx.zip" | |
zip -r "${archive}" ./bin/* | |
echo "archive=${archive}" >> $GITHUB_ENV | |
echo "asset_name=${asset_name}" >> $GITHUB_ENV | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: "./${{ env.archive }}" | |
asset_name: "${{ env.asset_name }}" | |
asset_content_type: application/zip | |
build-wasm: | |
runs-on: ubuntu-latest | |
name: Building WASM32 SDK | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install llvm | |
id: install_llvm | |
continue-on-error: true | |
run: | | |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc | |
sudo apt-get install -y clang-15 lldb-15 lld-15 clangd-15 clang-tidy-15 clang-format-15 clang-tools-15 llvm-15-dev lld-15 lldb-15 llvm-15-tools libomp-15-dev libc++-15-dev libc++abi-15-dev libclang-common-15-dev libclang-15-dev libclang-cpp15-dev libunwind-15-dev | |
# Make Clang 15 default | |
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-15/bin/clang++ 100 | |
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-15/bin/clang 100 | |
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/lib/llvm-15/bin/clang-format 100 | |
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/lib/llvm-15/bin/clang-tidy 100 | |
sudo update-alternatives --install /usr/bin/run-clang-tidy run-clang-tidy /usr/lib/llvm-15/bin/run-clang-tidy 100 | |
# Alias cc to clang | |
sudo update-alternatives --install /usr/bin/cc cc /usr/lib/llvm-15/bin/clang 0 | |
sudo update-alternatives --install /usr/bin/c++ c++ /usr/lib/llvm-15/bin/clang++ 0 | |
- name: Install gcc-multilib | |
# gcc-multilib allows clang to find gnu libraries properly | |
run: sudo apt install -y gcc-multilib | |
- name: Install stable toolchain | |
if: steps.install_llvm.outcome == 'success' && steps.install_llvm.conclusion == 'success' | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install wasm-pack | |
run: cargo install wasm-pack | |
- name: Add wasm32 target | |
run: rustup target add wasm32-unknown-unknown | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Install NodeJS dependencies | |
run: npm install --global typedoc typescript | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build WASM32 SDK | |
run: | | |
cd wasm | |
bash build-release | |
mv release/kaspa-wasm32-sdk.zip ../kaspa-wasm32-sdk-${{ github.event.release.tag_name }}.zip | |
archive="kaspa-wasm32-sdk-${{ github.event.release.tag_name }}.zip" | |
asset_name="kaspa-wasm32-sdk-${{ github.event.release.tag_name }}.zip" | |
echo "archive=${archive}" >> $GITHUB_ENV | |
echo "asset_name=${asset_name}" >> $GITHUB_ENV | |
- name: Upload WASM32 SDK | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: "./${{ env.archive }}" | |
asset_name: "${{ env.asset_name }}" | |
asset_content_type: application/zip | |
build-python-sdk: | |
name: Building Python SDK | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: ubuntu-latest | |
target: x86_64 | |
manylinux: auto | |
- runner: ubuntu-latest | |
target: aarch64 | |
# ring crate 0.17 fails to build for aarch64 using manylinux: auto, hence manylinux_2_28 | |
manylinux: manylinux_2_28 | |
- runner: macos-latest | |
target: x86_64-apple-darwin | |
- runner: macos-latest | |
target: aarch64-apple-darwin | |
- runner: windows-latest | |
target: x64 | |
- runner: windows-latest | |
target: x86 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '>=3.10 <3.13' | |
- name: Install cross-compilation tools (Linux only) | |
if: runner.os == 'Linux' && matrix.platform.target != 'x86_64' | |
run: | | |
sudo apt-get update | |
if [ "${{ matrix.platform.target }}" == "aarch64" ]; then | |
sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross | |
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
elif [ "${{ matrix.platform.target }}" == "armv7" ]; then | |
sudo apt-get install -y gcc-arm-linux-gnueabihf | |
echo "CC=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV | |
fi | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
working-directory: python | |
target: ${{ matrix.platform.target }} | |
args: --release --strip --out target/dist --features py-sdk --interpreter python3.12 | |
sccache: 'true' | |
manylinux: ${{ matrix.platform.manylinux || '' }} | |
# - name: Move wheels to artifacts directory (MacOS, Linux) | |
# if: runner.os != 'Windows' | |
# run: | | |
# OS_ARCH_DIR="artifacts" | |
# sudo mkdir -p "$OS_ARCH_DIR" | |
# sudo mv python/target/dist/* "$OS_ARCH_DIR/" | |
# - name: Move wheels to artifacts directory (Windows) | |
# if: runner.os == 'Windows' | |
# shell: pwsh | |
# run: | | |
# $OS_ARCH_DIR = "artifacts" | |
# mkdir -p $OS_ARCH_DIR | |
# Move-Item -Path "python/target/dist/*" -Destination "$OS_ARCH_DIR" -Force | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ runner.os }}-${{ matrix.platform.target }} | |
path: python/target/dist/ | |
collect-python-sdk-artifacts: | |
name: Collect Python SDK Artifacts | |
needs: build-python-sdk | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
# - name: Organize artifacts into OS/Architecture directories | |
# run: | | |
# sudo mkdir -p combined_artifacts | |
# sudo mv all_artifacts/* combined_artifacts/ | |
- name: Zip artifacts | |
run: | | |
pwd | |
ls -l | |
cd artifacts | |
sudo zip -r ../kaspa-python-sdk.zip . | |
cd .. | |
- name: Upload consolidated release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./kaspa-python-sdk-${{ github.event.release.tag_name }}.zip | |
asset_name: "kaspa-python-sdk.zip" | |
asset_content_type: application/zip |