run tests in parallel, only collect coverage on ubuntu

pull/1799/head
alpharush 2 years ago
parent cf9df6efe4
commit a50588092e
  1. 8
      .github/scripts/integration_test_runner.sh
  2. 4
      .github/scripts/tool_test_runner.sh
  3. 3
      .github/scripts/unit_test_runner.sh
  4. 37
      .github/workflows/test.yml

@ -0,0 +1,8 @@
# setup hardhat for compilation tests
pushd tests/e2e/compilation/test_data/test_node_modules/
npm install hardhat
popd
# used to pass --cov=$path and --cov-append to pytest
pytest $1 tests/e2e/ -n auto
python -m coverage report

@ -0,0 +1,4 @@
npm install --global ganache
# used to pass --cov=$path and --cov-append to pytest
pytest $1 tests/tools/read-storage/test_read_storage.py
python -m coverage report

@ -0,0 +1,3 @@
# used to pass --cov=$path and --cov-append to pytest
pytest $1 tests/unit/
python -m coverage report

@ -24,6 +24,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: ["ubuntu-latest", "windows-2022"] os: ["ubuntu-latest", "windows-2022"]
type: ["unit", "integration", "tool"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python 3.8 - name: Set up Python 3.8
@ -36,34 +37,18 @@ jobs:
solc-select install 0.8.0 solc-select install 0.8.0
solc-select use 0.8.0 solc-select use 0.8.0
- name: e2e / detectors - name: ${{ matrix.type }}
env:
TEST_TYPE: ${{ matrix.type }}
# Only run coverage on ubuntu-latest.
run: | run: |
pytest --cov=slither --cov-append tests/e2e/detectors/test_detectors.py -n auto if [ ${{ matrix.os }} = "ubuntu-latest" ]; then
python -m coverage report TEST_ARGS="--cov=slither --cov-append"
elif [ ${{ matrix.os }} = "windows-2022" ]; then
TEST_ARGS=""
fi
bash "./.github/scripts/${TEST_TYPE}_test_runner.sh"
- 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: |
pytest --cov=slither --cov-append tests/unit/
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 - uses: ./.github/actions/upload-coverage
# only aggregate test coverage over linux-based tests to avoid any OS-specific filesystem information stored in # only aggregate test coverage over linux-based tests to avoid any OS-specific filesystem information stored in

Loading…
Cancel
Save