[pre-commit.ci] pre-commit autoupdate #1285
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (C) 2023 Roberto Rossini <roberros@uio.no> | |
| # SPDX-License-Identifier: MIT | |
| name: Run fuzzy tests | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - ".github/.codecov.yml" | |
| - ".github/workflows/fuzzy-testing.yml" | |
| - "cmake/**" | |
| - "src/**" | |
| - "test/fuzzer/**" | |
| - "utils/devel/build_dependencies.py" | |
| - "CMakeLists.txt" | |
| - "conanfile.py" | |
| pull_request: | |
| paths: | |
| - ".github/.codecov.yml" | |
| - ".github/workflows/fuzzy-testing.yml" | |
| - "cmake/**" | |
| - "src/**" | |
| - "test/fuzzer/**" | |
| - "utils/devel/build_dependencies.py" | |
| - "CMakeLists.txt" | |
| - "conanfile.py" | |
| schedule: | |
| # Run weekly | |
| - cron: "15 3 * * 0" | |
| workflow_dispatch: | |
| inputs: | |
| duration: | |
| description: "Test duration in seconds" | |
| required: true | |
| default: "600" | |
| type: string | |
| resolution: | |
| description: "Matrix resolution to use for testing" | |
| required: true | |
| default: "random" | |
| type: string | |
| # https://stackoverflow.com/a/72408109 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-deps: | |
| name: Build dependencies | |
| uses: paulsengroup/hictk/.github/workflows/build-conan-deps-linux.yml@40293429314b8a380c0ed0108f60b865ff96609b | |
| with: | |
| build-type: RelWithDebInfo | |
| conan-version: "2.21.*" | |
| cppstd: 17 | |
| image: "ghcr.io/paulsengroup/ci-docker-images/ubuntu-20.04-cxx-clang-21" | |
| ref: main | |
| build-project: | |
| name: Build project | |
| needs: build-deps | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/paulsengroup/ci-docker-images/ubuntu-24.04-cxx-clang-21 | |
| options: "--user=root" | |
| env: | |
| CCACHE_DISABLE: "1" | |
| HICTK_CI: "1" | |
| TMPDIR: "/tmp/" | |
| steps: | |
| - name: Clone hictk | |
| uses: actions/checkout@v5 | |
| - name: Fix permissions | |
| run: chown -R "$(id -u):$(id -g)" "$PWD" | |
| - name: Install Python | |
| run: | | |
| apt-get update | |
| apt-get install -y python3.12 python3.12-dev | |
| - name: Restore cached dependencies | |
| uses: actions/cache/restore@v4 | |
| with: | |
| key: ${{ needs.build-deps.outputs.cache-key }} | |
| path: ${{ needs.build-deps.outputs.tar }} | |
| fail-on-cache-miss: true | |
| - name: Unpack dependencies | |
| run: tar -C "$TMPDIR" -xf '${{ needs.build-deps.outputs.tar }}' | |
| - name: Configure project | |
| run: | | |
| cov_flags='-fprofile-instr-generate -fcoverage-mapping -fcoverage-mcdc' | |
| cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
| -DCMAKE_C_STANDARD=17 \ | |
| -DCMAKE_CXX_STANDARD=17 \ | |
| -DCMAKE_PREFIX_PATH="$TMPDIR/deps/cmake/" \ | |
| -DENABLE_DEVELOPER_MODE=ON \ | |
| -DOPT_ENABLE_INTERPROCEDURAL_OPTIMIZATION=OFF \ | |
| -DOPT_ENABLE_SANITIZER_ADDRESS=OFF \ | |
| -DOPT_ENABLE_SANITIZER_LEAK=OFF \ | |
| -DOPT_ENABLE_SANITIZER_POINTER_COMPARE=OFF \ | |
| -DOPT_ENABLE_SANITIZER_POINTER_SUBTRACT=OFF \ | |
| -DOPT_ENABLE_SANITIZER_UNDEFINED_BEHAVIOR=OFF \ | |
| -DOPT_ENABLE_CPPCHECK=OFF \ | |
| -DOPT_ENABLE_CLANG_TIDY=OFF \ | |
| -DHICTK_ENABLE_TESTING=ON \ | |
| -DHICTK_ENABLE_FUZZY_TESTING=ON \ | |
| -DHICTK_BUILD_EXAMPLES=OFF \ | |
| -DHICTK_DOWNLOAD_TEST_DATASET=OFF \ | |
| -DHICTK_ENABLE_GIT_VERSION_TRACKING=OFF \ | |
| -DCMAKE_C_FLAGS="$cov_flags" \ | |
| -DCMAKE_CXX_FLAGS="$cov_flags" \ | |
| -DCMAKE_STATIC_LINKER_FLAGS="$cov_flags" \ | |
| -DCMAKE_LINKER_TYPE=LLD \ | |
| -S . \ | |
| -B build | |
| - name: Build hictk_fuzzer | |
| run: | | |
| cmake --build build -j "$(nproc)" -t hictk_fuzzer | |
| mv build/test/fuzzer/src/hictk_fuzzer . | |
| ./hictk_fuzzer --help | |
| - name: Upload hictk_fuzzer | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: hictk_fuzzer | |
| path: hictk_fuzzer | |
| if-no-files-found: error | |
| retention-days: 1 | |
| fuzzy-project: | |
| name: Fuzzy project | |
| needs: build-project | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { | |
| dataset: "4DNFIYECESRC", | |
| format: "cool", | |
| normalization: "NONE", | |
| bin-type: "fixed", | |
| } | |
| - { | |
| dataset: "4DNFIYECESRC", | |
| format: "cool", | |
| normalization: "weight", | |
| bin-type: "fixed", | |
| } | |
| - { | |
| dataset: "4DNFIYECESRC", | |
| format: "cool", | |
| normalization: "VC", | |
| bin-type: "fixed", | |
| } | |
| - { | |
| dataset: "4DNFIYECESRC", | |
| format: "cool", | |
| normalization: "NONE", | |
| bin-type: "variable", | |
| } | |
| - { | |
| dataset: "4DNFIYECESRC", | |
| format: "hic8", | |
| normalization: "NONE", | |
| bin-type: "fixed", | |
| } | |
| - { | |
| dataset: "4DNFIYECESRC", | |
| format: "hic8", | |
| normalization: "KR", | |
| bin-type: "fixed", | |
| } | |
| - { | |
| dataset: "4DNFIYECESRC", | |
| format: "hic9", | |
| normalization: "NONE", | |
| bin-type: "fixed", | |
| } | |
| - { | |
| dataset: "4DNFIYECESRC", | |
| format: "hic9", | |
| normalization: "VC", | |
| bin-type: "fixed", | |
| } | |
| container: | |
| image: ghcr.io/paulsengroup/ci-docker-images/ubuntu-24.04-cxx-clang-21 | |
| options: "--user=root" | |
| env: | |
| HICTK_CI: "1" | |
| steps: | |
| - name: Clone hictk | |
| uses: actions/checkout@v5 | |
| - name: Download hictk_fuzzer | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: hictk_fuzzer | |
| - name: Fix permissions | |
| run: | | |
| chown -R "$(id -u):$(id -g)" "$PWD" | |
| chmod 500 hictk_fuzzer | |
| - name: Install test dependencies | |
| run: | | |
| apt-get update | |
| apt-get install -y python3.12 python3.12-dev | |
| pip install --no-cache-dir 'cooler==0.10.*' 'numpy<2' | |
| - name: Detect CI type | |
| id: ci-type | |
| run: | | |
| if git log --format=%B -n 1 ${{ github.event.after }} | grep -qF '[ci full]'; then | |
| echo "type=full" | tee -a "$GITHUB_OUTPUT" | |
| else | |
| echo "type=short" | tee -a "$GITHUB_OUTPUT" | |
| fi | |
| - name: Prepare for test | |
| id: test-params | |
| run: | | |
| duration=300 | |
| if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then | |
| duration='${{ inputs.duration }}' | |
| elif [[ '${{ steps.ci-type.outputs.type }}' == 'full' ]]; then | |
| duration=3600 | |
| fi | |
| resolution=50000 | |
| if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then | |
| if [[ '${{ inputs.resolution }}' == 'random' ]]; then | |
| resolution="$( | |
| python3 -c 'import random; import sys; print(random.choice([int(x) for x in sys.argv[1:]]))' \ | |
| 1000 5000 10000 50000 100000 500000 | |
| )" | |
| else | |
| resolution='${{ inputs.resolution }}' | |
| fi | |
| fi | |
| if [[ '${{ matrix.bin-type }}' == variable ]]; then | |
| resolution=0 | |
| fi | |
| # Generate a random 64 bit uint | |
| seed="$(od -An -vtu8 -N8 < /dev/random)" | |
| profile_prefix='${{ matrix.dataset }}-${{ matrix.format }}-${{ matrix.normalization}}-${{ matrix.bin-type }}' | |
| 1>&2 echo "Duration: $duration" | |
| 1>&2 echo "Resolution: $resolution" | |
| 1>&2 echo "Seed: $seed" | |
| 1>&2 echo "Profile prefix: $profile_prefix" | |
| { | |
| echo "duration=$duration" | |
| echo "resolution=$resolution" | |
| echo "seed=$seed" | |
| echo "profile-prefix=$profile_prefix" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Download test datasets | |
| run: | | |
| test/fuzzer/scripts/download_test_datasets.py \ | |
| test/fuzzer/test_files.json \ | |
| . \ | |
| --format cool "${{ matrix.format }}" \ | |
| --resolution "${{ steps.test-params.outputs.resolution }}" \ | |
| --dataset "${{ matrix.dataset }}" \ | |
| --nproc 2 | |
| - name: Run test (df) | |
| run: | | |
| args=() | |
| if [[ '${{ matrix.bin-type }}' == fixed ]]; then | |
| args+=(--resolution '${{ steps.test-params.outputs.resolution }}') | |
| fi | |
| export LLVM_PROFILE_FILE="$PWD/profiles/${{ steps.test-params.outputs.profile-prefix }}-hictk-fuzz-df.%p.profraw" | |
| # shellcheck disable=SC2035 | |
| ./hictk_fuzzer fuzz \ | |
| "${args[@]}" \ | |
| --duration '${{ steps.test-params.outputs.duration }}' \ | |
| --normalization '${{ matrix.normalization }}' \ | |
| --seed '${{ steps.test-params.outputs.seed }}' \ | |
| --nproc "$(nproc)" \ | |
| --format df \ | |
| *'.${{ matrix.format }}' \ | |
| *.cool | |
| - name: Run test (dense) | |
| run: | | |
| args=() | |
| if [[ '${{ matrix.bin-type }}' == fixed ]]; then | |
| args+=(--resolution '${{ steps.test-params.outputs.resolution }}') | |
| fi | |
| export LLVM_PROFILE_FILE="$PWD/profiles/${{ steps.test-params.outputs.profile-prefix }}-hictk-fuzz-dense.%p.profraw" | |
| # shellcheck disable=SC2035 | |
| ./hictk_fuzzer fuzz \ | |
| "${args[@]}" \ | |
| --duration '${{ steps.test-params.outputs.duration }}' \ | |
| --normalization '${{ matrix.normalization }}' \ | |
| --seed '${{ steps.test-params.outputs.seed }}' \ | |
| --nproc "$(nproc)" \ | |
| --format dense \ | |
| *'.${{ matrix.format }}' \ | |
| *.cool | |
| - name: Run test (sparse) | |
| run: | | |
| args=() | |
| if [[ '${{ matrix.bin-type }}' == fixed ]]; then | |
| args+=(--resolution '${{ steps.test-params.outputs.resolution }}') | |
| fi | |
| export LLVM_PROFILE_FILE="$PWD/profiles/${{ steps.test-params.outputs.profile-prefix }}-hictk-fuzz-sparse.%p.profraw" | |
| # shellcheck disable=SC2035 | |
| ./hictk_fuzzer fuzz \ | |
| "${args[@]}" \ | |
| --duration '${{ steps.test-params.outputs.duration }}' \ | |
| --normalization '${{ matrix.normalization }}' \ | |
| --seed '${{ steps.test-params.outputs.seed }}' \ | |
| --nproc "$(nproc)" \ | |
| --format sparse \ | |
| *'.${{ matrix.format }}' \ | |
| *.cool | |
| - name: Run test (diagonal band; 1D queries) | |
| if: matrix.bin-type == 'fixed' | |
| run: | | |
| _100_mbps=100000000 | |
| export LLVM_PROFILE_FILE="$PWD/profiles/${{ steps.test-params.outputs.profile-prefix }}-hictk-fuzz-diagonal-band-1d.%p.profraw" | |
| # shellcheck disable=SC2035 | |
| ./hictk_fuzzer fuzz \ | |
| --resolution ${{ steps.test-params.outputs.resolution }} \ | |
| --duration '${{ steps.test-params.outputs.duration }}' \ | |
| --normalization '${{ matrix.normalization }}' \ | |
| --seed '${{ steps.test-params.outputs.seed }}' \ | |
| --nproc "$(nproc)" \ | |
| --format df \ | |
| --1d-to-2d-query-ratio 1 \ | |
| --diagonal-band-width "$_100_mbps" \ | |
| *'.${{ matrix.format }}' \ | |
| *.cool | |
| - name: Run test (diagonal band; 2D queries) | |
| if: matrix.bin-type == 'fixed' | |
| run: | | |
| _1_gbp=1000000000 | |
| export LLVM_PROFILE_FILE="$PWD/profiles/${{ steps.test-params.outputs.profile-prefix }}-hictk-fuzz-diagonal-band-2d.%p.profraw" | |
| # shellcheck disable=SC2035 | |
| ./hictk_fuzzer fuzz \ | |
| --resolution ${{ steps.test-params.outputs.resolution }} \ | |
| --duration '${{ steps.test-params.outputs.duration }}' \ | |
| --normalization '${{ matrix.normalization }}' \ | |
| --seed '${{ steps.test-params.outputs.seed }}' \ | |
| --nproc "$(nproc)" \ | |
| --format df \ | |
| --1d-to-2d-query-ratio=0 \ | |
| --diagonal-band-width "$_1_gbp" \ | |
| *'.${{ matrix.format }}' \ | |
| *.cool | |
| - name: Upload coverage profiles | |
| if: github.event_name != 'workflow_dispatch' | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: fuzzy-testing-cov-${{ steps.test-params.outputs.profile-prefix }} | |
| path: profiles/ | |
| if-no-files-found: error | |
| retention-days: 1 | |
| upload-coverage: | |
| if: github.event_name != 'workflow_dispatch' | |
| name: Upload Coverage | |
| needs: fuzzy-project | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/paulsengroup/ci-docker-images/ubuntu-24.04-cxx-clang-21 | |
| options: "--user=root" | |
| steps: | |
| - name: Clone hictk | |
| uses: actions/checkout@v5 | |
| - name: Download hictk_fuzzer | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: hictk_fuzzer | |
| - name: Fix permissions | |
| run: | | |
| chown -R "$(id -u):$(id -g)" "$PWD" | |
| chmod 500 hictk_fuzzer | |
| - name: Download coverage profiles | |
| uses: actions/download-artifact@v6 | |
| with: | |
| pattern: fuzzy-testing-cov-* | |
| merge-multiple: true | |
| - name: Setup dependencies | |
| run: | | |
| apt-get update | |
| apt-get install -q -y --no-install-recommends \ | |
| curl \ | |
| gpg \ | |
| gpg-agent \ | |
| python3 \ | |
| sudo \ | |
| tar | |
| - name: Collect coverage data | |
| run: | | |
| mkdir profiles | |
| mv ./*.profraw profiles/ | |
| utils/devel/collect_coverage_data.py \ | |
| --output-dir coverage/ \ | |
| --prefix="$PWD/profiles/" \ | |
| --format lcov \ | |
| --llvm-cov-bin llvm-cov-21 \ | |
| --llvm-profdata-bin llvm-profdata-21 \ | |
| ./hictk_fuzzer | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 | |
| with: | |
| flags: "tests | fuzzer" | |
| fail_ci_if_error: true | |
| handle_no_reports_found: true | |
| directory: coverage | |
| os: linux | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| fuzzy-testing-status-check: | |
| name: Status Check (fuzzy-testing) | |
| if: ${{ always() }} | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-project | |
| - fuzzy-project | |
| - upload-coverage | |
| steps: | |
| - name: Collect job results | |
| if: | | |
| needs.build-project.result != 'success' || | |
| needs.fuzzy-project.result != 'success' || | |
| ( | |
| needs.upload-coverage.result != 'success' && | |
| needs.upload-coverage.result != 'skipped' | |
| ) | |
| run: exit 1 |