Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/scripts/integration_test_runner.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env bash

# Use UV_RUN if set (for CI), otherwise run directly (for local dev)
RUN="${UV_RUN:-}"

# used to pass --cov=$path and --cov-append to pytest
if [ "$1" != "" ]; then
pytest "$1" tests/e2e/ -n auto
$RUN pytest "$1" tests/e2e/ -n auto
status_code=$?
python -m coverage report
$RUN python -m coverage report
else
pytest tests/e2e/ -n auto
$RUN pytest tests/e2e/ -n auto
status_code=$?
fi

exit "$status_code"
exit "$status_code"
11 changes: 7 additions & 4 deletions .github/scripts/tool_test_runner.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env bash

# Use UV_RUN if set (for CI), otherwise run directly (for local dev)
RUN="${UV_RUN:-}"

# used to pass --cov=$path and --cov-append to pytest
if [ "$1" != "" ]; then
pytest "$1" tests/tools
$RUN pytest "$1" tests/tools
status_code=$?
python -m coverage report
$RUN python -m coverage report
else
pytest tests/tools
$RUN pytest tests/tools
status_code=$?
fi

exit "$status_code"
exit "$status_code"
11 changes: 7 additions & 4 deletions .github/scripts/unit_test_runner.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env bash

# Use UV_RUN if set (for CI), otherwise run directly (for local dev)
RUN="${UV_RUN:-}"

# used to pass --cov=$path and --cov-append to pytest
if [ "$1" != "" ]; then
pytest "$1" tests/unit/ -n auto
$RUN pytest "$1" tests/unit/ -n auto
status_code=$?
python -m coverage report
$RUN python -m coverage report
else
pytest tests/unit/ -n auto
$RUN pytest tests/unit/ -n auto
status_code=$?
fi

exit "$status_code"
exit "$status_code"
36 changes: 25 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,40 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ${{ (github.event_name == 'pull_request' && fromJSON('["ubuntu-latest"]')) || fromJSON('["ubuntu-latest", "windows-2022"]') }}
python: ${{ (github.event_name == 'pull_request' && fromJSON('["3.8", "3.12"]')) || fromJSON('["3.8", "3.9", "3.10", "3.11", "3.12"]') }}
type: ${{ (github.event_name == 'pull_request' && fromJSON('["data_dependency", "path_filtering","erc","find_paths","flat","interface", "printers","slither_config","upgradability"]')) || fromJSON('["data_dependency", "path_filtering","erc","find_paths","flat","interface", "printers","slither_config","upgradability", "cli", "dapp", "etherscan", "kspec", "simil", "truffle"]') }}
os: >-
${{ (github.event_name == 'pull_request' && fromJSON('["ubuntu-latest"]'))
|| fromJSON('["ubuntu-latest", "windows-2025"]') }}
python: >-
${{ (github.event_name == 'pull_request' && fromJSON('["3.9", "3.12"]'))
|| fromJSON('["3.9", "3.10", "3.11", "3.12"]') }}
type: >-
${{ (github.event_name == 'pull_request' &&
fromJSON('["data_dependency", "path_filtering","erc","find_paths","flat","interface",
"printers","slither_config","upgradability"]'))
|| fromJSON('["data_dependency", "path_filtering","erc","find_paths","flat","interface",
"printers","slither_config","upgradability", "cli", "dapp", "etherscan", "kspec",
"simil", "truffle"]') }}
exclude:
# Requires nix
- os: windows-2022
- os: windows-2025
type: dapp
# Requires nvm
- os: windows-2022
- os: windows-2025
type: truffle
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
pip install ".[test]"
solc-select use 0.4.25 --always-install
solc-select use 0.8.0 --always-install
solc-select use 0.5.1 --always-install
pip install uv
uv sync --group dev
uv run solc-select use 0.8.0 --always-install
uv run solc-select use 0.7.0 --always-install
uv run solc-select use 0.5.1 --always-install
uv run solc-select use 0.4.25 --always-install

- name: Set up nix
if: matrix.type == 'dapp'
Expand All @@ -63,5 +75,7 @@ jobs:
PYTHONUTF8: 1
TEST_TYPE: ${{ matrix.type }}
GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }}
# Export UV_RUN to use in scripts
UV_RUN: "uv run"
run: |
bash "scripts/ci_test_${TEST_TYPE}.sh"
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup Pages
uses: actions/configure-pages@v5
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: '3.8'
- run: pip install -e ".[doc]"
- run: pdoc -o html/ slither '!slither.tools' #TODO fix import errors on pdoc run
python-version: '3.9'
- run: |
pip install uv
uv sync --group dev
- run: uv run pdoc -o html/ slither '!slither.tools' # TODO fix import errors on pdoc run
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@v4
with:
# Upload the doc
path: './html/'
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,13 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-2022"]
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
# strange failure
- os: windows-2022
python: 3.8
os: ["ubuntu-latest", "windows-2025"]
python: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}

