name: Fuzz on: schedule: - cron: "23 3 * * *" workflow_dispatch: inputs: seed: description: Seed (default the date, yyyymmdd) required: false count: description: Components to generate required: false default: "1000" permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} env: CARGO_TERM_COLOR: always jobs: fuzz: name: Vue and the generated Rust agree runs-on: ubuntu-latest timeout-minutes: 120 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: $/.github/actions/rust with: cache-key: fuzz - uses: $/.github/actions/pnpm - name: The harness catches a planted bug run: | if FERROVUE_FUZZ_PLANT=1 FERROVUE_FUZZ_SEED=3 FERROVUE_FUZZ_COUNT=30 FERROVUE_FUZZ_SHRINK_MAX=1 pnpm fuzz > "$RUNNER_TEMP/planted.log" 2>&1; then cat "$RUNNER_TEMP/planted.log" exit 1 fi cat "$RUNNER_TEMP/planted.log" grep -Eq 'Summary: .* mismatches [1-9]' "$RUNNER_TEMP/planted.log" - name: Fuzz env: SEED: ${{ inputs.seed }} COUNT: ${{ inputs.count }} run: | seed="${SEED:-$(date -u +%Y%m%d)}" echo "Reproduce with: FERROVUE_FUZZ_SEED=$seed FERROVUE_FUZZ_COUNT=${COUNT:-1000} pnpm fuzz" >> "$GITHUB_STEP_SUMMARY" FERROVUE_FUZZ_SEED="$seed" FERROVUE_FUZZ_COUNT="${COUNT:-1000}" pnpm fuzz - name: Upload the shrunk failures if: failure() && hashFiles('fuzz/failures/**') != '' uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: fuzz-failures-${{ github.run_id }} path: fuzz/failures/ if-no-files-found: ignore cargo-fuzz: name: cargo fuzz (${{ matrix.target }}) runs-on: ubuntu-latest timeout-minutes: 30 strategy: fail-fast: false max-parallel: 2 matrix: target: [escape, json, state_script, attrs] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: $/.github/actions/rust with: toolchain: nightly cache-key: cargo-fuzz - uses: taiki-e/install-action@ab49d3c64680143e184118bed66a46419fc15519 # v2.90.5 with: tool: cargo-fuzz - uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: fuzz/corpus/${{ matrix.target }} key: cargo-fuzz-corpus-${{ matrix.target }}-${{ github.run_id }} restore-keys: cargo-fuzz-corpus-${{ matrix.target }}- - name: Fuzz for ten minutes env: TARGET: ${{ matrix.target }} run: cargo fuzz run --target x86_64-unknown-linux-gnu "$TARGET" -- -max_total_time=600 -rss_limit_mb=6144 -print_final_stats=1 - name: Keep the inputs that reach new code if: success() env: TARGET: ${{ matrix.target }} run: cargo fuzz cmin --target x86_64-unknown-linux-gnu "$TARGET" - uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 if: success() with: path: fuzz/corpus/${{ matrix.target }} key: cargo-fuzz-corpus-${{ matrix.target }}-${{ github.run_id }} - name: Upload the failing input if: failure() && hashFiles('fuzz/artifacts/**') != '' uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: cargo-fuzz-${{ matrix.target }}-${{ github.run_id }} path: fuzz/artifacts/ if-no-files-found: ignore