Skip to content

Update integration tests, fix some networking bugs #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
[target.'cfg(all())']
rustflags = [
"-Dclippy::all",
"-Dlet_underscore_drop",
"-Aclippy::assertions_on_result_states",
"-Aclippy::let_unit_value",
]

[target.x86_64-unknown-linux-gnu]
rustflags = ["-Zlinker-features=-lld"] # fix nightly bug https://github.com/rust-lang/rust/issues/125321
209 changes: 100 additions & 109 deletions .github/workflows/check_lint_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ env:
CARGO_TERM_COLOR: always

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

- name: Install latest nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -26,161 +22,156 @@ jobs:

- name: Rust Cache
uses: Swatinem/[email protected]
with:
shared-key: x86_64-unknown-linux-gnu

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

- name: Cargo check
run: cargo check
run: cargo check --all-targets --all-features

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

- name: Deny
uses: EmbarkStudios/cargo-deny-action@v2

- name: Build
run: cargo build --release

- name: 'Set environment variables: version number and output filenames'
integration-test:
name: Integration test
runs-on: ubuntu-latest
needs: [check-lint]
steps:
- name: Download latest bitcoin-patched
run: |
THUNDER_APP_VERSION=$(cargo metadata --format-version 1 | \
jq -er '.packages | map(select(.name == "thunder_app") | .version) | .[0]')
THUNDER_APP_FILENAME="thunder-${THUNDER_APP_VERSION}-x86_64-unknown-linux-gnu"
THUNDER_CLI_FILENAME="thunder-cli-${THUNDER_APP_VERSION}-x86_64-unknown-linux-gnu"
echo "THUNDER_APP_VERSION=$THUNDER_APP_VERSION" >> "$GITHUB_ENV"
echo "THUNDER_APP_FILENAME=$THUNDER_APP_FILENAME" >> "$GITHUB_ENV"
echo "THUNDER_CLI_FILENAME=$THUNDER_CLI_FILENAME" >> "$GITHUB_ENV"

pushd ..
wget https://releases.drivechain.info/L1-bitcoin-patched-latest-x86_64-unknown-linux-gnu.zip
unzip L1-bitcoin-patched-latest-x86_64-unknown-linux-gnu.zip
rm L1-bitcoin-patched-latest-x86_64-unknown-linux-gnu.zip
mv L1-bitcoin-patched-latest-x86_64-unknown-linux-gnu bitcoin-patched-bins
chmod +x bitcoin-patched-bins/bitcoind
chmod +x bitcoin-patched-bins/bitcoin-cli
popd

- name: 'Set filenames for release binaries'
- name: Download latest bip300301_enforcer
run: |
pushd "target/release"
ln -fs "thunder_app" "${THUNDER_APP_FILENAME}"
ln -fs "thunder_app_cli" "${THUNDER_CLI_FILENAME}"
pushd ..
wget https://releases.drivechain.info/bip300301-enforcer-latest-x86_64-unknown-linux-gnu.zip
unzip bip300301-enforcer-latest-x86_64-unknown-linux-gnu.zip
rm bip300301-enforcer-latest-x86_64-unknown-linux-gnu.zip
mv bip300301-enforcer-latest-x86_64-unknown-linux-gnu/bip300301_enforcer-*-x86_64-unknown-linux-gnu bip300301-enforcer
rm -r bip300301-enforcer-latest-x86_64-unknown-linux-gnu
chmod +x bip300301-enforcer
popd

- name: 'Upload Artifacts (thunder)'
uses: actions/upload-artifact@v4
with:
name: ${{ env.THUNDER_APP_FILENAME }}
if-no-files-found: error
path: |
target/release/${{ env.THUNDER_APP_FILENAME }}
target/release/${{ env.THUNDER_CLI_FILENAME }}
- name: Checkout electrs
run: |
pushd ..
git clone https://github.com/romanz/electrs.git
popd

- name: Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/release/${{ env.THUNDER_APP_FILENAME }}
target/release/${{ env.THUNDER_CLI_FILENAME }}
fail_on_unmatched_files: true

build-macos:
name: Build (macos-x86_64)
runs-on: macos-latest
permissions:
contents: write
timeout-minutes: 20
# env:
# RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install latest nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
target: x86_64-pc-windows-gnu

- name: Rust Cache
uses: Swatinem/[email protected]

- name: Build
run: cargo build --release

- name: 'Set environment variables: version number and output filenames'
run: |
THUNDER_APP_VERSION=$(cargo metadata --format-version 1 | \
jq -er '.packages | map(select(.name == "thunder_app") | .version) | .[0]')
THUNDER_APP_FILENAME="thunder-${THUNDER_APP_VERSION}-x86_64-apple-darwin"
THUNDER_CLI_FILENAME="thunder-cli-${THUNDER_APP_VERSION}-x86_64-apple-darwin"
echo "THUNDER_APP_VERSION=$THUNDER_APP_VERSION" >> "$GITHUB_ENV"
echo "THUNDER_APP_FILENAME=$THUNDER_APP_FILENAME" >> "$GITHUB_ENV"
echo "THUNDER_CLI_FILENAME=$THUNDER_CLI_FILENAME" >> "$GITHUB_ENV"
- name: Rust Cache (electrs)
uses: Swatinem/rust-cache@v2
with:
prefix-key: "v0-rust-electrs"
workspaces: ../electrs -> target

