Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse external workflows in Fuzzer CI #29

Merged
merged 12 commits into from
Sep 3, 2024
93 changes: 18 additions & 75 deletions .github/workflows/test-fuzzer-ci-still-works.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,88 +10,31 @@ on:
jobs:
build-duckdb:
name: Build DuckDB
runs-on: ubuntu-latest
timeout-minutes: 120
outputs:
duckdb-hash: ${{ steps.find-hash.outputs.hash }}
env:
BUILD_ICU: 1
BUILD_JSON: 1
BUILD_TPCH: 1
BUILD_TPCDS: 1
BUILD_PARQUET: 1
BUILD_JEMALLOC: 1
CRASH_ON_ASSERT: 1
GEN: ninja

steps:
- name: Dependencies
shell: bash
run: sudo apt-get update -y -qq && sudo apt-get install -y -qq ninja-build ccache

- uses: actions/checkout@v3
with:
repository: duckdb/duckdb
fetch-depth: 0

- name: Setup Ccache
uses: hendrikmuhs/ccache-action@main

- id: find-hash
run: echo "::set-output name=hash::$(git rev-parse HEAD)"

- name: create build sqlsmith extension file
shell: bash
run: |
echo "duckdb_extension_load(sqlsmith
GIT_URL https://github.com/duckdb/duckdb_sqlsmith
GIT_TAG main
)" > sqlsmith.cmake

- name: Build
shell: bash
run: |
EXTENSION_CONFIGS="sqlsmith.cmake" make debug

- uses: actions/upload-artifact@v3
with:
name: duckdb
path: build/debug/duckdb
uses: duckdblabs/duckdb-fuzzer-ci/.github/workflows/reusable_workflows/build_fuzzer.yml@main
with:
git_url: ${{ github.actor }}
git_tag: ${{ github.ref_name }}
timeout-minutes: 120

fuzzer:
name: Fuzzer
needs:
- build-duckdb
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
fuzzer: [duckfuzz, sqlsmith, duckfuzz_functions]
data: [emptyalltypes]

steps:
- uses: actions/checkout@v3
with:
path: duckdb_sqlsmith
fetch-depth: 0

- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: duckdb

- name: Fuzz
shell: bash
run: |
chmod +x duckdb
runtime="1 minute"
endtime=$(date -ud "$runtime" +%s)

cd duckdb_sqlsmith
while [[ $(date -u +%s) -le $endtime ]]
do
echo "Time Now: `date +%H:%M:%S`"
python3 scripts/run_fuzzer.py --no_checks --${{ matrix.fuzzer }} --${{ matrix.data }} --shell=../duckdb --dry --max_queries=10
done

enable_verification: [true, false]
exclude:
- enable_verification: true
fuzzer: sqlsmith
- enable_verification: true
fuzzer: duckfuzz_functions
uses: duckdblabs/duckdb-fuzzer-ci/.github/workflows/reusable_workflows/fuzz_duckdb.yml@main
with:
fuzzer: ${{ matrix.fuzzer }}
data: ${{ matrix.data }}
timeout-minutes: 20
max_queries: 10
enable_verification: ${{ matrix.enable_verification }}
10 changes: 5 additions & 5 deletions scripts/run_fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
db = None
shell = None
perform_checks = True
dry = False
no-git-checks = False
max_queries = 1000
verification = False
for param in sys.argv:
Expand All @@ -39,8 +39,8 @@
seed = int(param.replace('--seed=', ''))
elif param.startswith('--max_queries='):
max_queries = int(param.replace('--max_queries=', ''))
elif param.startswith('--dry'):
dry = True
elif param.startswith('--no-git-checks'):
no-git-checks = param.replace('--no-git-checks=', '').lower() == 'true'

if fuzzer is None:
print("Unrecognized fuzzer to run, expected e.g. --sqlsmith or --duckfuzz")
Expand Down Expand Up @@ -103,7 +103,7 @@ def run_shell_command(cmd):

# first get a list of all github issues, and check if we can still reproduce them

if dry:
if no-git-checks:
current_errors = []
else:
current_errors = fuzzer_helper.extract_github_issues(shell, perform_checks)
Expand Down Expand Up @@ -212,5 +212,5 @@ def run_shell_command(cmd):
print(f"{error_msg}")
print(f"================MARKER====================")

if not dry:
if not no-git-checks:
fuzzer_helper.file_issue(cmd, error_msg, fuzzer_name, seed, git_hash)
Loading