Skip to content

wallet: add balance and list transactions rpc #342

wallet: add balance and list transactions rpc

wallet: add balance and list transactions rpc #342

on: [pull_request, push]
name: Check, Lint, Test, Build, Release
env:
CARGO_TERM_COLOR: always
jobs:
check-lint:
name: Check, Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Check Prettier formatting
uses: actionsx/prettier@v2
with:
args: --check .
- name: Check Rust formatting
run: cargo fmt --all -- --check
- name: Cargo check
run: cargo check
- name: Clippy
run: cargo clippy --all-targets --all-features
test-build-release:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: x86_64-unknown-linux-gnu
binary-suffix: ""
rustflags: ""
- os: macos-latest-large
name: x86_64-apple-darwin
binary-suffix: ""
rustflags: ""
- os: ubuntu-latest
name: x86_64-pc-windows-gnu
binary-suffix: .exe
rustflags: "-C linker=/usr/bin/x86_64-w64-mingw32-gcc"
name: Test, Build, Release (${{ matrix.name }})
runs-on: ${{ matrix.os }}
needs: [check-lint]
permissions:
contents: write
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Install latest stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
target: ${{ matrix.name }}
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.name }}
- name: Install windows-specific deps
run: sudo apt install mingw-w64 nasm
if: ${{ matrix.name == 'x86_64-pc-windows-gnu' }}
- name: Test
run: cargo test --all-targets --all-features
- name: Build
run: cargo build --release --target ${{ matrix.name }}
env:
RUSTFLAGS: ${{ matrix.rustflags }}
- name: "Set environment variables: version number and output filenames"
run: |
APP_VERSION=$(cargo metadata --format-version 1 | \
jq -er '.packages | map(select(.name == "bip300301_enforcer") | .version) | .[0]')
APP_FILENAME="bip300301_enforcer-${APP_VERSION}-${{ matrix.name }}${{ matrix.binary-suffix }}"
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_ENV"
echo "APP_FILENAME=$APP_FILENAME" >> "$GITHUB_ENV"
- run: |
mkdir release
cp target/${{ matrix.name }}/release/bip300301_enforcer${{ matrix.binary-suffix }} release/${{ env.APP_FILENAME }}
- name: "Upload artifacts"
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_FILENAME }}
if-no-files-found: error
path: |
release/${{ env.APP_FILENAME }}
- name: Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
release/${{ env.APP_FILENAME }}
fail_on_unmatched_files: true
upload-releases-to-releases-drivechain-info:
name: Upload releases to releases.drivechain.info
runs-on: ubuntu-latest
needs: [test-build-release]
if: github.ref == 'refs/heads/master'
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create zip files for releases.drivechain.info
run: |
shopt -s extglob
mv bip300301_enforcer-+([0-9]).+([0-9]).+([0-9])-x86_64-apple-darwin bip300301-enforcer-latest-x86_64-apple-darwin
zip -r bip300301-enforcer-latest-x86_64-apple-darwin.zip \
bip300301-enforcer-latest-x86_64-apple-darwin
mv bip300301_enforcer-+([0-9]).+([0-9]).+([0-9])-x86_64-pc-windows-gnu.exe bip300301-enforcer-latest-x86_64-pc-windows-gnu.exe
zip -r bip300301-enforcer-latest-x86_64-pc-windows-gnu.zip \
bip300301-enforcer-latest-x86_64-pc-windows-gnu.exe
mv bip300301_enforcer-+([0-9]).+([0-9]).+([0-9])-x86_64-unknown-linux-gnu bip300301-enforcer-latest-x86_64-unknown-linux-gnu
zip -r bip300301-enforcer-latest-x86_64-unknown-linux-gnu.zip \
bip300301-enforcer-latest-x86_64-unknown-linux-gnu \
- name: Upload release assets to releases.drivechain.info
uses: cross-the-world/ssh-scp-ssh-pipelines@latest
with:
host: 45.33.96.47
user: root
pass: ${{ secrets.RELEASES_SERVER_PW }}
port: 22
scp: |
'bip300301-enforcer-latest-*.zip' => '/var/www/html/'