Skip to content

Commit

Permalink
TMP
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibo-lg committed Apr 3, 2024
1 parent 573e510 commit fa1db83
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 76 deletions.
153 changes: 77 additions & 76 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,82 +8,82 @@ on:
name: Continuous integration

jobs:
lint:
name: lint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: install clippy
run: rustup component add clippy
- name: Run clippy
run: cargo clippy -- -D warnings
no-std:
name: no-std lint
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: install clippy
run: rustup component add clippy
- name: Run clippy dlc
run: cargo clippy --no-default-features --features no-std -p dlc -- -D warnings
- name: Run clippy dlc-messages
run: cargo clippy --no-default-features --features no-std -p dlc-messages -- -D warnings
- name: Run clippy dlc-trie
run: cargo clippy --no-default-features --features no-std -p dlc-trie -- -D warnings
unit-tests:
name: unit-tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose --all-features

integration_tests_prepare:
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- 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::$(scripts/get_test_list.sh execution manager channel_execution)"
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: Start bitcoin node
run: docker compose up -d
- name: Wait for container to run
run: ./scripts/wait_for_container.sh bitcoin-node
- name: Wait for electrs to be ready
run: ./scripts/wait_for_electrs.sh
- name: Run test
run: RUST_BACKTRACE=1 ${{ matrix.tests }} --ignored
- name: Stop bitcoin node
run: ./scripts/stop_node.sh
# lint:
# name: lint
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v4
# - name: install clippy
# run: rustup component add clippy
# - name: Run clippy
# run: cargo clippy -- -D warnings
# no-std:
# name: no-std lint
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v4
# - name: install clippy
# run: rustup component add clippy
# - name: Run clippy dlc
# run: cargo clippy --no-default-features --features no-std -p dlc -- -D warnings
# - name: Run clippy dlc-messages
# run: cargo clippy --no-default-features --features no-std -p dlc-messages -- -D warnings
# - name: Run clippy dlc-trie
# run: cargo clippy --no-default-features --features no-std -p dlc-trie -- -D warnings
# unit-tests:
# name: unit-tests
# runs-on: ubuntu-latest
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v4
# - name: Build
# run: cargo build --verbose
# - name: Test
# run: cargo test --verbose --all-features
#
# integration_tests_prepare:
# runs-on: ubuntu-latest
# timeout-minutes: 30
# outputs:
# matrix: ${{ steps.set-matrix.outputs.matrix }}
# steps:
# - 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::$(scripts/get_test_list.sh execution manager channel_execution)"
# 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: Start bitcoin node
# run: docker compose up -d
# - name: Wait for container to run
# run: ./scripts/wait_for_container.sh bitcoin-node
# - name: Wait for electrs to be ready
# run: ./scripts/wait_for_electrs.sh
# - name: Run test
# run: RUST_BACKTRACE=1 ${{ matrix.tests }} --ignored
# - name: Stop bitcoin node
# run: ./scripts/stop_node.sh
sample_test:
name: sample-test
runs-on: ubuntu-latest
Expand All @@ -99,6 +99,7 @@ jobs:
- name: Run test
run: |
if ! cargo test -- --ignored sample; then
ls
cat dlc_sample_alice/.dlc/logs/logs.txt
cat dlc_sample_bob/.dlc/logs/logs.txt
fi
4 changes: 4 additions & 0 deletions sample/tests/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ fn sample_cli_test() {
std::fs::write("./bob.yml", bob_config_str).unwrap();

let bin_path = cargo_bin("sample");
println!("{}", bin_path.canonicalize().unwrap().to_str().unwrap());
for d in bin_path.parent().unwrap().read_dir().unwrap() {
println!("{:?}", d.unwrap().path());
}
let mut command = Command::new(bin_path.to_str().unwrap());
command.arg("./alice.yml");
let mut alice_cli = spawn_command(command, Some(5000)).unwrap();
Expand Down

0 comments on commit fa1db83

Please sign in to comment.