use artifacts to speed up detector tests

pull/1799/head
alpharush 2 years ago
parent f460d1e07b
commit 9a062453b7
  1. 30
      .github/actions/upload-coverage/action.yml
  2. 107
      .github/workflows/test.yml
  3. BIN
      tests/e2e/detectors/test_data/abiencoderv2-array/0.4.25/storage_ABIEncoderV2_array.sol-0.4.25.zip
  4. BIN
      tests/e2e/detectors/test_data/abiencoderv2-array/0.5.10/storage_ABIEncoderV2_array.sol-0.5.10.zip
  5. BIN
      tests/e2e/detectors/test_data/abiencoderv2-array/0.5.9/storage_ABIEncoderV2_array.sol-0.5.9.zip
  6. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20-permit/0.4.25/arbitrary_send_erc20_permit.sol-0.4.25.zip
  7. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20-permit/0.5.16/arbitrary_send_erc20_permit.sol-0.5.16.zip
  8. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20-permit/0.6.11/arbitrary_send_erc20_permit.sol-0.6.11.zip
  9. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20-permit/0.7.6/arbitrary_send_erc20_permit.sol-0.7.6.zip
  10. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20-permit/0.8.0/arbitrary_send_erc20_permit.sol-0.8.0.zip
  11. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20/0.4.25/arbitrary_send_erc20.sol-0.4.25.zip
  12. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20/0.5.16/arbitrary_send_erc20.sol-0.5.16.zip
  13. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20/0.6.11/arbitrary_send_erc20.sol-0.6.11.zip
  14. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20/0.7.6/arbitrary_send_erc20.sol-0.7.6.zip
  15. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20.sol-0.8.0.zip
  16. BIN
      tests/e2e/detectors/test_data/arbitrary-send-erc20/0.8.0/arbitrary_send_erc20_inheritance.sol-0.8.0.zip
  17. BIN
      tests/e2e/detectors/test_data/arbitrary-send-eth/0.4.25/arbitrary_send_eth.sol-0.4.25.zip
  18. BIN
      tests/e2e/detectors/test_data/arbitrary-send-eth/0.5.16/arbitrary_send_eth.sol-0.5.16.zip
  19. BIN
      tests/e2e/detectors/test_data/arbitrary-send-eth/0.6.11/arbitrary_send_eth.sol-0.6.11.zip
  20. BIN
      tests/e2e/detectors/test_data/arbitrary-send-eth/0.7.6/arbitrary_send_eth.sol-0.7.6.zip
  21. BIN
      tests/e2e/detectors/test_data/array-by-reference/0.4.25/array_by_reference.sol-0.4.25.zip
  22. BIN
      tests/e2e/detectors/test_data/array-by-reference/0.5.16/array_by_reference.sol-0.5.16.zip
  23. BIN
      tests/e2e/detectors/test_data/array-by-reference/0.6.11/array_by_reference.sol-0.6.11.zip
  24. BIN
      tests/e2e/detectors/test_data/array-by-reference/0.7.6/array_by_reference.sol-0.7.6.zip
  25. BIN
      tests/e2e/detectors/test_data/assembly/0.4.25/inline_assembly_contract.sol-0.4.25.zip
  26. BIN
      tests/e2e/detectors/test_data/assembly/0.4.25/inline_assembly_library.sol-0.4.25.zip
  27. BIN
      tests/e2e/detectors/test_data/assembly/0.5.16/inline_assembly_contract.sol-0.5.16.zip
  28. BIN
      tests/e2e/detectors/test_data/assembly/0.5.16/inline_assembly_library.sol-0.5.16.zip
  29. BIN
      tests/e2e/detectors/test_data/assembly/0.6.11/inline_assembly_contract.sol-0.6.11.zip
  30. BIN
      tests/e2e/detectors/test_data/assembly/0.6.11/inline_assembly_library.sol-0.6.11.zip
  31. BIN
      tests/e2e/detectors/test_data/assembly/0.7.6/inline_assembly_contract.sol-0.7.6.zip
  32. BIN
      tests/e2e/detectors/test_data/assembly/0.7.6/inline_assembly_library.sol-0.7.6.zip
  33. BIN
      tests/e2e/detectors/test_data/assert-state-change/0.4.25/assert_state_change.sol-0.4.25.zip
  34. BIN
      tests/e2e/detectors/test_data/assert-state-change/0.5.16/assert_state_change.sol-0.5.16.zip
  35. BIN
      tests/e2e/detectors/test_data/assert-state-change/0.6.11/assert_state_change.sol-0.6.11.zip
  36. BIN
      tests/e2e/detectors/test_data/assert-state-change/0.7.6/assert_state_change.sol-0.7.6.zip
  37. BIN
      tests/e2e/detectors/test_data/backdoor/0.4.25/backdoor.sol-0.4.25.zip
  38. BIN
      tests/e2e/detectors/test_data/backdoor/0.5.16/backdoor.sol-0.5.16.zip
  39. BIN
      tests/e2e/detectors/test_data/backdoor/0.6.11/backdoor.sol-0.6.11.zip
  40. BIN
      tests/e2e/detectors/test_data/backdoor/0.7.6/backdoor.sol-0.7.6.zip
  41. BIN
      tests/e2e/detectors/test_data/boolean-cst/0.4.25/boolean-constant-misuse.sol-0.4.25.zip
  42. BIN
      tests/e2e/detectors/test_data/boolean-cst/0.5.16/boolean-constant-misuse.sol-0.5.16.zip
  43. BIN
      tests/e2e/detectors/test_data/boolean-cst/0.6.11/boolean-constant-misuse.sol-0.6.11.zip
  44. BIN
      tests/e2e/detectors/test_data/boolean-cst/0.7.6/boolean-constant-misuse.sol-0.7.6.zip
  45. BIN
      tests/e2e/detectors/test_data/boolean-equal/0.4.25/boolean-constant-equality.sol-0.4.25.zip
  46. BIN
      tests/e2e/detectors/test_data/boolean-equal/0.5.16/boolean-constant-equality.sol-0.5.16.zip
  47. BIN
      tests/e2e/detectors/test_data/boolean-equal/0.6.11/boolean-constant-equality.sol-0.6.11.zip
  48. BIN
      tests/e2e/detectors/test_data/boolean-equal/0.7.6/boolean-constant-equality.sol-0.7.6.zip
  49. BIN
      tests/e2e/detectors/test_data/calls-loop/0.4.25/multiple_calls_in_loop.sol-0.4.25.zip
  50. BIN
      tests/e2e/detectors/test_data/calls-loop/0.5.16/multiple_calls_in_loop.sol-0.5.16.zip
  51. BIN
      tests/e2e/detectors/test_data/calls-loop/0.6.11/multiple_calls_in_loop.sol-0.6.11.zip
  52. BIN
      tests/e2e/detectors/test_data/calls-loop/0.7.6/multiple_calls_in_loop.sol-0.7.6.zip
  53. BIN
      tests/e2e/detectors/test_data/constable-states/0.4.25/const_state_variables.sol-0.4.25.zip
  54. BIN
      tests/e2e/detectors/test_data/constable-states/0.5.16/const_state_variables.sol-0.5.16.zip
  55. BIN
      tests/e2e/detectors/test_data/constable-states/0.6.11/const_state_variables.sol-0.6.11.zip
  56. BIN
      tests/e2e/detectors/test_data/constable-states/0.7.6/const_state_variables.sol-0.7.6.zip
  57. BIN
      tests/e2e/detectors/test_data/constable-states/0.8.0/const_state_variables.sol-0.8.0.zip
  58. BIN
      tests/e2e/detectors/test_data/constant-function-asm/0.4.25/constant.sol-0.4.25.zip
  59. BIN
      tests/e2e/detectors/test_data/constant-function-asm/0.5.16/constant.sol-0.5.16.zip
  60. BIN
      tests/e2e/detectors/test_data/constant-function-asm/0.6.11/constant.sol-0.6.11.zip
  61. BIN
      tests/e2e/detectors/test_data/constant-function-asm/0.7.6/constant.sol-0.7.6.zip
  62. BIN
      tests/e2e/detectors/test_data/constant-function-state/0.4.25/constant.sol-0.4.25.zip
  63. BIN
      tests/e2e/detectors/test_data/constant-function-state/0.5.16/constant.sol-0.5.16.zip
  64. BIN
      tests/e2e/detectors/test_data/constant-function-state/0.6.11/constant.sol-0.6.11.zip
  65. BIN
      tests/e2e/detectors/test_data/constant-function-state/0.7.6/constant.sol-0.7.6.zip
  66. BIN
      tests/e2e/detectors/test_data/controlled-array-length/0.4.25/array_length_assignment.sol-0.4.25.zip
  67. BIN
      tests/e2e/detectors/test_data/controlled-array-length/0.5.16/array_length_assignment.sol-0.5.16.zip
  68. BIN
      tests/e2e/detectors/test_data/controlled-delegatecall/0.4.25/controlled_delegatecall.sol-0.4.25.zip
  69. BIN
      tests/e2e/detectors/test_data/controlled-delegatecall/0.5.16/controlled_delegatecall.sol-0.5.16.zip
  70. BIN
      tests/e2e/detectors/test_data/controlled-delegatecall/0.6.11/controlled_delegatecall.sol-0.6.11.zip
  71. BIN
      tests/e2e/detectors/test_data/controlled-delegatecall/0.7.6/controlled_delegatecall.sol-0.7.6.zip
  72. BIN
      tests/e2e/detectors/test_data/costly-loop/0.4.25/multiple_costly_operations_in_loop.sol-0.4.25.zip
  73. BIN
      tests/e2e/detectors/test_data/costly-loop/0.5.16/multiple_costly_operations_in_loop.sol-0.5.16.zip
  74. BIN
      tests/e2e/detectors/test_data/costly-loop/0.6.11/multiple_costly_operations_in_loop.sol-0.6.11.zip
  75. BIN
      tests/e2e/detectors/test_data/costly-loop/0.7.6/multiple_costly_operations_in_loop.sol-0.7.6.zip
  76. BIN
      tests/e2e/detectors/test_data/cyclomatic-complexity/0.8.16/HighCyclomaticComplexity.sol-0.8.16.zip
  77. BIN
      tests/e2e/detectors/test_data/cyclomatic-complexity/0.8.16/LowCyclomaticComplexity.sol-0.8.16.zip
  78. BIN
      tests/e2e/detectors/test_data/dead-code/0.8.0/dead-code.sol-0.8.0.zip
  79. BIN
      tests/e2e/detectors/test_data/delegatecall-loop/0.4.25/delegatecall_loop.sol-0.4.25.zip
  80. BIN
      tests/e2e/detectors/test_data/delegatecall-loop/0.5.16/delegatecall_loop.sol-0.5.16.zip
  81. BIN
      tests/e2e/detectors/test_data/delegatecall-loop/0.6.11/delegatecall_loop.sol-0.6.11.zip
  82. BIN
      tests/e2e/detectors/test_data/delegatecall-loop/0.7.6/delegatecall_loop.sol-0.7.6.zip
  83. BIN
      tests/e2e/detectors/test_data/delegatecall-loop/0.8.0/delegatecall_loop.sol-0.8.0.zip
  84. BIN
      tests/e2e/detectors/test_data/deprecated-standards/0.4.25/deprecated_calls.sol-0.4.25.zip
  85. BIN
      tests/e2e/detectors/test_data/divide-before-multiply/0.4.25/divide_before_multiply.sol-0.4.25.zip
  86. BIN
      tests/e2e/detectors/test_data/divide-before-multiply/0.5.16/divide_before_multiply.sol-0.5.16.zip
  87. BIN
      tests/e2e/detectors/test_data/divide-before-multiply/0.6.11/divide_before_multiply.sol-0.6.11.zip
  88. BIN
      tests/e2e/detectors/test_data/divide-before-multiply/0.7.6/divide_before_multiply.sol-0.7.6.zip
  89. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.4.25/permit_domain_collision.sol-0.4.25.zip
  90. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.4.25/permit_domain_state_var_collision.sol-0.4.25.zip
  91. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.4.25/permit_domain_wrong_return_type.sol-0.4.25.zip
  92. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.5.16/permit_domain_collision.sol-0.5.16.zip
  93. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.5.16/permit_domain_state_var_collision.sol-0.5.16.zip
  94. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.5.16/permit_domain_wrong_return_type.sol-0.5.16.zip
  95. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.6.11/permit_domain_collision.sol-0.6.11.zip
  96. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.6.11/permit_domain_state_var_collision.sol-0.6.11.zip
  97. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.6.11/permit_domain_wrong_return_type.sol-0.6.11.zip
  98. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.7.6/permit_domain_collision.sol-0.7.6.zip
  99. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.7.6/permit_domain_state_var_collision.sol-0.7.6.zip
  100. BIN
      tests/e2e/detectors/test_data/domain-separator-collision/0.7.6/permit_domain_wrong_return_type.sol-0.7.6.zip
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,30 @@
# Derived from <https://github.com/pyca/cryptography/blob/SOME_REF/.github/actions/upload-coverage/action.yml>
# Originally authored by the PyCA Cryptography maintainers, and licensed under
# the terms of the BSD license:
# <https://github.com/pyca/cryptography/blob/main/LICENSE.BSD>
name: Upload Coverage
description: Upload coverage files
runs:
using: "composite"
steps:
# FIXME(jl): codecov has the option of including machine information in filename that would solve this unique naming
# issue more completely.
# This method has the limitation of 1 coverage file per run, limiting some coverage between online/offline tests.
- run: |
COVERAGE_UUID=$(python3 -c "import uuid; print(uuid.uuid4())")
echo "COVERAGE_UUID=${COVERAGE_UUID}" >> $GITHUB_OUTPUT
if [ -f .coverage ]; then
mv .coverage .coverage.${COVERAGE_UUID}
fi
id: coverage-uuid
shell: bash
- uses: actions/upload-artifact@v3.1.0
with:
name: coverage-data
path: |
.coverage.*
*.lcov
if-no-files-found: ignore

