From 83e165cf8ba1a28582b2d1ff44498dc2deae9e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Tue, 16 Jul 2024 17:18:32 +0300 Subject: [PATCH 1/6] github: Add initial basic workflow. --- .github/workflows/basic.yml | 99 +++++++++++++++++++++++++++++++++++++ 1 file changed, 99 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..9c72011b --- /dev/null +++ b/.github/workflows/basic.yml @@ -0,0 +1,99 @@ +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: + runs-on: ubuntu-latest + + 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@v3 + 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 wallet for 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: | + echo tracing_debug = \"debug,bitcoincore_rpc=info,hyper=error\" > /home/runner/overwrite.toml + echo host = \"127.0.0.1\" >> /home/runner/overwrite.toml + echo port = 3000 >> /home/runner/overwrite.toml + echo secret_key = \"5555555555555555555555555555555555555555555555555555555555555555\" >> /home/runner/overwrite.toml + echo verifiers_public_keys = [ >> /home/runner/overwrite.toml + echo \"4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa\", >> /home/runner/overwrite.toml + echo \"466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27\", >> /home/runner/overwrite.toml + echo \"3c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1\", >> /home/runner/overwrite.toml + echo \"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991\", >> /home/runner/overwrite.toml + echo \"9ac20335eb38768d2052be1dbbc3c8f6178407458e51e6b4ad22f1d91758895b\", >> /home/runner/overwrite.toml + echo ]\ >> /home/runner/overwrite.toml + echo db_file_path = \"database\" >> /home/runner/overwrite.toml + echo num_verifiers = 4 >> /home/runner/overwrite.toml + echo min_relay_fee = 305 >> /home/runner/overwrite.toml + echo user_takes_after = 200 >> /home/runner/overwrite.toml + echo confirmation_treshold = 1 >> /home/runner/overwrite.toml + echo network = \"regtest\" >> /home/runner/overwrite.toml + echo bitcoin_rpc_url = \"http://127.0.0.1:18443\" >> /home/runner/overwrite.toml + echo bitcoin_rpc_user = \"admin\" >> /home/runner/overwrite.toml + echo bitcoin_rpc_password = \"admin\" >> /home/runner/overwrite.toml + echo all_secret_keys = [ >> /home/runner/overwrite.toml + echo \"1111111111111111111111111111111111111111111111111111111111111111\", >> /home/runner/overwrite.toml + echo \"2222222222222222222222222222222222222222222222222222222222222222\", >> /home/runner/overwrite.toml + echo \"3333333333333333333333333333333333333333333333333333333333333333\", >> /home/runner/overwrite.toml + echo \"4444444444444444444444444444444444444444444444444444444444444444\", >> /home/runner/overwrite.toml + echo \"5555555555555555555555555555555555555555555555555555555555555555\", >> /home/runner/overwrite.toml + echo ] >> /home/runner/overwrite.toml + echo db_host = \"127.0.0.1\" >> /home/runner/overwrite.toml + echo db_port = 5432 >> /home/runner/overwrite.toml + echo db_user = \"clementine\" >> /home/runner/overwrite.toml + echo db_password = \"clementine\" >> /home/runner/overwrite.toml + echo db_name = \"clementine\" >> /home/runner/overwrite.toml + echo citrea_rpc_url = \"http://159.89.214.47/\" >> /home/runner/overwrite.toml + echo bridge_contract_address = \"3100000000000000000000000000000000000002\" >> /home/runner/overwrite.toml + + - 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 --features mock_rpc --verbose From 9d56920b39ef5202c5ba32bd6127d2d82672d8af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Tue, 16 Jul 2024 17:23:53 +0300 Subject: [PATCH 2/6] github: workflows: Prettify basic.yml. --- .github/workflows/basic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 9c72011b..e077824d 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -96,4 +96,4 @@ jobs: - 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 --features mock_rpc --verbose + run: RISC0_DEV_MODE=1 TEST_CONFIG=/home/runner/overwrite.toml cargo test --verbose --features mock_rpc From 565677b114c65552e4bed1e2cc6b51fe2239a6f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Tue, 16 Jul 2024 17:28:53 +0300 Subject: [PATCH 3/6] github: workflows: Update cache to v4. --- .github/workflows/basic.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index e077824d..7a1ab642 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -31,7 +31,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: | ~/.cargo/bin/ From 7f2c88aa902d691b1ef52e075ff4c622157ea35d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Tue, 16 Jul 2024 17:36:46 +0300 Subject: [PATCH 4/6] github: workflow: Update some name sections. --- .github/workflows/basic.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 7a1ab642..f41a159a 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -11,6 +11,8 @@ env: jobs: build_and_test: + name: Compile and test + runs-on: ubuntu-latest services: @@ -48,7 +50,7 @@ jobs: - 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 wallet for Bitcoin regtest + - 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) From 1c1d06c9c5ae08f061b30b0d4a2ba8d74c3f4064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Fri, 19 Jul 2024 11:42:36 +0300 Subject: [PATCH 5/6] workflows: basic: Apply review suggestions. --- .github/workflows/basic.yml | 73 +++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index f41a159a..dd102872 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -13,7 +13,7 @@ jobs: build_and_test: name: Compile and test - runs-on: ubuntu-latest + runs-on: ubicloud-standard-4' services: postgres: @@ -60,40 +60,43 @@ jobs: - name: Create config overwrite file run: | - echo tracing_debug = \"debug,bitcoincore_rpc=info,hyper=error\" > /home/runner/overwrite.toml - echo host = \"127.0.0.1\" >> /home/runner/overwrite.toml - echo port = 3000 >> /home/runner/overwrite.toml - echo secret_key = \"5555555555555555555555555555555555555555555555555555555555555555\" >> /home/runner/overwrite.toml - echo verifiers_public_keys = [ >> /home/runner/overwrite.toml - echo \"4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa\", >> /home/runner/overwrite.toml - echo \"466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27\", >> /home/runner/overwrite.toml - echo \"3c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1\", >> /home/runner/overwrite.toml - echo \"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991\", >> /home/runner/overwrite.toml - echo \"9ac20335eb38768d2052be1dbbc3c8f6178407458e51e6b4ad22f1d91758895b\", >> /home/runner/overwrite.toml - echo ]\ >> /home/runner/overwrite.toml - echo db_file_path = \"database\" >> /home/runner/overwrite.toml - echo num_verifiers = 4 >> /home/runner/overwrite.toml - echo min_relay_fee = 305 >> /home/runner/overwrite.toml - echo user_takes_after = 200 >> /home/runner/overwrite.toml - echo confirmation_treshold = 1 >> /home/runner/overwrite.toml - echo network = \"regtest\" >> /home/runner/overwrite.toml - echo bitcoin_rpc_url = \"http://127.0.0.1:18443\" >> /home/runner/overwrite.toml - echo bitcoin_rpc_user = \"admin\" >> /home/runner/overwrite.toml - echo bitcoin_rpc_password = \"admin\" >> /home/runner/overwrite.toml - echo all_secret_keys = [ >> /home/runner/overwrite.toml - echo \"1111111111111111111111111111111111111111111111111111111111111111\", >> /home/runner/overwrite.toml - echo \"2222222222222222222222222222222222222222222222222222222222222222\", >> /home/runner/overwrite.toml - echo \"3333333333333333333333333333333333333333333333333333333333333333\", >> /home/runner/overwrite.toml - echo \"4444444444444444444444444444444444444444444444444444444444444444\", >> /home/runner/overwrite.toml - echo \"5555555555555555555555555555555555555555555555555555555555555555\", >> /home/runner/overwrite.toml - echo ] >> /home/runner/overwrite.toml - echo db_host = \"127.0.0.1\" >> /home/runner/overwrite.toml - echo db_port = 5432 >> /home/runner/overwrite.toml - echo db_user = \"clementine\" >> /home/runner/overwrite.toml - echo db_password = \"clementine\" >> /home/runner/overwrite.toml - echo db_name = \"clementine\" >> /home/runner/overwrite.toml - echo citrea_rpc_url = \"http://159.89.214.47/\" >> /home/runner/overwrite.toml - echo bridge_contract_address = \"3100000000000000000000000000000000000002\" >> /home/runner/overwrite.toml + cat << EOF > /home/runner/overwrite.toml + + tracing_debug = \"debug,bitcoincore_rpc=info,hyper=error\" > /home/runner/overwrite.toml + host = \"127.0.0.1\" >> /home/runner/overwrite.toml + port = 3000 >> /home/runner/overwrite.toml + secret_key = \"5555555555555555555555555555555555555555555555555555555555555555\" >> /home/runner/overwrite.toml + verifiers_public_keys = [ >> /home/runner/overwrite.toml + \"4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa\", >> /home/runner/overwrite.toml + \"466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27\", >> /home/runner/overwrite.toml + \"3c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1\", >> /home/runner/overwrite.toml + \"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991\", >> /home/runner/overwrite.toml + \"9ac20335eb38768d2052be1dbbc3c8f6178407458e51e6b4ad22f1d91758895b\", >> /home/runner/overwrite.toml + ]\ >> /home/runner/overwrite.toml + db_file_path = \"database\" >> /home/runner/overwrite.toml + num_verifiers = 4 >> /home/runner/overwrite.toml + min_relay_fee = 305 >> /home/runner/overwrite.toml + user_takes_after = 200 >> /home/runner/overwrite.toml + confirmation_treshold = 1 >> /home/runner/overwrite.toml + network = \"regtest\" >> /home/runner/overwrite.toml + bitcoin_rpc_url = \"http://127.0.0.1:18443\" >> /home/runner/overwrite.toml + bitcoin_rpc_user = \"admin\" >> /home/runner/overwrite.toml + bitcoin_rpc_password = \"admin\" >> /home/runner/overwrite.toml + all_secret_keys = [ >> /home/runner/overwrite.toml + \"1111111111111111111111111111111111111111111111111111111111111111\", >> /home/runner/overwrite.toml + \"2222222222222222222222222222222222222222222222222222222222222222\", >> /home/runner/overwrite.toml + \"3333333333333333333333333333333333333333333333333333333333333333\", >> /home/runner/overwrite.toml + \"4444444444444444444444444444444444444444444444444444444444444444\", >> /home/runner/overwrite.toml + \"5555555555555555555555555555555555555555555555555555555555555555\", >> /home/runner/overwrite.toml + ] >> /home/runner/overwrite.toml + db_host = \"127.0.0.1\" >> /home/runner/overwrite.toml + db_port = 5432 >> /home/runner/overwrite.toml + db_user = \"clementine\" >> /home/runner/overwrite.toml + db_password = \"clementine\" >> /home/runner/overwrite.toml + db_name = \"clementine\" >> /home/runner/overwrite.toml + citrea_rpc_url = \"http://159.89.214.47/\" >> /home/runner/overwrite.toml + bridge_contract_address = \"3100000000000000000000000000000000000002\" >> /home/runner/overwrite.toml + EOF - name: Run tests on Bitcoin regtest run: RISC0_DEV_MODE=1 TEST_CONFIG=/home/runner/overwrite.toml cargo test --verbose --jobs 1 From 0c4412c98cfe7b1a798d06f919aac29e2b31474b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ceyhun=20=C5=9Een?= Date: Fri, 19 Jul 2024 11:43:26 +0300 Subject: [PATCH 6/6] workflow: basic: Typo fixes. --- .github/workflows/basic.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index dd102872..3656d3cc 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -13,7 +13,7 @@ jobs: build_and_test: name: Compile and test - runs-on: ubicloud-standard-4' + runs-on: ubicloud-standard-4 services: postgres: @@ -61,7 +61,6 @@ jobs: - name: Create config overwrite file run: | cat << EOF > /home/runner/overwrite.toml - tracing_debug = \"debug,bitcoincore_rpc=info,hyper=error\" > /home/runner/overwrite.toml host = \"127.0.0.1\" >> /home/runner/overwrite.toml port = 3000 >> /home/runner/overwrite.toml