From eefa45818b63fbc5f5d93b57d6d3a0a959e5e67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Fri, 19 Jul 2024 16:33:47 +0300 Subject: [PATCH] github: workflow: Add basic workflow file. (#199) * github: workflow: Add basic workflow file. * github: workflow: Update config file. * github: workflow: Remove \. --- .github/workflows/basic.yml | 103 ++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/basic.yml diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml new file mode 100644 index 00000000..a62aeb1c --- /dev/null +++ b/.github/workflows/basic.yml @@ -0,0 +1,103 @@ +name: Basic build and test workflow + +on: + push: + branches: [ "main", "dev" ] + pull_request: + branches: [ "main", "dev" ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build_and_test: + name: Compile and test + + runs-on: ubicloud-standard-4 + + services: + postgres: + image: postgres:latest + env: + POSTGRES_DB: clementine + POSTGRES_USER: clementine + POSTGRES_PASSWORD: clementine + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 50 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Download Bitcoin + run: wget https://bitcoin.org/bin/bitcoin-core-27.0/bitcoin-27.0-x86_64-linux-gnu.tar.gz + - name: Unpack Bitcoin + run: tar -xzvf bitcoin-27.0-x86_64-linux-gnu.tar.gz + + - name: Start Bitcoind + run: bitcoin-27.0/bin/bitcoind -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 -fallbackfee=0.00001 -wallet=admin -txindex=1 & + - name: Create a wallet in Bitcoin regtest + run: bitcoin-27.0/bin/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 createwallet "admin" + - name: Create funds in Bitcoin regtest + run: bitcoin-27.0/bin/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 generatetoaddress 101 $(bitcoin-27.0/bin/bitcoin-cli -regtest -rpcuser=admin -rpcpassword=admin -rpcport=18443 getnewaddress) + + - name: Build + run: RISC0_DEV_MODE=1 cargo build --verbose + + - name: Create config overwrite file + run: | + cat << EOF > /home/runner/overwrite.toml + tracing_debug = "debug,bitcoincore_rpc=info,hyper=error" + host = "127.0.0.1" + port = 3000 + secret_key = "5555555555555555555555555555555555555555555555555555555555555555" + verifiers_public_keys = [ + "4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa", + "466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27", + "3c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1", + "2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991", + "9ac20335eb38768d2052be1dbbc3c8f6178407458e51e6b4ad22f1d91758895b", + ] + db_file_path = "database" + num_verifiers = 4 + min_relay_fee = 305 + user_takes_after = 200 + confirmation_treshold = 1 + network = "regtest" + bitcoin_rpc_url = "http://127.0.0.1:18443" + bitcoin_rpc_user = "admin" + bitcoin_rpc_password = "admin" + all_secret_keys = [ + "1111111111111111111111111111111111111111111111111111111111111111", + "2222222222222222222222222222222222222222222222222222222222222222", + "3333333333333333333333333333333333333333333333333333333333333333", + "4444444444444444444444444444444444444444444444444444444444444444", + "5555555555555555555555555555555555555555555555555555555555555555", + ] + db_host = "127.0.0.1" + db_port = 5432 + db_user = "clementine" + db_password = "clementine" + db_name = "clementine" + citrea_rpc_url = "http://159.89.214.47/" + bridge_contract_address = "3100000000000000000000000000000000000002" + EOF + + - name: Run tests on Bitcoin regtest + run: RISC0_DEV_MODE=1 TEST_CONFIG=/home/runner/overwrite.toml cargo test --verbose --jobs 1 + - name: Run tests on mock RPC + run: RISC0_DEV_MODE=1 TEST_CONFIG=/home/runner/overwrite.toml cargo test --verbose --features mock_rpc