Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #987 from bradlhart/cicd_integration_tests_master
Browse files Browse the repository at this point in the history
Changes to workflows, dockerfile, and script to default branch to add additional integration tests
  • Loading branch information
Brad Hart authored Jul 8, 2021
2 parents c3dd30b + 74e88f0 commit 649f523
Show file tree
Hide file tree
Showing 8 changed files with 685 additions and 234 deletions.
67 changes: 46 additions & 21 deletions .github/eosjs-ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,72 @@
ARG EOSBRANCH=develop
ARG CDTBRANCH=develop
FROM eosio/eosio.cdt:${CDTBRANCH} as contracts
ARG CDTBRANCH
WORKDIR /root
### base
RUN apt-get update \
&& apt-get install -yq curl git

RUN git clone https://github.com/EOSIO/eos \
RUN if [ "$CDTBRANCH" = "release_1.7.x" ]; then \
git clone https://github.com/EOSIO/tropical-example-web-app \
&& mkdir -p /root/contracts/eosio.bios_v1.8.3 && mv ./tropical-example-web-app/eosio/contracts/eosio.bios-v1.8.3/* /root/contracts/eosio.bios_v1.8.3/ \

&& git clone https://github.com/EOSIO/eos \
&& cd eos \
&& git checkout develop
&& git checkout v2.0.12 \
&& mkdir -p /root/contracts/eosio.bios/ && mv ./unittests/contracts/eosio.bios/* /root/contracts/eosio.bios/ \
&& mkdir -p /root/contracts/eosio.system/ && mv ./unittests/contracts/eosio.system/* /root/contracts/eosio.system/ \
&& mkdir -p /root/contracts/eosio.msig/ && mv ./unittests/contracts/eosio.msig/* /root/contracts/eosio.msig/ \
&& mkdir -p /root/contracts/eosio.token/ && mv ./unittests/contracts/eosio.token/* /root/contracts/eosio.token/ \
; fi

RUN git clone https://github.com/EOSIO/eosio.contracts \
&& cd eosio.contracts \
RUN if [ "$CDTBRANCH" = "release_1.8.x" ] || [ "$CDTBRANCH" = "develop" ]; then \
git clone https://github.com/EOSIO/eos \
&& cd eos \
&& git checkout develop \
&& mkdir build && cd build && mkdir eosio.token && cd .. \
&& eosio-cpp -abigen ./contracts/eosio.token/src/eosio.token.cpp -o ./build/eosio.token/eosio.token.wasm -R ./contracts/eosio.token/ricardian/ -I ./contracts/eosio.token/include/
&& mkdir -p /root/contracts/eosio.bios/ && mv ./contracts/contracts/eosio.bios/bin/* /root/contracts/eosio.bios/ \
&& mkdir -p /root/contracts/eosio.boot/ && mv ./contracts/contracts/eosio.boot/bin/* /root/contracts/eosio.boot/ \
&& mkdir -p /root/contracts/eosio.system/ && mv ./unittests/contracts/eosio.system/* /root/contracts/eosio.system/ \
&& mkdir -p /root/contracts/eosio.msig/ && mv ./unittests/contracts/eosio.msig/* /root/contracts/eosio.msig/ \
&& mkdir -p /root/contracts/eosio.token/ && mv ./unittests/contracts/eosio.token/* /root/contracts/eosio.token/ \
; fi

RUN git clone https://github.com/EOSIO/key-value-example-app.git \
RUN if [ "$CDTBRANCH" = "develop" ]; then \
git clone https://github.com/EOSIO/eosio.cdt \
&& cd eosio.cdt \
&& git checkout develop \
&& mkdir -p build/read_only_query_tests/ \
&& eosio-cpp -abigen ./tests/unit/test_contracts/read_only_query_tests.cpp -o ./build/read_only_query_tests/read_only_query_tests.wasm \
&& mkdir -p /root/contracts/read_only_query_tests/ && mv ./build/read_only_query_tests/* /root/contracts/read_only_query_tests/ \
; fi

RUN if [ "$CDTBRANCH" = "release_1.8.x" ] || [ "$CDTBRANCH" = "develop" ]; then \
git clone https://github.com/EOSIO/key-value-example-app.git \
&& cd key-value-example-app \
&& eosio-cpp -abigen ./contracts/kv_todo/src/kv_todo.cpp -o ./contracts/kv_todo/build/kv_todo.wasm -R ./contracts/kv_todo/ricardian/ -I ./contracts/kv_todo/include/
&& eosio-cpp -abigen ./contracts/kv_todo/src/kv_todo.cpp -o ./contracts/kv_todo/build/kv_todo.wasm -R ./contracts/kv_todo/ricardian/ -I ./contracts/kv_todo/include/ \
&& mkdir -p /root/contracts/kv_todo/ && mv ./contracts/kv_todo/build/* /root/contracts/kv_todo/ \
; fi

RUN git clone https://github.com/EOSIO/return-values-example-app.git \
RUN if [ "$CDTBRANCH" = "release_1.8.x" ] || [ "$CDTBRANCH" = "develop" ]; then \
git clone https://github.com/EOSIO/return-values-example-app.git \
&& cd return-values-example-app \
&& eosio-cpp -abigen ./contracts/action_return_value/src/action_return_value.cpp -o ./contracts/action_return_value/build/action_return_value.wasm -R ./contracts/action_return_value/ricardian/
&& eosio-cpp -abigen ./contracts/action_return_value/src/action_return_value.cpp -o ./contracts/action_return_value/build/action_return_value.wasm -R ./contracts/action_return_value/ricardian/ \
&& mkdir -p /root/contracts/action_return_value/ && mv ./contracts/action_return_value/build/* /root/contracts/action_return_value/ \
; fi

RUN mkdir cfhello
COPY ./contracts/cfhello.cpp /root/cfhello
RUN cd cfhello \
&& mkdir build \
&& eosio-cpp -abigen ./cfhello.cpp -o ./build/cfhello.wasm

&& eosio-cpp -abigen ./cfhello.cpp -o ./build/cfhello.wasm \
&& mkdir -p /root/contracts/cfhello/ && mv ./build/* /root/contracts/cfhello/

FROM eosio/eosio:${EOSBRANCH}
ENTRYPOINT ["nodeos", "--data-dir", "/root/.local/share", "-e", "-p", "eosio", "--replay-blockchain", "--plugin", "eosio::producer_plugin", "--plugin", "eosio::chain_api_plugin", "--plugin", "eosio::trace_api_plugin", "--trace-no-abis", "--plugin", "eosio::db_size_api_plugin", "--plugin", "eosio::http_plugin", "--http-server-address=0.0.0.0:8888", "--access-control-allow-origin=*", "--contracts-console", "--http-validate-host=false", "--enable-account-queries=true", "--verbose-http-errors", "--max-transaction-time=100"]
ARG EOSBRANCH
ENTRYPOINT ["nodeos", "--data-dir", "/root/.local/share", "-e", "-p", "eosio", "--replay-blockchain", "--plugin", "eosio::producer_plugin", "--plugin", "eosio::producer_api_plugin", "--plugin", "eosio::chain_api_plugin", "--plugin", "eosio::trace_api_plugin", "--trace-no-abis", "--plugin", "eosio::db_size_api_plugin", "--plugin", "eosio::http_plugin", "--http-server-address=0.0.0.0:8888", "--access-control-allow-origin=*", "--contracts-console", "--http-validate-host=false", "--enable-account-queries=true", "--verbose-http-errors", "--max-transaction-time=100"]
WORKDIR /root
RUN mkdir -p "/opt/eosio/bin/contracts"
COPY --from=contracts /root/eos/contracts/contracts/eosio.bios/bin/* /opt/eosio/bin/contracts/eosio.bios/
COPY --from=contracts /root/eos/contracts/contracts/eosio.boot/bin/* /opt/eosio/bin/contracts/eosio.boot/
COPY --from=contracts /root/eosio.contracts/build/ /opt/eosio/bin/contracts
COPY --from=contracts /root/key-value-example-app/contracts/kv_todo/build/* /opt/eosio/bin/contracts/kv_todo/
COPY --from=contracts /root/return-values-example-app/contracts/action_return_value/build/* /opt/eosio/bin/contracts/action_return_value/
COPY --from=contracts /root/cfhello/build/* /opt/eosio/bin/contracts/cfhello/
COPY --from=contracts /root/contracts /opt/eosio/bin/contracts/
COPY ./ /opt/eosio/bin/

RUN mkdir -p "/opt/eosio/bin/config-dir"
RUN /bin/bash /opt/eosio/bin/scripts/deploy_contracts.sh
RUN /bin/bash /opt/eosio/bin/scripts/deploy_contracts.sh "$EOSBRANCH"
133 changes: 91 additions & 42 deletions .github/eosjs-ci/scripts/deploy_contracts.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
NODEOS_RUNNING=$1
EOS_BRANCH=$1
echo $EOS_BRANCH

set -m

Expand Down Expand Up @@ -109,9 +110,8 @@ mkdir -p $CONFIG_DIR
mkdir -p $BLOCKCHAIN_DATA_DIR
mkdir -p $BLOCKCHAIN_CONFIG_DIR

if [ -z "$NODEOS_RUNNING" ]; then
echo "Starting the chain for setup"
nodeos -e -p eosio \
echo "Starting the chain for setup"
nodeos -e -p eosio \
--data-dir $BLOCKCHAIN_DATA_DIR \
--config-dir $BLOCKCHAIN_CONFIG_DIR \
--http-validate-host=false \
Expand All @@ -127,7 +127,6 @@ if [ -z "$NODEOS_RUNNING" ]; then
--enable-account-queries=true \
--max-transaction-time=100000 \
--verbose-http-errors &
fi

mkdir -p "$CONFIG_DIR"/keys

Expand Down Expand Up @@ -162,25 +161,44 @@ cleos create account eosio eosio.vpay $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.rex $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio eosio.token $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio returnvalue $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio readonly $EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio todo $SYSTEM_ACCOUNT_PUBLIC_KEY
cleos create account eosio bob $EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio alice $EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio bobr1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio alicer1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY
cleos create account eosio cfhello $CFHELLO_PUBLIC_KEY
cleos create account cfhello cfactor $CFACTOR_PUBLIC_KEY

# preactivate concensus upgrades
post_preactivate

sleep 1s
setabi eosio $CONTRACTS_DIR/eosio.boot/eosio.boot.abi
setcode eosio $CONTRACTS_DIR/eosio.boot/eosio.boot.wasm
if [ $EOSBRANCH = "release_2.0.x" ]; then
sleep 1s
setabi eosio $CONTRACTS_DIR/eosio.bios_v1.8.3/eosio.bios.abi
setcode eosio $CONTRACTS_DIR/eosio.bios_v1.8.3/eosio.bios.wasm

sleep 1s
activate_feature "299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707"
activate_feature "825ee6288fb1373eab1b5187ec2f04f6eacb39cb3a97f356a07c91622dd61d16"
activate_feature "c3a6138c5061cf291310887c0b5c71fcaffeab90d5deb50d3b9e687cead45071"
sleep 1s
activate_feature "299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707"

sleep 1s
setabi eosio $CONTRACTS_DIR/eosio.bios/eosio.bios.abi
setcode eosio $CONTRACTS_DIR/eosio.bios/eosio.bios.wasm

sleep 1s
fi

if [ $EOSBRANCH = "release_2.1.x" ] || [ $EOSBRANCH = "develop" ]; then
sleep 1s
setabi eosio $CONTRACTS_DIR/eosio.boot/eosio.boot.abi
setcode eosio $CONTRACTS_DIR/eosio.boot/eosio.boot.wasm

sleep 1s
activate_feature "299dcb6af692324b899b39f16d5a530a33062804e41f09dc97e9f156b4476707"
fi

if [ $EOSBRANCH = "release_2.1.x" ] || [ $EOSBRANCH = "develop" ]; then
activate_feature "825ee6288fb1373eab1b5187ec2f04f6eacb39cb3a97f356a07c91622dd61d16"
activate_feature "c3a6138c5061cf291310887c0b5c71fcaffeab90d5deb50d3b9e687cead45071"
activate_feature "bf61537fd21c61a60e542a5d66c3f6a78da0589336868307f94a82bccea84e88"
activate_feature "5443fcf88330c586bc0e5f3dee10e7f63c76c00249c87fe4fbf7f38c082006b4"
fi
activate_feature "4e7bf348da00a945489b2a681749eb56f5de00b900014e137ddae39f48f69d67"
activate_feature "f0af56d2c5a48d60a4a5b5c903edfb7db3a736a94ed589d0b797df33ff9d3e1d"
activate_feature "2652f5f96006294109b3dd0bbde63693f55324af452b799ee137a81a905eed25"
Expand All @@ -191,49 +209,80 @@ activate_feature "e0fb64b1085cc5538970158d05a009c24e276fb94e1a0bf6a528b48fbc4ff5
activate_feature "ef43112c6543b88db2283a2e077278c315ae2c84719a8b25f25cc88565fbea99"
activate_feature "4a90c00d55454dc5b059055ca213579c6ea856967712a56017487886a4d4cc0f"
activate_feature "1a99a59d87e06e09ec5b028a9cbb7749b4a5ad8819004365d02dc4379a8b7241"
activate_feature "bf61537fd21c61a60e542a5d66c3f6a78da0589336868307f94a82bccea84e88"
activate_feature "5443fcf88330c586bc0e5f3dee10e7f63c76c00249c87fe4fbf7f38c082006b4"
if [ $EOSBRANCH = "develop" ]; then
activate_feature "808c49387292c34ccb3970e00b08a690b6b3370c1cbcec46d46c19d5dfafab03"
fi

sleep 1s
setabi eosio $CONTRACTS_DIR/eosio.bios/eosio.bios.abi
setcode eosio $CONTRACTS_DIR/eosio.bios/eosio.bios.wasm
if [ $EOSBRANCH = "release_2.1.x" ] || [ $EOSBRANCH = "develop" ]; then
sleep 1s
setabi eosio $CONTRACTS_DIR/eosio.bios/eosio.bios.abi
setcode eosio $CONTRACTS_DIR/eosio.bios/eosio.bios.wasm

sleep 1s
cleos push action eosio setkvparams '[{"max_key_size":1024, "max_value_size":4096, "max_iterators":1024}]' -p eosio@active
cleos push action eosio setpparams '["01110000400100000000"]' -p eosio@active
sleep 1s
cleos push action eosio setkvparams '[{"max_key_size":1024, "max_value_size":4096, "max_iterators":1024}]' -p eosio@active
cleos push action eosio setpparams '["01110000400100000000"]' -p eosio@active

sleep 1s
setabi todo $CONTRACTS_DIR/kv_todo/kv_todo.abi
setcode todo $CONTRACTS_DIR/kv_todo/kv_todo.wasm

sleep 1s
setabi returnvalue $CONTRACTS_DIR/action_return_value/action_return_value.abi
setcode returnvalue $CONTRACTS_DIR/action_return_value/action_return_value.wasm
fi

sleep 1s
setabi cfhello $CONTRACTS_DIR/cfhello/cfhello.abi
setcode cfhello $CONTRACTS_DIR/cfhello/cfhello.wasm

if [ $EOSBRANCH = "develop" ]; then
sleep 1s
setabi readonly $CONTRACTS_DIR/read_only_query_tests/read_only_query_tests.abi
setcode readonly $CONTRACTS_DIR/read_only_query_tests/read_only_query_tests.wasm
fi

sleep 1s
setabi todo $CONTRACTS_DIR/kv_todo/kv_todo.abi
setcode todo $CONTRACTS_DIR/kv_todo/kv_todo.wasm
setabi eosio.msig $CONTRACTS_DIR/eosio.msig/eosio.msig.abi
setcode eosio.msig $CONTRACTS_DIR/eosio.msig/eosio.msig.wasm

sleep 1s
setabi returnvalue $CONTRACTS_DIR/action_return_value/action_return_value.abi
setcode returnvalue $CONTRACTS_DIR/action_return_value/action_return_value.wasm
setabi eosio $CONTRACTS_DIR/eosio.system/eosio.system.abi
setcode eosio $CONTRACTS_DIR/eosio.system/eosio.system.wasm

sleep 1s
setabi eosio.token $CONTRACTS_DIR/eosio.token/eosio.token.abi
setcode eosio.token $CONTRACTS_DIR/eosio.token/eosio.token.wasm

sleep 1s
cleos push action eosio.token create '["bob", "10000000000.0000 SYS"]' -p eosio.token
cleos push action eosio.token issue '["bob", "5000000000.0000 SYS", "Half of available supply"]' -p bob
cleos push action eosio.token transfer '["bob", "alice", "1000000.0000 SYS", "memo"]' -p bob
cleos push action eosio.token transfer '["bob", "bobr1", "1000000.0000 SYS", "memo"]' -p bob
cleos push action eosio.token transfer '["bob", "alicer1", "1000000.0000 SYS", "memo"]' -p bob
cleos push action eosio.token create '["eosio", "10000000000.0000 SYS"]' -p eosio.token
cleos push action eosio.token issue '["eosio", "5000000000.0000 SYS", "Half of available supply"]' -p eosio

cleos push action todo upsert '["bf581bee-9f2c-447b-94ad-78e4984b6f51", "todo", "Write Hello World Contract", false]' -p todo@active
cleos push action todo upsert '["b7b0d09d-a82b-44d9-b067-3bae2d02917e", "todo", "Start Blockchain", false]' -p todo@active
cleos push action todo upsert '["ac8acfe7-cd4e-4d22-8400-218b697a4517", "todo", "Deploy Hello World Contract", false]' -p todo@active
cleos push action eosio init '["0", "4,SYS"]' -p eosio@active

echo "All done initializing the blockchain"
cleos system newaccount eosio --transfer bob $EXAMPLE_ACCOUNT_PUBLIC_KEY --stake-net "10000.0000 SYS" --stake-cpu "10000.0000 SYS" --buy-ram-kbytes 8192
cleos system newaccount eosio --transfer alice $EXAMPLE_ACCOUNT_PUBLIC_KEY --stake-net "10000.0000 SYS" --stake-cpu "10000.0000 SYS" --buy-ram-kbytes 8192
cleos system newaccount eosio --transfer bobr1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY --stake-net "10000.0000 SYS" --stake-cpu "10000.0000 SYS" --buy-ram-kbytes 8192
cleos system newaccount eosio --transfer alicer1 $R1_EXAMPLE_ACCOUNT_PUBLIC_KEY --stake-net "10000.0000 SYS" --stake-cpu "10000.0000 SYS" --buy-ram-kbytes 8192

sleep 1s
cleos push action eosio.token transfer '["eosio", "bob", "1000.0000 SYS", "memo"]' -p eosio
cleos push action eosio.token transfer '["eosio", "alice", "1000.0000 SYS", "memo"]' -p eosio
cleos push action eosio.token transfer '["eosio", "bobr1", "1000.0000 SYS", "memo"]' -p eosio
cleos push action eosio.token transfer '["eosio", "alicer1", "1000.0000 SYS", "memo"]' -p eosio

if [ $EOSBRANCH = "release_2.1.x" ] || [ $EOSBRANCH = "develop" ]; then
cleos push action todo upsert '["bf581bee-9f2c-447b-94ad-78e4984b6f51", "todo", "Write Hello World Contract", false]' -p todo@active
cleos push action todo upsert '["b7b0d09d-a82b-44d9-b067-3bae2d02917e", "todo", "Start Blockchain", false]' -p todo@active
cleos push action todo upsert '["ac8acfe7-cd4e-4d22-8400-218b697a4517", "todo", "Deploy Hello World Contract", false]' -p todo@active
fi

if [[ -z $NODEOS_RUNNING ]]; then
echo "Shut down Nodeos, sleeping for 2 seconds to allow time for at least 4 blocks to be created after deploying contracts"
sleep 2s
kill %1
fg %1
if [ $EOSBRANCH = "develop" ]; then
cleos push action readonly setup '[]' -p readonly@active
fi

echo "All done initializing the blockchain"

echo "Shut down Nodeos, sleeping for 2 seconds to allow time for at least 4 blocks to be created after deploying contracts"
sleep 2s
kill %1
fg %1
35 changes: 0 additions & 35 deletions .github/workflows/build-docker-develop.yml

This file was deleted.

Loading

0 comments on commit 649f523

Please sign in to comment.