|
|
|
---
|
|
|
|
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 0.8.0
|
|
|
|
solc-select use 0.8.0
|
|
|
|
|
|
|
|
- name: e2e / detectors
|
|
|
|
run: |
|
|
|
|
pytest --cov=slither --cov-append tests/e2e/detectors/test_detectors.py -n auto
|
|
|
|
python -m coverage report
|
|
|
|
|
|
|
|
- name: e2e / ast parsing
|
|
|
|
run: |
|
|
|
|
pytest --cov=slither --cov-append tests/e2e/solc_parsing/test_ast_parsing.py -n auto
|
|
|
|
python -m coverage report
|
|
|
|
|
|
|
|
- name: e2e / compilation
|
|
|
|
run: |
|
|
|
|
pushd tests/e2e/compilation/test_data/test_node_modules/
|
|
|
|
npm install hardhat
|
|
|
|
popd
|
|
|
|
pytest --cov=slither --cov-append tests/e2e/compilation/
|
|
|
|
python -m coverage report
|
|
|
|
|
|
|
|
- name: unit / core, slithir, utils
|
|
|
|
run: |
|
|
|
|
# TODO add back once solc-select issues figured out
|
|
|
|
pytest --cov=slither --cov-append tests/unit/core
|
|
|
|
python -m coverage report
|
|
|
|
|
|
|
|
- name: tools / slither-read-storage
|
|
|
|
run: |
|
|
|
|
npm install --global ganache
|
|
|
|
pytest --cov=slither --cov-append tests/tools/read-storage/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
|