Skip to content

Commit

Permalink
Merge pull request #268 from valory-xyz/test/ci
Browse files Browse the repository at this point in the history
Enable tests on CI
  • Loading branch information
Adamantios authored Jun 6, 2024
2 parents cf632cf + 581374e commit c51c7d7
Show file tree
Hide file tree
Showing 12 changed files with 299 additions and 98 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/common_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,102 @@ jobs:
tar -xzf gitleaks_8.10.1_linux_x64.tar.gz && \
sudo install gitleaks /usr/bin && \
gitleaks detect --report-format json --report-path leak_report -v
test:
continue-on-error: True
needs:
- lock_check
- copyright_and_dependencies_check
- linter_checks
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.8", "3.9", "3.10", "3.11" ]

timeout-minutes: 30

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-go@v3
with:
go-version: "1.17.7"
- name: Create decision maker's `store_path` (data folder)
run: mkdir data
- if: matrix.os == 'ubuntu-latest'
name: Install dependencies (ubuntu-latest)
run: |
sudo apt-get update --fix-missing
sudo apt-get autoremove
sudo apt-get autoclean
pip install tomte[tox]==0.2.14
pip install --user --upgrade setuptools
# install Protobuf compiler
wget https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-linux-x86_64.zip
unzip protoc-24.3-linux-x86_64.zip -d protoc
sudo mv protoc/bin/protoc /usr/local/bin/protoc
# install Tendermint
wget -O tendermint.tar.gz https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_linux_amd64.tar.gz
tar -xf tendermint.tar.gz
sudo mv tendermint /usr/local/bin/tendermint
- if: matrix.os == 'ubuntu-latest'
name: Packages unit tests ubuntu-latest
run: |
tox -e py${{ matrix.python-version }}-linux
- if: matrix.os == 'macos-latest'
name: Install dependencies (macos-latest)
run: |
pip install tomte[tox]==0.2.14
brew install gcc
# brew install protobuf
# brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/72457f0166d5619a83f508f2345b22d0617b5021/Formula/protobuf.rb
wget https://github.com/protocolbuffers/protobuf/releases/download/v24.3/protoc-24.3-osx-x86_64.zip
unzip protoc-24.3-osx-x86_64.zip -d protoc
sudo mv protoc/bin/protoc /usr/local/bin/protoc
brew tap yoheimuta/protolint
brew install protolint
- if: matrix.os == 'macos-latest'
name: Packages unit tests macos-latest
run: |
tox -e py${{ matrix.python-version }}-darwin
- if: matrix.os == 'windows-latest'
name: Install dependencies (windows-latest)
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
run: |
python -m pip install -U pip
echo "::add-path::C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64"
choco install wget -y
choco install protoc --version 24.3
choco install mingw -y
choco install make -y
# to check make was installed
make --version
pip install tomte[tox]==0.2.14
- if: matrix.os == 'windows-latest'
name: Packages unit tests windows-latest
run: |
tox -e py${{ matrix.python-version }}-win
- if: matrix.os == 'ubuntu-latest'
name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
2 changes: 1 addition & 1 deletion .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ fc7d0697d1543849b07750430843e6b01426cc7a:packages/valory/services/trader_omen_gn
809a4d8befaf483c8d5d775f3271e7d8601e2985:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:154
ae28aeb8ad56e1873bfb3996c5d5ad8367709cd1:packages/valory/skills/decision_maker_abci/skill.yaml:generic-api-key:186
ae28aeb8ad56e1873bfb3996c5d5ad8367709cd1:packages/valory/skills/trader_abci/skill.yaml:generic-api-key:154

