Skip to content

Commit

Permalink
ci: add boot-contracts compilation step
Browse files Browse the repository at this point in the history
  • Loading branch information
csgui committed Jul 1, 2024
1 parent f67ab60 commit e506ce3
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/boot_contracts.yaml
Original file line number Diff line number Diff line change
@@ -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
42 changes: 42 additions & 0 deletions clar2wasm/scripts/boot-contracts-compile.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e506ce3

Please sign in to comment.