ci: read version correctly in Cargo.toml #387
This file contains hidden or 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
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| # Cancel superseded runs on the same PR branch (master runs always finish). | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| CARGO_TERM_COLOR: always | |
| POSTGRES_USER: dlcdevkit | |
| POSTGRES_PASS: dlcdevkit | |
| DATABASE_URL: postgresql://dlcdevkit:dlcdevkit@localhost:5432/postgres | |
| BITCOIND_HOST: http://localhost:18443 | |
| BITCOIND_USER: dlcdevkit | |
| BITCOIND_PASS: dlcdevkit | |
| ESPLORA_HOST: http://localhost:30000 | |
| RPC_WALLET: ddk | |
| NB_CONFIRMATIONS: 6 | |
| jobs: | |
| clippy: | |
| name: clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Protoc | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install 1.89.0 --profile minimal --component clippy | |
| rustup default 1.89.0 | |
| - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: Check clippy | |
| run: cargo clippy -- -D warnings | |
| format: | |
| name: format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install nightly --profile minimal --component rustfmt | |
| rustup default nightly | |
| - name: Check format | |
| run: cargo fmt --check | |
| check: | |
| name: check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Protoc | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install 1.88.0 --profile minimal | |
| rustup default 1.88.0 | |
| - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: cargo check | |
| run: cargo check --all-features | |
| unit-tests: | |
| name: unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Protoc | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install 1.88.0 --profile minimal | |
| rustup default 1.88.0 | |
| - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: Start Docker Compose services | |
| run: docker compose up -d | |
| - name: Wait for Bitcoin container | |
| 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 unit tests | |
| run: cargo test --all-features | |
| - name: Stop Docker Compose services | |
| if: always() | |
| run: docker compose down -v | |
| integration_tests_prepare: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Protoc | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - name: Install Rust | |
| run: | | |
| rustup toolchain install 1.88.0 --profile minimal | |
| rustup default 1.88.0 | |
| # rust-cache is declared first so that its post-step (which prunes target/) | |
| # runs AFTER the run_id cache below saves the freshly compiled test binaries. | |
| - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: Cache compiled test binaries for the matrix jobs | |
| uses: actions/cache@v4 | |
| with: | |
| path: target/debug/deps | |
| key: test-cache-${{ github.run_id }}-${{ github.run_number }} | |
| - id: set-matrix | |
| run: cargo test --no-run --all-features && echo "matrix=$(testconfig/scripts/get_test_list.sh manager_execution manager_tests contract_updater)" >> "$GITHUB_OUTPUT" | |
| 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@v4 | |
| with: | |
| path: target/debug/deps | |
| key: test-cache-${{ github.run_id }}-${{ github.run_number }} | |
| - name: Start bitcoin node | |
| run: docker compose up -d bitcoin electrs | |
| - 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 RUST_MIN_STACK=8388608 ${{ matrix.tests }} --ignored | |
| - name: Stop bitcoin node | |
| run: docker compose down -v | |
| test_splicing: | |
| name: test splicing | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1 | |
| - name: Start bitcoin node | |
| run: docker compose up -d bitcoin electrs | |
| - 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_MIN_STACK=8388608 cargo test -p ddk-manager splice -- --nocapture --ignored | |
| - name: Stop bitcoin node | |
| run: docker compose down -v |