@ -0,0 +1,107 @@
---
name: Pytest
defaults:
run:
shell: bash
on:
push:
branches: [master, dev]
pull_request:
schedule:
# run CI every day even if no PRs/merges occur
- cron: '0 12 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-2022"]
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install ".[dev]"
solc-select install all
solc-select use 0.8.0
- name: Test detectors
run: |
pytest --cov=slither --cov-append tests/test_detectors.py
python -m coverage report
- name: Test features
run: |
cd tests/test_node_modules/
npm install hardhat
cd ../..
pytest --cov=slither --cov-append tests/test_features.py
pytest --cov=slither --cov-append tests/test_constant_folding.py
pytest --cov=slither --cov-append tests/slithir/test_ternary_expressions.py
pytest --cov=slither --cov-append tests/slithir/test_operation_reads.py
pytest --cov=slither --cov-append tests/test_functions_ids.py
pytest --cov=slither --cov-append tests/test_function.py
pytest --cov=slither --cov-append tests/test_source_mapping.py
pytest --cov=slither --cov-append tests/test_storage_layout.py
python -m coverage report
- name: IR tests
run: |
pytest --cov=slither --cov-append tests/test_ssa_generation.py
python -m coverage report
- name: Test ast parsing
run: |
pytest --cov=slither --cov-append tests/test_ast_parsing.py -n auto
python -m coverage report
- name: Test storage
run: |
npm install --global ganache
pytest --cov=slither --cov-append tests/test_read_storage.py
python -m coverage report
- uses: ./.github/actions/upload-coverage
# only aggregate test coverage over linux-based tests to avoid any OS-specific filesystem information stored in
# coverage metadata.
if: ${{ matrix.os == 'ubuntu-latest' }}
coverage:
needs:
- tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.8
- run: pip install coverage[toml]
- name: download coverage data
uses: actions/download-artifact@v3.0.2
with:
name: coverage-data
- name: combine coverage data
id: combinecoverage
run: |
set +e
python -m coverage combine
echo "## python coverage" >> $GITHUB_STEP_SUMMARY
python -m coverage report -m --format=markdown >> $GITHUB_STEP_SUMMARY

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save