Expand Down
44 changes: 23 additions & 21 deletions .github/workflows/issue-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,30 @@ jobs:
name: issue metrics
runs-on: ubuntu-latest
steps:
- name: Get dates for last month
shell: bash
run: |
# Calculate the first day of the previous month
first_day=$(date -d "last month" +%Y-%m-01)
- name: Get dates for last month
shell: bash
run: |
# Calculate the first day of the previous month
first_day=$(date -d "last month" +%Y-%m-01)

# Calculate the last day of the previous month
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)
# Calculate the last day of the previous month
last_day=$(date -d "$first_day +1 month -1 day" +%Y-%m-%d)

#Set an environment variable with the date range
echo "$first_day..$last_day"
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"
#Set an environment variable with the date range
echo "$first_day..$last_day"
echo "last_month=$first_day..$last_day" >> "$GITHUB_ENV"

- name: Run issue-metrics tool
uses: github/issue-metrics@v3
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEARCH_QUERY: 'repo:crytic/slither is:issue created:${{ env.last_month }} -reason:"not planned" -reason:"duplicate"'
- name: Run issue-metrics tool
uses: github/issue-metrics@v3
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SEARCH_QUERY: >-
repo:crytic/slither is:issue created:${{ env.last_month }}
-reason:"not planned" -reason:"duplicate"

- name: Create issue
uses: peter-evans/create-issue-from-file@v5
with:
title: Monthly issue metrics report
token: ${{ secrets.GITHUB_TOKEN }}
content-filepath: ./issue_metrics.md
- name: Create issue
uses: peter-evans/create-issue-from-file@v6
with:
title: Monthly issue metrics report
token: ${{ secrets.GITHUB_TOKEN }}
content-filepath: ./issue_metrics.md
11 changes: 6 additions & 5 deletions .github/workflows/pip-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: pip-audit

on:
push:
branches: [ dev, master ]
branches: [dev, master]
pull_request:
branches: [ dev, master ]
schedule: [ cron: "0 7 * * 2" ]
branches: [dev, master]
schedule:
- cron: "0 7 * * 2"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -18,10 +19,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Install Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: "3.10"

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.x'

Expand All @@ -23,7 +23,7 @@ jobs:
python -m pip install build
python -m build
- name: Upload distributions
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: slither-dists
path: dist/
Expand All @@ -38,16 +38,16 @@ jobs:
- build-release
steps:
- name: fetch dists
uses: actions/download-artifact@v4
uses: actions/download-artifact@v5
with:
name: slither-dists
path: dist/

- name: publish
uses: pypa/gh-action-pypi-publish@v1.12.4
uses: pypa/gh-action-pypi-publish@v1.13.0

- name: sign
uses: sigstore/gh-action-sigstore-python@v3.0.0
uses: sigstore/gh-action-sigstore-python@v3.1.0
with:
inputs: ./dist/*.tar.gz ./dist/*.whl
release-signing-artifacts: true
35 changes: 18 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,27 @@ jobs:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-2022"]
os: ["ubuntu-latest", "windows-2025"]
type: ["unit", "integration", "tool"]
python: ${{ (github.event_name == 'pull_request' && fromJSON('["3.8", "3.12"]')) || fromJSON('["3.8", "3.9", "3.10", "3.11", "3.12"]') }}
python: >-
${{ (github.event_name == 'pull_request' && fromJSON('["3.9", "3.12"]'))
|| fromJSON('["3.9", "3.10", "3.11", "3.12"]') }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
cache: "pip"
cache-dependency-path: setup.py

- name: Install dependencies
run: |
pip install ".[test]"
pip install uv
uv sync --group dev

- name: Setup node
uses: actions/setup-node@v4
uses: actions/setup-node@v6
with:
node-version: '16'
node-version: '20'
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

Expand Down Expand Up @@ -81,17 +82,17 @@ jobs:
run: |
if [ ${{ matrix.os }} = "ubuntu-latest" ]; then
TEST_ARGS=(--cov=slither --cov-append)
elif [ ${{ matrix.os }} = "windows-2022" ]; then
elif [ ${{ matrix.os }} = "windows-2025" ]; then
TEST_ARGS=()
fi
bash "./.github/scripts/${TEST_TYPE}_test_runner.sh" "${TEST_ARGS[@]}"
UV_RUN="uv run" bash "./.github/scripts/${TEST_TYPE}_test_runner.sh" "${TEST_ARGS[@]}"


- name: Upload coverage
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' && matrix.python == '3.8' }}
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python == '3.9' }}

coverage:
needs:
Expand All @@ -100,16 +101,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
- uses: actions/checkout@v5
- name: Set up Python 3.9
uses: actions/setup-python@v6
with:
python-version: 3.8
python-version: 3.9

- run: pip install coverage[toml]

- name: download coverage data
uses: actions/download-artifact@v4
uses: actions/download-artifact@v5
with:
pattern: coverage-data-*
merge-multiple: true
Expand Down
3 changes: 3 additions & 0 deletions scripts/ci_test_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### Test

# Source common CI test setup
source "$(dirname "$0")/ci_test_common.sh"

solc-select use 0.7.0

if ! slither "tests/e2e/config/test_json_config/test.sol" --solc-ast --no-fail-pedantic; then
Expand Down
Loading
Loading