From e506ce3e077d4004c382892857c85b6c10525cb9 Mon Sep 17 00:00:00 2001 From: Chris Guimaraes Date: Fri, 28 Jun 2024 17:24:13 +0100 Subject: [PATCH] ci: add boot-contracts compilation step --- .github/workflows/boot_contracts.yaml | 23 +++++++++++ clar2wasm/scripts/boot-contracts-compile.sh | 42 +++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/boot_contracts.yaml create mode 100644 clar2wasm/scripts/boot-contracts-compile.sh diff --git a/.github/workflows/boot_contracts.yaml b/.github/workflows/boot_contracts.yaml new file mode 100644 index 00000000..a3cc4e50 --- /dev/null +++ b/.github/workflows/boot_contracts.yaml @@ -0,0 +1,23 @@ +name: Boot-contracts Compilation + +on: + push: + branches: [boot-contracts-validation] + +env: + CARGO_TERM_COLOR: always + +jobs: + compile-boot-contracts: + name: Compile boot-contracts + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./clar2wasm + steps: + - name: Checkout PR + uses: actions/checkout@v4 + - name: Compile boot-contracts + run: | + cargo build + bash ./scripts/boot-contracts-compile.sh diff --git a/clar2wasm/scripts/boot-contracts-compile.sh b/clar2wasm/scripts/boot-contracts-compile.sh new file mode 100644 index 00000000..ad5d704b --- /dev/null +++ b/clar2wasm/scripts/boot-contracts-compile.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +BOOT_CONTRACTS_PATH="./tests/contracts/boot-contracts" +CLAR2WASM_PATH="../target/debug/clar2wasm" + +declare -a boot_contracts=( + bns.clar + cost-voting.clar + costs-2-testnet.clar + costs-2.clar + costs-3.clar + costs.clar + genesis.clar + lockup.clar + pox-mainnet-prepared.clar + pox-testnet-prepared.clar + pox-2-mainnet-prepared.clar + pox-2-testnet-prepared.clar + pox-3-mainnet-prepared.clar + pox-3-testnet-prepared.clar + pox-4.clar + signers.clar +) + +cat "${BOOT_CONTRACTS_PATH}/pox-mainnet.clar" "${BOOT_CONTRACTS_PATH}/pox.clar" >> "${BOOT_CONTRACTS_PATH}/pox-mainnet-prepared.clar" +cat "${BOOT_CONTRACTS_PATH}/pox-testnet.clar" "${BOOT_CONTRACTS_PATH}/pox.clar" >> "${BOOT_CONTRACTS_PATH}/pox-testnet-prepared.clar" +cat "${BOOT_CONTRACTS_PATH}/pox-mainnet.clar" "${BOOT_CONTRACTS_PATH}/pox-2.clar" >> "${BOOT_CONTRACTS_PATH}/pox-2-mainnet-prepared.clar" +cat "${BOOT_CONTRACTS_PATH}/pox-testnet.clar" "${BOOT_CONTRACTS_PATH}/pox-2.clar" >> "${BOOT_CONTRACTS_PATH}/pox-2-testnet-prepared.clar" +cat "${BOOT_CONTRACTS_PATH}/pox-mainnet.clar" "${BOOT_CONTRACTS_PATH}/pox-3.clar" >> "${BOOT_CONTRACTS_PATH}/pox-3-mainnet-prepared.clar" +cat "${BOOT_CONTRACTS_PATH}/pox-testnet.clar" "${BOOT_CONTRACTS_PATH}/pox-3.clar" >> "${BOOT_CONTRACTS_PATH}/pox-3-testnet-prepared.clar" + +for contract in ${boot_contracts[@]}; do + echo "Compiling $contract file..." + "${CLAR2WASM_PATH}" "${BOOT_CONTRACTS_PATH}/$contract" + + if [ $? == 0 ]; then + echo "Success" + else + echo "Failure while compiling $contract" + exit 1 + fi +done