Skip to content

juancarlospaco/nimrun-action

Repository files navigation

Nimrun-Action

  • GitHub Action to bisect bugs commit-by-commit from GitHub issue comments code blocks.
nimrun.mp4

The bot will run the provided code on all Nim final versions from 1.0.0 to devel, then finds at least 1 commit that fails and finds at least 1 commit that works, bisects commit-by-commit between that range of commits (FAILS..WORKS), re-builds Nim commit-by-commit and runs the code checking if it works, until it finds 1 specific commit that introduces the Bug, it says who, when, why, link, and files with the bug, also reports debug info like output, IR (C/JS), AST, date/time/duration, compiled file size, commits near with link, commits per second, etc.

Users can Bisect their own bugs, core devs get the commit that introduced the bug.

The reduced bug repro code sample should be as tiny and simple as possible for faster performance but must have asserts.

The Bot will match Github issue comments that first line starts with:

  • "!nim c"
  • "!nim cpp"
  • "!nim js"

And followed by 1 code block of Nim source code.

Setup

Use

on:
  issue_comment:
    types: created
jobs:
  bisects:
    if: |
      github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '!nim ') && github.event.issue.pull_request == null && github.event.comment.author_association != 'NONE'
    strategy:
      fail-fast: false
      matrix:
        platform: [ubuntu-latest, windows-latest, macos-latest]
    name: ${{ matrix.platform }}-bisects
    runs-on: ${{ matrix.platform }}
    steps:
      - uses: actions/checkout@v3
      - uses: jiro4989/setup-nim-action@v1
        with:
          nim-version: 'devel'
      - uses: juancarlospaco/nimrun-action@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
  • @github-actions adds 👀 Reaction to your Github issue comment when seen.
  • @github-actions adds 1 new Github issue comment with the Bisect results and stats.

Examples

Used by Nim official repo:

Valgrind

  • Iff using ARC/ORC/AtomicARC and -d:useMalloc then uses Valgrind.
  • Example !nim c --gc:arc -d:useMalloc (automatically sets --debugger:native etc).
  • Example nim-lang/Nim#22672 (comment)
  • #4

Fuzzing

random.randomize()
type O = enum A, B
echo O.fuzzing
echo int.fuzzing
echo int64.fuzzing
echo int32.fuzzing
echo int16.fuzzing
echo int8.fuzzing
echo uint64.fuzzing
echo uint32.fuzzing
echo uint16.fuzzing
echo uint8.fuzzing
echo byte.fuzzing
echo char.fuzzing
echo repr(BackwardsIndex.fuzzing)
echo bool.fuzzing
echo float.fuzzing
echo float64.fuzzing
echo float32.fuzzing
echo Positive.fuzzing
echo Natural.fuzzing
echo string.fuzzing
echo cstring.fuzzing

Multiple files

If you want to provide additional files:

  • Add 1 new code block with C syntax to be saved as ./temp.c.
  • Add 1 new code block with C++ syntax to be saved as ./temp.cpp.
  • Add 1 new code block with C Header syntax to be saved as ./temp.h.
  • Add 1 new code block with HPP Header syntax to be saved as ./temp.hpp.
  • Add 1 new code block with JS syntax to be saved as ./temp.js.
  • Add 1 new code block with JSON syntax to be saved as ./temp.json.
  • Add 1 new code block with TXT syntax to be saved as ./temp.txt.
  • Add 1 new code block with CFG syntax to be saved as ./temp.nim.cfg.

For additional Nim source code files provide additional Nim code blocks, the first Nim code block will always be the main executable named ./temp.nim, and additional Nim code blocks will be importable modules named as ./tempN.nim, with N being an incrementing positive integer starting with ./temp1.nim, then ./temp2.nim, ./temp3.nim, ./temp4.nim, etc.

Arbitrary text comment

Comment must start with the !nim because it checks the first line only for performance for fast builds, you can have any arbitrary text and links after the code blocks (or write the text on another comment).

Requisites

  • jiro4989/setup-nim-action to setup Nim.

Articles

Stars

@juancarlospaco@moigagoo@planetis-m@geotre@georgelemon@gabbhack@termermc@solarizedalias@jmgomez@AmjadHD@Blackskywork@tuanductran@viluon