9d8617ddd58c172f8d9dd32a7b74f22aa3d27dfb:packages/valory/skills/mech_interact_abci/skill.yaml:generic-api-key:151
0b4170ce2e876c28a9585081117e6468db17f0b9:packages/valory/services/trader_omen_gnosis/service.yaml:generic-api-key:48
10 changes: 5 additions & 5 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
"contract/valory/transfer_nft_condition/0.1.0": "bafybeihnict3irtvnyxtkwyg6wphe44wz3dogijiha45xrkcrh5ktq2lsi",
"contract/valory/relayer/0.1.0": "bafybeiaabvxim4blp5fxb6qjlzjivtvkme3fk24h5jte7w6vr6rsx72j6u",
"skill/valory/market_manager_abci/0.1.0": "bafybeicbvxvjkoksbknujaid5hx7krjlgm6barcjcwo33tdccanrcp674a",
"skill/valory/decision_maker_abci/0.1.0": "bafybeigli5iwebxbx65h4pwxzbne6rg2nw6v4rnpqoxjfyubuj5ahtylae",
"skill/valory/trader_abci/0.1.0": "bafybeidu22ipsrrvlh5nrlxkoyociysobsg6kwff33x5gootzswivef2ya",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeihg3hdxui25dzoidyqjnvmlxphrsdtasjavvnmapcza7mb6lhxq6q",
"skill/valory/decision_maker_abci/0.1.0": "bafybeifcv22lf2qulw5egxxmbux2dzuqnyeu2cpvwyipptoub5r54zbyc4",
"skill/valory/trader_abci/0.1.0": "bafybeic3bui5ry3i7ekazbcvisf2z7udjwxyywwgv4au6opzzufpwpcvhm",
"skill/valory/tx_settlement_multiplexer_abci/0.1.0": "bafybeic6tizt4rabpntz56evu7jnucvelciehhveh2baaojg7w6xke4ika",
"skill/valory/staking_abci/0.1.0": "bafybeigo7bicej5t2rbki37cmcwkzgwpcnopokn7ijhylmkihsbqw47xr4",
"skill/valory/check_stop_trading_abci/0.1.0": "bafybeickfeuqlpmryegnfvfu2duk2v4ycowwloohu3xxrafd5md6xl5swi",
"agent/valory/trader/0.1.0": "bafybeifo6j5mdnbgljyp3c4o5zzysvmd2aqylmzv3ti3bijoghcwpvcnqi",
"service/valory/trader/0.1.0": "bafybeifne7g3idoct2g2wwfkg4ztqrvjkw7dchm6irze2nqtpn6ruc4dua"
"agent/valory/trader/0.1.0": "bafybeidvindh7eho6wdeoi4ylaqarsputtlvz7ujsros7pgjhoemuhqzy4",
"service/valory/trader/0.1.0": "bafybeiamleh4h26jsce25gc7szoemg7sy65h45bn6ptjq27pxajvpc35pi"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
6 changes: 3 additions & 3 deletions packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ skills:
- valory/reset_pause_abci:0.1.0:bafybeiameewywqigpupy3u2iwnkfczeiiucue74x2l5lbge74rmw6bgaie
- valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq
- valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihg3hdxui25dzoidyqjnvmlxphrsdtasjavvnmapcza7mb6lhxq6q
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeic6tizt4rabpntz56evu7jnucvelciehhveh2baaojg7w6xke4ika
- valory/market_manager_abci:0.1.0:bafybeicbvxvjkoksbknujaid5hx7krjlgm6barcjcwo33tdccanrcp674a
- valory/decision_maker_abci:0.1.0:bafybeigli5iwebxbx65h4pwxzbne6rg2nw6v4rnpqoxjfyubuj5ahtylae
- valory/trader_abci:0.1.0:bafybeidu22ipsrrvlh5nrlxkoyociysobsg6kwff33x5gootzswivef2ya
- valory/decision_maker_abci:0.1.0:bafybeifcv22lf2qulw5egxxmbux2dzuqnyeu2cpvwyipptoub5r54zbyc4
- valory/trader_abci:0.1.0:bafybeic3bui5ry3i7ekazbcvisf2z7udjwxyywwgv4au6opzzufpwpcvhm
- valory/staking_abci:0.1.0:bafybeigo7bicej5t2rbki37cmcwkzgwpcnopokn7ijhylmkihsbqw47xr4
- valory/check_stop_trading_abci:0.1.0:bafybeickfeuqlpmryegnfvfu2duk2v4ycowwloohu3xxrafd5md6xl5swi
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/trader/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeigtuothskwyvrhfosps2bu6suauycolj67dpuxqvnicdrdu7yhtvq
fingerprint_ignore_patterns: []
agent: valory/trader:0.1.0:bafybeifo6j5mdnbgljyp3c4o5zzysvmd2aqylmzv3ti3bijoghcwpvcnqi
agent: valory/trader:0.1.0:bafybeidvindh7eho6wdeoi4ylaqarsputtlvz7ujsros7pgjhoemuhqzy4
number_of_agents: 4
deployment:
agent:
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/decision_maker_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fingerprint:
tests/behaviours/data/.gitkeep: bafybeiekl43sjsyqfgl6y27ve5ydo4svcngrptgtffblokmspfezroxvvi
tests/behaviours/dummy_strategy/__init__.py: bafybeiep5w5yckjzy724v63qd5cmzfn3uxytmnizynomxggfobbysfcttq
tests/behaviours/dummy_strategy/dummy_strategy.py: bafybeig5e3xfr7gxsakfj4stbxqcwdiljl7klvgahkuwe3obzxgkg3qt2e
tests/behaviours/test_base.py: bafybeibz7hljuhrubzpatjblxy7l7araj3tzfwi2sds3qsznshjz5fki54
tests/behaviours/test_base.py: bafybeifuh6qhdksgishs46bwzyoroe3bzd2umaxgz4hwkxmdiebn4zynme
tests/conftest.py: bafybeidy5hw56kw5mxudnfbhvogofn6k4rqb4ux2bd45baedrrhmgyrude
utils/__init__.py: bafybeiazrfg3kwfdl5q45azwz6b6mobqxngxpf4hazmrnkhinpk4qhbbf4
utils/nevermined.py: bafybeigallaqxhqopznhjhefr6bukh4ojkz5vdtqyzod5dksshrf24fjgi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@