- name: 'Set filenames for release binaries'
- name: Install electrs
run: |
pushd "target/release"
ln -fs "thunder_app" "${THUNDER_APP_FILENAME}"
ln -fs "thunder_app_cli" "${THUNDER_CLI_FILENAME}"
pushd ../electrs
cargo build --locked --release
popd

- name: 'Upload Artifacts (thunder)'
uses: actions/upload-artifact@v4
- uses: actions/checkout@v4
with:
name: ${{ env.THUNDER_APP_FILENAME }}
if-no-files-found: error
path: |
target/release/${{ env.THUNDER_APP_FILENAME }}
target/release/${{ env.THUNDER_CLI_FILENAME }}
submodules: "recursive"

- name: Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
files: |
target/release/${{ env.THUNDER_APP_FILENAME }}
target/release/${{ env.THUNDER_CLI_FILENAME }}
fail_on_unmatched_files: true
shared-key: x86_64-unknown-linux-gnu

build-windows:
name: Build (x86_64-pc-windows-gnu)
runs-on: ubuntu-latest
- name: Build (debug)
run: cargo build

- name: Run integration tests
id: runIntegrationTests
run: |
export BIP300301_ENFORCER='../bip300301-enforcer'
export BITCOIND='../bitcoin-patched-bins/bitcoind'
export BITCOIN_CLI='../bitcoin-patched-bins/bitcoin-cli'
export ELECTRS='../electrs/target/release/electrs'
export THUNDER_APP='target/debug/thunder_app'
cargo run --example integration_tests

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: Build, Release ((${{ matrix.name }}))
runs-on: ${{ matrix.os }}
permissions:
contents: write
timeout-minutes: 20
# env:
# RUSTFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install latest nightly toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
target: x86_64-pc-windows-gnu

- name: Install mingw-w64
run: sudo apt install mingw-w64
target: ${{ matrix.name }}

- name: Rust Cache
uses: Swatinem/[email protected]
with:
key: ${{ matrix.name }}

- name: Install windows-specific deps
run: sudo apt install mingw-w64
if: ${{ matrix.name == 'x86_64-pc-windows-gnu' }}

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

- name: 'Set environment variables: version number and output filenames'
run: |
THUNDER_APP_VERSION=$(cargo metadata --format-version 1 | \
jq -er '.packages | map(select(.name == "thunder_app") | .version) | .[0]')
THUNDER_APP_FILENAME="thunder-${THUNDER_APP_VERSION}-x86_64-pc-windows-gnu.exe"
THUNDER_CLI_FILENAME="thunder-cli-${THUNDER_APP_VERSION}-x86_64-pc-windows-gnu.exe"
THUNDER_APP_FILENAME="thunder-${THUNDER_APP_VERSION}-${{ matrix.name }}${{ matrix.binary-suffix }}"
THUNDER_CLI_FILENAME="thunder-cli-${THUNDER_APP_VERSION}-${{ matrix.name }}${{ matrix.binary-suffix }}"
echo "THUNDER_APP_VERSION=$THUNDER_APP_VERSION" >> "$GITHUB_ENV"
echo "THUNDER_APP_FILENAME=$THUNDER_APP_FILENAME" >> "$GITHUB_ENV"
echo "THUNDER_CLI_FILENAME=$THUNDER_CLI_FILENAME" >> "$GITHUB_ENV"


- name: 'Set filenames for release binaries'
run: |
pushd "target/x86_64-pc-windows-gnu/release"
ln -fs "thunder_app.exe" "${THUNDER_APP_FILENAME}"
ln -fs "thunder_app_cli.exe" "${THUNDER_CLI_FILENAME}"
pushd "target/${{ matrix.name }}/release/"
ln -fs "thunder_app${{ matrix.binary-suffix }}" "${THUNDER_APP_FILENAME}"
ln -fs "thunder_app_cli${{ matrix.binary-suffix }}" "${THUNDER_CLI_FILENAME}"
popd

- name: 'Upload Artifacts (thunder)'
Expand All @@ -189,22 +180,22 @@ jobs:
name: ${{ env.THUNDER_APP_FILENAME }}
if-no-files-found: error
path: |
target/x86_64-pc-windows-gnu/release/${{ env.THUNDER_APP_FILENAME }}
target/x86_64-pc-windows-gnu/release/${{ env.THUNDER_CLI_FILENAME }}
target/${{ matrix.name }}/release/${{ env.THUNDER_APP_FILENAME }}
target/${{ matrix.name }}/release/${{ env.THUNDER_CLI_FILENAME }}

- name: Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
target/x86_64-pc-windows-gnu/release/${{ env.THUNDER_APP_FILENAME }}
target/x86_64-pc-windows-gnu/release/${{ env.THUNDER_CLI_FILENAME }}
target/${{ matrix.name }}/release/${{ env.THUNDER_APP_FILENAME }}
target/${{ matrix.name }}/release/${{ env.THUNDER_CLI_FILENAME }}
fail_on_unmatched_files: true

upload-releases-to-releases-drivechain-info:
name: Upload releases to releases.drivechain.info
runs-on: ubuntu-latest
needs: [check-lint-build-stable, build-macos, build-windows]
needs: [build-release, integration-test]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download release assets
Expand Down
Loading