Skip to content

initial commit

initial commit #1

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