settings.load_profile(profile_name)
FRACTION_REMOVAL_PRECISION = 2
PACKAGE_DIR = Path(__file__).parents[2]
CURRENT_FILE_PATH = Path(__file__).resolve()
PACKAGE_DIR = CURRENT_FILE_PATH.parents[2]


@st.composite
Expand Down Expand Up @@ -132,7 +133,9 @@ def test_strategy_exec(
res = behaviour.strategy_exec(strategy_name)
assert res == expected_result

@pytest.mark.parametrize("strategy_path", ("dummy_strategy/dummy_strategy.py",))
@pytest.mark.parametrize(
"strategy_path", (Path("dummy_strategy/dummy_strategy.py"),)
)
@pytest.mark.parametrize(
"args, kwargs, method_name, expected_result",
(
Expand Down Expand Up @@ -167,7 +170,8 @@ def test_execute_strategy(
self.ffw(BlacklistingBehaviour)
behaviour = cast(BlacklistingBehaviour, self.behaviour.current_behaviour)
assert behaviour.behaviour_id == BlacklistingBehaviour.auto_behaviour_id()
with open(strategy_path) as dummy_strategy:
current_dir = CURRENT_FILE_PATH.parent
with open(current_dir / strategy_path) as dummy_strategy:
behaviour.shared_state.strategies_executables["test"] = (
dummy_strategy.read(),
method_name,
Expand Down
4 changes: 2 additions & 2 deletions packages/valory/skills/trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ skills:
- valory/transaction_settlement_abci:0.1.0:bafybeic3tccdjypuge2lewtlgprwkbb53lhgsgn7oiwzyrcrrptrbeyote
- valory/termination_abci:0.1.0:bafybeif2zim2de356eo3sipkmoev5emwadpqqzk3huwqarywh4tmqt3vzq
- valory/market_manager_abci:0.1.0:bafybeicbvxvjkoksbknujaid5hx7krjlgm6barcjcwo33tdccanrcp674a
- valory/decision_maker_abci:0.1.0:bafybeigli5iwebxbx65h4pwxzbne6rg2nw6v4rnpqoxjfyubuj5ahtylae
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeihg3hdxui25dzoidyqjnvmlxphrsdtasjavvnmapcza7mb6lhxq6q
- valory/decision_maker_abci:0.1.0:bafybeifcv22lf2qulw5egxxmbux2dzuqnyeu2cpvwyipptoub5r54zbyc4
- valory/tx_settlement_multiplexer_abci:0.1.0:bafybeic6tizt4rabpntz56evu7jnucvelciehhveh2baaojg7w6xke4ika
- valory/staking_abci:0.1.0:bafybeigo7bicej5t2rbki37cmcwkzgwpcnopokn7ijhylmkihsbqw47xr4
- valory/check_stop_trading_abci:0.1.0:bafybeickfeuqlpmryegnfvfu2duk2v4ycowwloohu3xxrafd5md6xl5swi
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protocols:
- valory/ledger_api:1.0.0:bafybeihdk6psr4guxmbcrc26jr2cbgzpd5aljkqvpwo64bvaz7tdti2oni
skills:
- valory/abstract_round_abci:0.1.0:bafybeiar2yhzxacfe3qqamqhaihtlcimquwedffctw55sowx6rac3cm3ui
- valory/decision_maker_abci:0.1.0:bafybeigli5iwebxbx65h4pwxzbne6rg2nw6v4rnpqoxjfyubuj5ahtylae
- valory/decision_maker_abci:0.1.0:bafybeifcv22lf2qulw5egxxmbux2dzuqnyeu2cpvwyipptoub5r54zbyc4
- valory/staking_abci:0.1.0:bafybeigo7bicej5t2rbki37cmcwkzgwpcnopokn7ijhylmkihsbqw47xr4
- valory/mech_interact_abci:0.1.0:bafybeih2cck5xu6yaibomwtm5zbcp6llghr3ighdnk56fzwu3ihu5xx35e
behaviours:
Expand Down
Loading

0 comments on commit c51c7d7

Please sign in to comment.