feat: wallet addresses on main screen (#295) #13
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 cli | |
'on': | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]*' | |
branches: | |
- build-cli-* | |
- main | |
- nextnet | |
workflow_dispatch: | |
env: | |
toolchain: stable | |
matrix-json-file: ".github/workflows/build_cli.json" | |
CARGO_HTTP_MULTIPLEXING: false | |
CARGO_UNSTABLE_SPARSE_REGISTRY: true | |
CARGO: cargo | |
# CARGO_OPTIONS: "--verbose" | |
CARGO_OPTIONS: "--release" | |
TBN_FILENAME: "tari_launchpad_cli" | |
TBN_BUNDLE_ID_BASE: "com.tarilabs" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
matrix-prep: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: false | |
- name: Set Matrix | |
id: set-matrix | |
run: | | |
# | |
# build all targets images | |
# matrix=$( jq -s -c .[] ${{ env.matrix-json-file }} ) | |
# | |
# build only single target image | |
# matrix_selection=$( jq -c '.[] | select( ."name" == "linux-x86_64" )' ${{ env.matrix-json-file }} ) | |
# matrix_selection=$( jq -c '.[] | select( ."runs-on" | startswith("macos") )' ${{ env.matrix-json-file }} ) | |
# | |
# buid select target images - build_enabled | |
matrix_selection=$( jq -c '.[] | select( ."build_enabled" != false )' ${{ env.matrix-json-file }} ) | |
# | |
# Setup the json build matrix | |
matrix=$(echo ${matrix_selection} | jq -s -c '{"builds": .}') | |
echo ${matrix} | |
echo ${matrix} | jq . | |
echo "matrix=${matrix}" >> $GITHUB_OUTPUT | |
matrix-check: | |
# Debug matrix | |
if: ${{ false }} | |
runs-on: ubuntu-latest | |
needs: matrix-prep | |
steps: | |
- name: Install json2yaml | |
run: | | |
sudo npm install -g json2yaml | |
- name: Check matrix definition | |
run: | | |
matrix='${{ needs.matrix-prep.outputs.matrix }}' | |
echo ${matrix} | |
echo ${matrix} | jq . | |
echo ${matrix} | json2yaml | |
builds: | |
name: Building ${{ matrix.builds.name }} on ${{ matrix.builds.runs-on }} | |
needs: matrix-prep | |
outputs: | |
LAUNCHPAD_VERSION: ${{ steps.set-tari-vars.outputs.LAUNCHPAD_VERSION }} | |
TARI_NETWORK_DIR: ${{ steps.set-tari-vars.outputs.TARI_NETWORK_DIR }} | |
TARI_NETWORK_VERSION: ${{ steps.set-tari-vars.outputs.TARI_NETWORK_VERSION }} | |
BINFILE: ${{ steps.set-binfile.outputs.BINFILE }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.matrix-prep.outputs.matrix) }} | |
runs-on: ${{ matrix.builds.runs-on }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Setup Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
components: rustfmt, clippy | |
toolchain: ${{ matrix.builds.rust }} | |
targets: ${{ matrix.builds.target }} | |
- name: Declare Global Variables 4 GHA ${{ github.event_name }} | |
id: set-tari-vars | |
shell: bash | |
run: | | |
LAUNCHPAD_VERSION=v$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' "$GITHUB_WORKSPACE/cli/Cargo.toml") | |
echo "LAUNCHPAD_VERSION=${LAUNCHPAD_VERSION}" >> $GITHUB_ENV | |
echo "LAUNCHPAD_VERSION=${LAUNCHPAD_VERSION}" >> $GITHUB_OUTPUT | |
TARI_NETWORK_DIR=$(awk -F ' = ' '$1 ~ /tari_network/ { gsub(/["]/, "", $2); printf("%s",tolower($2)) }' "$GITHUB_WORKSPACE/libs/sdm-assets/assets/settings.toml") | |
echo "TARI_NETWORK_DIR=${TARI_NETWORK_DIR}" >> $GITHUB_ENV | |
echo "TARI_NETWORK_DIR=${TARI_NETWORK_DIR}" >> $GITHUB_OUTPUT | |
TARI_NETWORK_VERSION=$(cargo tree -p tari-lp-cli -i tari_core --locked | head -n1 | cut -d " " -f 2) | |
echo "TARI_NETWORK_VERSION=${TARI_NETWORK_VERSION}" >> $GITHUB_ENV | |
echo "TARI_NETWORK_VERSION=${TARI_NETWORK_VERSION}" >> $GITHUB_OUTPUT | |
- name: Install Linux dependencies - Ubuntu | |
if: ${{ startsWith(runner.os,'Linux') && ( ! matrix.builds.cross ) }} | |
run: | | |
sudo apt-get update | |
sudo bash scripts/cli/install_ubuntu_dependencies.sh | |
sudo bash scripts/install_ubuntu_dependencies.sh | |
- name: Install Linux dependencies - Ubuntu - cross-compile arm64 on x86-64 | |
if: ${{ startsWith(runner.os,'Linux') && ( ! matrix.builds.cross ) && matrix.builds.name == 'linux-arm64' }} | |
run: | | |
sudo apt-get update | |
sudo bash scripts/cli/install_ubuntu_dependencies-arm64.sh | |
rustup target add ${{ matrix.builds.target }} | |
- name: Install macOS dependencies | |
if: startsWith(runner.os,'macOS') | |
run: | | |
brew install cmake coreutils automake autoconf protobuf | |
- name: Install Windows dependencies | |
if: startsWith(runner.os,'Windows') | |
run: | | |
vcpkg.exe install sqlite3:x64-windows zlib:x64-windows | |
# Bug in choco - need to install each package individually | |
choco upgrade llvm -y | |
# psutils is out of date | |
# choco upgrade psutils -y | |
choco upgrade openssl -y | |
# Should already be installed | |
# choco upgrade strawberryperl -y | |
choco upgrade protoc -y | |
- name: Set environment variables - Nix | |
if: ${{ ! startsWith(runner.os,'Windows') }} | |
run: | | |
echo "SHARUN=shasum --algorithm 256" >> $GITHUB_ENV | |
echo "CC=gcc" >> $GITHUB_ENV | |
echo "TBN_EXT=" >> $GITHUB_ENV | |
- name: Set environment variables - macOS | |
if: startsWith(runner.os,'macOS') | |
run: | | |
echo "PLATFORM_SPECIFIC_DIR=osx" >> $GITHUB_ENV | |
- name: Set environment variables - Ubuntu | |
if: startsWith(runner.os,'Linux') | |
run: | | |
echo "PLATFORM_SPECIFIC_DIR=linux" >> $GITHUB_ENV | |
- name: Set environment variables - Windows | |
if: startsWith(runner.os,'Windows') | |
shell: bash | |
run: | | |
# echo "SHARUN=pwsh C:\ProgramData\chocolatey\lib\psutils\tools\psutils-master\shasum.ps1 --algorithm 256" >> $GITHUB_ENV | |
mkdir -p "$GITHUB_WORKSPACE\psutils" | |
curl -v -o "$GITHUB_WORKSPACE\psutils\getopt.ps1" "https://raw.githubusercontent.com/lukesampson/psutils/master/getopt.ps1" | |
curl -v -o "$GITHUB_WORKSPACE\psutils\shasum.ps1" "https://raw.githubusercontent.com/lukesampson/psutils/master/shasum.ps1" | |
echo "SHARUN=pwsh $GITHUB_WORKSPACE\psutils\shasum.ps1 --algorithm 256" >> $GITHUB_ENV | |
echo "TBN_EXT=.exe" >> $GITHUB_ENV | |
echo "PLATFORM_SPECIFIC_DIR=windows" >> $GITHUB_ENV | |
echo "SQLITE3_LIB_DIR=C:\vcpkg\installed\x64-windows\lib" >> $GITHUB_ENV | |
echo "X86_64_PC_WINDOWS_MSVC_OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >> $GITHUB_ENV | |
echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" >> $GITHUB_ENV | |
echo "C:\Strawberry\perl\bin" >> $GITHUB_PATH | |
- name: Cache cargo files and outputs | |
if: ${{ ( ! startsWith(github.ref, 'refs/tags/v') ) && ( ! matrix.builds.cross ) }} | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.builds.target }} | |
- name: Install and setup cargo cross | |
if: ${{ matrix.builds.cross }} | |
shell: bash | |
run: | | |
cargo install cross | |
echo "CARGO=cross" >> $GITHUB_ENV | |
- name: Install and setup cargo-auditable | |
if: ${{ false }} | |
# if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
shell: bash | |
run: | | |
cargo install cargo-auditable | |
echo "CARGO=${{ env.CARGO }} auditable" >> $GITHUB_ENV | |
echo "CARGO_OPTIONS=${{ env.CARGO_OPTIONS }} --release" >> $GITHUB_ENV | |
- name: Show command used for Cargo | |
shell: bash | |
run: | | |
echo "cargo command is: ${{ env.CARGO }}" | |
echo "cargo options is: ${{ env.CARGO_OPTIONS }}" | |
echo "cross flag: ${{ matrix.builds.cross }}" | |
- name: Build release binaries | |
# can't use bash for windows build, perl breakage for openssl | |
# shell: bash | |
# don't mess with indentation (readability) | |
run: > | |
${{ env.CARGO }} build ${{ env.CARGO_OPTIONS }} | |
--target ${{ matrix.builds.target }} | |
--bin tari-lp-cli | |
${{ matrix.builds.flags }} --locked | |
- name: Setup BINFILE Env | |
id: set-binfile | |
shell: bash | |
run: | | |
BINFILE="${TBN_FILENAME}-${LAUNCHPAD_VERSION}-${TARI_NETWORK_DIR}-${TARI_NETWORK_VERSION}-${{ matrix.builds.name }}${TBN_EXT}" | |
echo "BINFILE=${BINFILE}" >> $GITHUB_ENV | |
echo "BINFILE=${BINFILE}" >> $GITHUB_OUTPUT | |
SHORT_FILENAME="${{ env.TBN_FILENAME }}-${{ matrix.builds.name }}${{ env.TBN_EXT }}" | |
echo "SHORT_FILENAME=${SHORT_FILENAME}" >> $GITHUB_ENV | |
- name: Extra macOS preparation | |
if: ${{ startsWith(runner.os,'macOS') && env.MACOS_KEYCHAIN_PASS != '' }} | |
continue-on-error: true | |
env: | |
MACOS_KEYCHAIN_PASS: ${{ secrets.MACOS_KEYCHAIN_PASS }} | |
MACOS_APPLICATION_ID: ${{ secrets.MACOS_APPLICATION_ID }} | |
MACOS_APPLICATION_CERT: ${{ secrets.MACOS_APPLICATION_CERT }} | |
MACOS_APPLICATION_PASS: ${{ secrets.MACOS_APPLICATION_PASS }} | |
run: | | |
security create-keychain -p $MACOS_KEYCHAIN_PASS build.keychain | |
security default-keychain -s build.keychain | |
security unlock-keychain -p $MACOS_KEYCHAIN_PASS build.keychain | |
echo $MACOS_APPLICATION_CERT | base64 --decode > application.p12 | |
security import application.p12 -k build.keychain -P $MACOS_APPLICATION_PASS -T /usr/bin/codesign | |
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_KEYCHAIN_PASS build.keychain | |
codesign --options runtime --force --verify --verbose --timestamp \ | |
--identifier "${{ env.TBN_BUNDLE_ID_BASE }}.${{ env.TBN_FILENAME }}" \ | |
--sign "Developer ID Application: $MACOS_APPLICATION_ID" "${GITHUB_WORKSPACE}/target/${{ matrix.builds.target }}/release/tari-lp-cli" | |
codesign --verify --deep --display --verbose=4 "${GITHUB_WORKSPACE}/target/${{ matrix.builds.target }}/release/tari-lp-cli" | |
- name: Archive and Checksum Binaries | |
shell: bash | |
run: | | |
# set -xo pipefail | |
echo "Archive ${{ env.SHORT_FILENAME }} too ${{ env.BINFILE }}.zip" | |
mkdir -vp "${GITHUB_WORKSPACE}/dist/" | |
cd "${GITHUB_WORKSPACE}/dist/" | |
cp -v "${GITHUB_WORKSPACE}/target/${{ matrix.builds.target }}/release/tari-lp-cli${{ env.TBN_EXT }}" "${{ env.SHORT_FILENAME }}" | |
chmod +x "${{ env.SHORT_FILENAME }}" | |
echo "Compute files shasum" | |
${SHARUN} * >> "${{ env.SHORT_FILENAME }}.sha256" | |
echo "Show the shasum" | |
cat "${{ env.SHORT_FILENAME }}.sha256" | |
echo "Checksum verification for files is " | |
${SHARUN} --check "${{ env.SHORT_FILENAME }}.sha256" | |
# Move files into archive | |
7z a -sdel "${{ env.BINFILE }}.zip" * | |
echo "Compute archive shasum" | |
${SHARUN} "${{ env.BINFILE }}.zip" >> "${{ env.BINFILE }}.zip.sha256" | |
echo "Show the shasum" | |
cat "${{ env.BINFILE }}.zip.sha256" | |
echo "Checksum verification archive is " | |
${SHARUN} --check "${{ env.BINFILE }}.zip.sha256" | |
ls -alhtR | |
- name: Artifact upload for Archive | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ env.BINFILE }}" | |
path: ${{ github.workspace }}/dist/ | |
create-release: | |
runs-on: ubuntu-latest | |
needs: builds | |
env: | |
LAUNCHPAD_VERSION: ${{ needs.builds.outputs.LAUNCHPAD_VERSION }} | |
TARI_NETWORK_DIR: ${{ needs.builds.outputs.TARI_NETWORK_DIR }} | |
TARI_NETWORK_VERSION: ${{ needs.builds.outputs.TARI_NETWORK_VERSION }} | |
BINFILE: ${{ needs.builds.outputs.BINFILE }} | |
steps: | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
path: ${{ env.TBN_FILENAME }} | |
pattern: "${{ env.TBN_FILENAME }}*" | |
merge-multiple: true | |
- name: Verify checksums and Prep Uploads | |
continue-on-error: true | |
shell: bash | |
working-directory: ${{ env.TBN_FILENAME }} | |
run: | | |
# set -xo pipefail | |
sudo apt-get update | |
sudo apt-get --no-install-recommends --assume-yes install dos2unix | |
CHECHSUM_FN="${{ env.TBN_FILENAME }}-${{ env.LAUNCHPAD_VERSION }}-${{ env.TARI_NETWORK_VERSION }}.sha256-unsigned.txt" | |
echo "With checksum file ${CHECHSUM_FN}" | |
ls -alhtR | |
if [ -f "${CHECHSUM_FN}" ] ; then | |
rm -fv "${CHECHSUM_FN}" | |
fi | |
# Merge all sha256 files into one | |
find . -name "*.sha256" -type f -print | xargs cat >> "${CHECHSUM_FN}" | |
# Clean up file - CR/LF | |
dos2unix --quiet "${CHECHSUM_FN}" | |
cat "${CHECHSUM_FN}" | |
sha256sum --ignore-missing --check "${CHECHSUM_FN}" | |
ls -alhtR | |
- name: Create release | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "tari_*/**/*" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
prerelease: true | |
draft: true | |
allowUpdates: true | |
updateOnlyUnreleased: true | |
replacesArtifacts: true | |
- name: Sync assets to S3 | |
continue-on-error: true # Don't break if s3 upload fails | |
if: ${{ env.AWS_SECRET_ACCESS_KEY != '' && matrix.builds.runs-on != 'self-hosted' }} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
S3CMD: "cp" | |
S3OPTIONS: '--recursive --include "*"' | |
shell: bash | |
working-directory: ${{ env.TBN_FILENAME }} | |
run: | | |
echo "Upload processing ..." | |
ls -alhtR | |
echo "Clean up" | |
# Bash check if file with wildcards, does not work as expected | |
# if [ -f ${{ env.TBN_FILENAME }}*diag-utils* ] ; then | |
if ls ${{ env.TBN_FILENAME }}*diag-utils* > /dev/null 2>&1 ; then | |
rm -fv ${{ env.TBN_FILENAME }}*diag-utils* | |
fi | |
echo "Folder setup" | |
if ls ${{ env.TBN_FILENAME }}*linux* > /dev/null 2>&1 ; then | |
mkdir -p "linux/${{ env.TARI_NETWORK_DIR }}/" | |
mv -v ${{ env.TBN_FILENAME }}*linux* "linux/${{ env.TARI_NETWORK_DIR }}/" | |
fi | |
if ls ${{ env.TBN_FILENAME }}*macos* > /dev/null 2>&1 ; then | |
mkdir -p "osx/${{ env.TARI_NETWORK_DIR }}/" | |
mv -v ${{ env.TBN_FILENAME }}*macos* "osx/${{ env.TARI_NETWORK_DIR }}/" | |
fi | |
if ls ${{ env.TBN_FILENAME }}*windows* > /dev/null 2>&1 ; then | |
mkdir -p "windows/${{ env.TARI_NETWORK_DIR }}/" | |
mv -v ${{ env.TBN_FILENAME }}*windows* "windows/${{ env.TARI_NETWORK_DIR }}/" | |
fi | |
ls -alhtR | |
aws --version | |
echo "ls current" | |
aws s3 ls --region ${{ secrets.AWS_REGION }} \ | |
s3://${{ secrets.AWS_S3_BUCKET }}/launchpad/current/ | |
echo "Upload current" | |
aws s3 ${{ env.S3CMD }} --region ${{ secrets.AWS_REGION }} \ | |
. \ | |
s3://${{ secrets.AWS_S3_BUCKET }}/launchpad/current/ \ | |
${{ env.S3OPTIONS }} |