Skip to content

v0.15.2-py26

v0.15.2-py26 #30

Workflow file for this run

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-linux:
name: Building Python SDK - Linux
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
manylinux: auto
- runner: ubuntu-latest
target: aarch64
manylinux: manylinux_2_28
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ">=3.9 <=3.12"
- name: Install cross-compilation tools
if: ${{ 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
elif [ "${{ matrix.platform.target }}" == "armv7" ]; then
sudo apt-get install -y gcc-arm-linux-gnueabihf
fi
- name: Set CC environment variable
if: ${{ matrix.platform.target != 'x86_64' }}
run: |
if [ "${{ matrix.platform.target }}" == "aarch64" ]; then
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
elif [ "${{ matrix.platform.target }}" == "armv7" ]; then
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/${{ matrix.platform.target }}/dist --find-interpreter --features py-sdk
sccache: 'true'
manylinux: ${{ matrix.platform.manylinux }}
- name: Zip wheels
run: |
ZIP_NAME="kaspa-python-sdk-macos-${{ matrix.platform.target }}-${{ github.event.release.tag_name }}"
cd python/target/${{ matrix.platform.target }}
mv dist "$ZIP_NAME"
zip -r "${ZIP_NAME}.zip" "$ZIP_NAME"
pwd
ls -lah
echo "archive=${ZIP_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: "./python/target/${{ matrix.platform.target }}/${{ env.archive }}.zip"
asset_name: "${{ env.archive }}.zip"
asset_content_type: application/zip
# build-python-windows:
# name: Building Python SDK - Windows
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: windows-latest
# target: x64
# - runner: windows-latest
# target: x86
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: ">=3.9 <=3.12"
# architecture: ${{ matrix.platform.target }}
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# working-directory: python
# target: ${{ matrix.platform.target }}
# args: --release --strip --out target/${{ matrix.platform.target }}/dist --find-interpreter --features py-sdk
# sccache: 'true'
# - name: Zip wheels
# run: |
# $ZIP_NAME = "kaspa-python-sdk-windows-${{ matrix.platform.target }}-${{ github.event.release.tag_name }}"
# cd python/target/${{ matrix.platform.target }}
# Rename-Item -Path "dist" -NewName "$ZIP_NAME"
# Compress-Archive -Path "$ZIP_NAME" -DestinationPath "${ZIP_NAME}.zip"
# Write-Host "Current Directory: $(Get-Location)"
# Get-ChildItem -Path "." -Recurse -Force | Format-List
# echo "archive=$ZIP_NAME" >> $env:GITHUB_ENV
# shell: pwsh
# - 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: "./python/target/${{ matrix.platform.target }}/${{ env.archive }}.zip"
# asset_name: "${{ env.archive }}.zip"
# asset_content_type: application/zip
# build-python-macos:
# name: Building Python SDK - MacOS
# runs-on: ${{ matrix.platform.runner }}
# strategy:
# matrix:
# platform:
# - runner: macos-12
# target: x86_64
# - runner: macos-14
# target: aarch64
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: ">=3.9 <=3.12"
# - name: Build wheels
# uses: PyO3/maturin-action@v1
# with:
# working-directory: python
# target: ${{ matrix.platform.target }}
# args: --release --strip --out target/${{ matrix.platform.target }}/dist --find-interpreter --features py-sdk
# sccache: 'true'
# - name: Zip wheels
# run: |
# ZIP_NAME="kaspa-python-sdk-macos-${{ matrix.platform.target }}-${{ github.event.release.tag_name }}"
# cd python/target/${{ matrix.platform.target }}
# mv dist "$ZIP_NAME"
# zip -r "${ZIP_NAME}.zip" "$ZIP_NAME"
# pwd
# ls -lah
# echo "archive=${ZIP_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: "./python/target/${{ matrix.platform.target }}/${{ env.archive }}.zip"
# asset_name: "${{ env.archive }}.zip"
# asset_content_type: application/zip
build-python:
name: Building Python SDK
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: macos-12
target: x86_64-apple-darwin
- runner: macos-14
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.9 <=3.12"
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: python
target: ${{ matrix.platform.target }}
args: --release --strip --out target/${{ matrix.platform.target }}/dist --find-interpreter --features py-sdk
sccache: 'true'
- name: Zip wheels (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
ZIP_NAME="kaspa-python-sdk-${{ matrix.platform.target }}-${{ github.event.release.tag_name }}"
cd python/target/${{ matrix.platform.target }}
mv dist "$ZIP_NAME"
zip -r "${ZIP_NAME}.zip" "$ZIP_NAME"
pwd
ls -lah
echo "archive=${ZIP_NAME}" >> $GITHUB_ENV
- name: Zip wheels (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ZIP_NAME = "kaspa-python-sdk-${{ matrix.platform.target }}-${{ github.event.release.tag_name }}"
cd python/target/${{ matrix.platform.target }}
Rename-Item dist $ZIP_NAME
Compress-Archive -Path $ZIP_NAME -DestinationPath "$ZIP_NAME.zip"
pwd
Get-ChildItem -Recurse
echo "archive=$ZIP_NAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- 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: "./python/target/${{ matrix.platform.target }}/${{ env.archive }}.zip"
asset_name: "${{ env.archive }}.zip"
asset_content_type: application/zip
# build-python-sdist:
# name: Build Python SDK sdist
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Build sdist
# uses: PyO3/maturin-action@v1
# with:
# working-directory: python
# command: sdist
# args: --out dist
# - name: Upload sdist
# uses: actions/upload-artifact@v4
# with:
# name: wheels-sdist
# path: python/dist
# python-sdk-release:
# name: Python SDK Release
# runs-on: ubuntu-latest
# if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
# needs: [linux, windows, macos, sdist]
# permissions:
# # Use to sign the release artifacts
# id-token: write
# # Used to upload release artifacts
# contents: write
# # Used to generate artifact attestation
# attestations: write
# steps:
# - uses: actions/download-artifact@v4
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v1
# with:
# subject-path: 'wheels-*/*'
# - name: Publish to PyPI
# if: "startsWith(github.ref, 'refs/tags/')"
# uses: PyO3/maturin-action@v1
# env:
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
# with:
# command: upload
# args: --non-interactive --skip-existing wheels-*/*