Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Nov 4, 2024
0 parents commit 5145f0a
Show file tree
Hide file tree
Showing 12 changed files with 1,220 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[target.'cfg(all())']
rustflags = [
"-Dclippy::all",
"-Dlet_underscore_drop",
"-Aclippy::assertions_on_result_states",
"-Aclippy::let_unit_value",
]
219 changes: 219 additions & 0 deletions .github/workflows/check_lint_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
on: [pull_request, push]

name: Check, Lint, Build

env:
CARGO_TERM_COLOR: always

jobs:
check-lint-build-stable:
name: Check, Lint, Build (ubuntu stable)
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install system deps
run: |
sudo apt-get install automake \
autotools-dev \
bsdmainutils \
build-essential \
libboost-dev \
libevent-dev \
libtool \
pkg-config \
- name: Install latest stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy

- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.1

- name: Rustfmt
run: cargo fmt --all -- --check

- name: Cargo check
run: cargo check

- name: Clippy
run: cargo clippy --all-targets --all-features

- name: Build
run: cargo build --release

- name: 'Set environment variables: version number and output filenames'
run: |
APP_VERSION=$(cargo metadata --format-version 1 | \
jq -er '.packages | map(select(.name == "bip347-enforcer") | .version) | .[0]')
APP_FILENAME="bip347-enforcer-${APP_VERSION}-x86_64-unknown-linux-gnu"
DEMO_FILENAME="gen-demo-tx-${APP_VERSION}-x86_64-unknown-linux-gnu"
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_ENV"
echo "APP_FILENAME=$APP_FILENAME" >> "$GITHUB_ENV"
echo "DEMO_FILENAME=$DEMO_FILENAME" >> "$GITHUB_ENV"
- name: 'Set filenames for release binaries'
run: |
pushd "target/release"
ln -fs "bip347-enforcer" "${APP_FILENAME}"
ln -fs "gen-demo-tx" "${DEMO_FILENAME}"
popd
- name: 'Upload Artifacts'
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_FILENAME }}
if-no-files-found: error
path: |
target/release/${{ env.APP_FILENAME }}
target/release/${{ env.DEMO_FILENAME }}
- name: Release
uses: softprops/action-gh-release@v2.0.2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/release/${{ env.APP_FILENAME }}
target/release/${{ env.DEMO_FILENAME }}
fail_on_unmatched_files: true

build-macos:
name: Build (macos-x86_64)
runs-on: macos-latest
permissions:
contents: write
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install system deps
run: |
brew install automake libtool boost pkg-config libevent
- name: Install latest stable toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.1

- name: Build
run: cargo build --release

- name: 'Set environment variables: version number and output filenames'
run: |
APP_VERSION=$(cargo metadata --format-version 1 | \
jq -er '.packages | map(select(.name == "bip347-enforcer") | .version) | .[0]')
APP_FILENAME="bip347-enforcer-${APP_VERSION}-x86_64-apple-darwin"
DEMO_FILENAME="gen-demo-tx-${APP_VERSION}-x86_64-apple-darwin"
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_ENV"
echo "APP_FILENAME=$APP_FILENAME" >> "$GITHUB_ENV"
echo "DEMO_FILENAME=$DEMO_FILENAME" >> "$GITHUB_ENV"
- name: 'Set filenames for release binaries'
run: |
pushd "target/release"
ln -fs "bip347-enforcer" "${APP_FILENAME}"
ln -fs "gen-demo-tx" "${DEMO_FILENAME}"
popd
- name: 'Upload Artifacts'
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_FILENAME }}
if-no-files-found: error
path: |
target/release/${{ env.APP_FILENAME }}
target/release/${{ env.DEMO_FILENAME }}
- name: Release
uses: softprops/action-gh-release@v2.0.2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/release/${{ env.APP_FILENAME }}
target/release/${{ env.DEMO_FILENAME }}
fail_on_unmatched_files: true

build-windows:
name: Build (x86_64-pc-windows-gnu)
runs-on: ubuntu-latest
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: x86_64-pc-windows-gnu

- name: Install system deps
run: |
sudo apt-get install automake \
autotools-dev \
bsdmainutils \
build-essential \
libboost-dev \
libevent-dev \
libtool \
pkg-config \
- name: Install mingw-w64
run: sudo apt install mingw-w64

- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.1

- name: Build
run: cargo build --release --target x86_64-pc-windows-gnu
env:
RUSTFLAGS: "-C linker=/usr/bin/x86_64-w64-mingw32-gcc"

- name: 'Set environment variables: version number and output filenames'
run: |
APP_VERSION=$(cargo metadata --format-version 1 | \
jq -er '.packages | map(select(.name == "bip347-enforcer") | .version) | .[0]')
APP_FILENAME="bip347-enforcer-${APP_VERSION}-x86_64-pc-windows-gnu.exe"
DEMO_FILENAME="gen-demo-tx-${APP_VERSION}-x86_64-pc-windows-gnu.exe"
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_ENV"
echo "APP_FILENAME=$APP_FILENAME" >> "$GITHUB_ENV"
echo "DEMO_FILENAME=$DEMO_FILENAME" >> "$GITHUB_ENV"
- name: 'Set filenames for release binaries'
run: |
pushd "target/x86_64-pc-windows-gnu/release"
ln -fs "bip347-enforcer.exe" "${APP_FILENAME}"
ln -fs "gen-demo-tx.exe" "${DEMO_FILENAME}"
popd
- name: 'Upload Artifacts'
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_FILENAME }}
if-no-files-found: error
path: |
target/x86_64-pc-windows-gnu/release/${{ env.APP_FILENAME }}
target/x86_64-pc-windows-gnu/release/${{ env.DEMO_FILENAME }}
- name: Release
uses: softprops/action-gh-release@v2.0.2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/x86_64-pc-windows-gnu/release/${{ env.APP_FILENAME }}
target/x86_64-pc-windows-gnu/release/${{ env.DEMO_FILENAME }}
fail_on_unmatched_files: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "depends/bitcoin"]
path = depends/bitcoin
url = https://github.com/0xBEEFCAF3/bitcoin.git
branch = arm/re-enable-opcat
Loading

0 comments on commit 5145f0a

Please sign in to comment.