Skip to content

Workflow file for this run

on:
push:
branches:
- master
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
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
- name: Check clippy
run: cargo clippy -- -D warnings
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
- name: Check format
run: cargo fmt --check
check:
name: check
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: testdb
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/testdb
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
override: true
- name: Install sqlx-cli
run: cargo install sqlx-cli
- name: Run database migrations
run: cargo sqlx migrate run --source ddk/src/storage/postgres/migrations
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/testdb
- name: cargo check
run: cargo check --all-features
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/testdb
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 --all-features && 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
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: testdb
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
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: Install sqlx-cli
run: cargo install sqlx-cli
- name: Run database migrations
run: cargo sqlx migrate run --source ddk/src/storage/postgres/migrations
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/testdbg
- name: Run test
run: RUST_BACKTRACE=1 ${{ matrix.tests }} --ignored
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/testdb
- name: Stop bitcoin node
run: docker compose down -v