-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
152 additions
and
66 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,94 @@ | ||
name: Format, clippy, and test dlcdevkit | ||
# | ||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
clippy_check: | ||
clippy: | ||
name: clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Protoc | ||
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
components: clippy | ||
override: true | ||
toolchain: nightly | ||
components: clippy | ||
override: true | ||
- name: Check clippy | ||
run: cargo clippy -- -D warnings | ||
fmt_check: | ||
format: | ||
name: format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Protoc | ||
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
components: rustfmt | ||
override: true | ||
toolchain: nightly | ||
components: rustfmt | ||
override: true | ||
- name: Check format | ||
run: cargo fmt --check | ||
|
||
# test: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v2 | ||
# | ||
# - name: Install just | ||
# uses: extractions/setup-just@v1 | ||
# | ||
# - name: Install Protoc | ||
# run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | ||
# | ||
# - uses: actions-rs/toolchain@v1 | ||
# with: | ||
# toolchain: stable | ||
# | ||
# - name: Start dependencies | ||
# run: just ci-deps | ||
# | ||
# - name: Setup Bitcoin Node | ||
# run: | | ||
# docker logs bitcoin | ||
# chmod +x ./testconfig/scripts/setup-bitcoind.sh | ||
# ./testconfig/scripts/setup-bitcoind.sh | ||
# | ||
# - name: Run tests | ||
# run: cargo test --all-features --verbose | ||
# | ||
# - name: Stop dependencies | ||
# run: just deps-down | ||
integration_tests_prepare: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- name: Install Protoc | ||
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
components: rustfmt | ||
override: true | ||
- uses: actions/cache@v3 | ||
env: | ||
cache-name: test-cache | ||
with: | ||
path: target/debug/deps | ||
key: test-cache-${{ github.run_id }}-${{ github.run_number }} | ||
- uses: actions/checkout@v4 | ||
- id: set-matrix | ||
run: cargo test --no-run && echo "::set-output name=matrix::$(testconfig/scripts/get_test_list.sh manager_execution manager_tests contract_updater)" | ||
integration_tests: | ||
name: integration tests | ||
needs: integration_tests_prepare | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
strategy: | ||
matrix: | ||
tests: ${{ fromJson(needs.integration_tests_prepare.outputs.matrix) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/cache@v3 | ||
env: | ||
cache-name: test-cache | ||
with: | ||
path: target/debug/deps | ||
key: test-cache-${{ github.run_id }}-${{ github.run_number }} | ||
- name: Debug file location | ||
run: | | ||
ls -la ./testconfig/scripts/ | ||
pwd | ||
- name: Start bitcoin node | ||
run: docker compose up -d | ||
- name: Wait for container to run | ||
run: | | ||
chmod +x ./testconfig/scripts/wait_for_container.sh | ||
./testconfig/scripts/wait_for_container.sh bitcoin | ||
- name: Wait for electrs to be ready | ||
run: | | ||
chmod +x ./testconfig/scripts/wait_for_electrs.sh | ||
./testconfig/scripts/wait_for_electrs.sh | ||
- name: Run test | ||
run: RUST_BACKTRACE=1 ${{ matrix.tests }} --ignored | ||
- name: Stop bitcoin node | ||
run: docker compose down -v |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
OS=$(uname -s) | ||
|
||
for TEST_PREFIX in "$@"; do | ||
TEST_BIN=$(ls ./target/debug/deps/${TEST_PREFIX}* | grep -v '\.d\|\.o') | ||
|
||
if [ "$OS" = "Darwin" ]; then # macOS | ||
LIST=$(${TEST_BIN} --list --format=terse | sed 's/: test$/,/' | sed "s|\([^,]*\)|\"${TEST_BIN} \1\"|g") | ||
else # Linux | ||
LIST=$(${TEST_BIN} --list --format=terse | sed 's/\: test$/,/' | sed 's@[^[:space:],]\+@"'${TEST_BIN}' &"@g') | ||
fi | ||
|
||
RES+=(${LIST}) | ||
done | ||
|
||
# Use BSD-compatible sed syntax for the final output | ||
echo $(echo [${RES[@]}] | sed 's/,]/]/') |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
while [ "`docker inspect -f {{.State.Status}} $1`" != "running" ]; do | ||
sleep 2; | ||
done | ||
|
||
docker exec bitcoin bitcoin-cli --rpcport=18443 --rpcuser=ddk --rpcpassword=ddk createwallet ddk | ||
docker exec bitcoin bitcoin-cli --rpcport=18443 --rpcuser=ddk --rpcpassword=ddk --rpcwallet=ddk -generate 101 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
until $(curl --output /dev/null --silent --fail http://localhost:30000/blocks/tip/height); do | ||
printf 'waiting for electrs to start' | ||
docker exec bitcoin bitcoin-cli --rpcport=18443 --rpcuser=ddk --rpcpassword=ddk -rpcwallet=ddk getblockcount | ||
docker exec bitcoin bitcoin-cli --rpcport=18443 --rpcuser=ddk --rpcpassword=ddk -rpcwallet=ddk -generate 1 | ||
sleep 5 | ||
done |