From 07d147a7e49bd160001ac9aab5f0584103e0b350 Mon Sep 17 00:00:00 2001 From: alaviss Date: Mon, 6 Nov 2023 16:05:25 -0600 Subject: [PATCH] add nimskull testing and various compatibility fixes (#168) * ci: update actions/checkout and remove unshallow We can fetch the full history from here. * ci: split clone and build for libgit2 Allows for better Windows compatibility (not that it's in use) * ci: add nimskull to the test matrix * bootstrap: switch to alaviss fork of hlibgit2 This fixes a memory corruption due to ABI error in libgit2 * ci: bump nimskull version for balls * bump balls to 3.9.10 This version contains fixes for balls-the-library to run under nimskull * ci: run test in both debug and release mode This is so that we can get traces on test failure due to memory errors. Ideally balls would be employed for this, but the runner does not understand nimskull flags yet. * bump gittyup to 3.2.2 This version supports nimskull and fixes various memory leaks --- .github/workflows/ci.yml | 77 ++++++++++++++++++++++++++++++++-------- bootstrap-nonimble.sh | 4 +-- nimph.nimble | 4 +-- 3 files changed, 67 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3045ae..041fb1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,27 +35,69 @@ jobs: #os: ['windows-latest', 'macos-latest', 'ubuntu-latest'] #os: ['macos-latest', 'ubuntu-latest'] os: ['ubuntu-latest'] - nim: ['version-1-6', 'version-1-4', 'version-1-2'] - name: '${{ matrix.os }} (${{ matrix.nim }})' + compiler: + - name: nim + version: version-1-6 + - name: nim + version: version-1-4 + - name: nim + version: version-1-2 + - name: nimskull + version: '^0.1.0-dev.21080' + name: '${{ matrix.os }} (${{ matrix.compiler.name }} ${{ matrix.compiler.version }})' runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: ci + fetch-depth: 0 + # nimph will scream when this is used + #filter: tree:0 - - name: Setup Nim + - if: matrix.compiler.name == 'nim' + name: Setup Nim uses: alaviss/setup-nim@0.1.1 with: path: nim - version: ${{ matrix.nim }} + version: ${{ matrix.compiler.version }} + + - if: matrix.compiler.name == 'nimskull' + id: nimskull + name: Setup Nimskull + uses: alaviss/setup-nimskull@f6e8ade8ac51191024616216e5da0ee968d9da48 + with: + nimskull-version: ${{ matrix.compiler.version }} + + - if: matrix.compiler.name == 'nimskull' + name: Fetch nimble's fork for nimskull + uses: actions/checkout@v4 + with: + path: nimble + repository: alaviss/nimble + ref: nimskull + + - if: matrix.compiler.name == 'nimskull' + name: Build nimble and add to PATH + shell: bash + run: | + cd nimble + nim c -d:release -o:nimble src/nimble.nim + cp nimble "$NIMSKULL_BIN/nimble" + env: + NIMSKULL_BIN: ${{ steps.nimskull.outputs.binPath }} + + - name: Fetch libgit2 + uses: actions/checkout@v4 + with: + path: ci/libgit2 + repository: libgit2/libgit2 + ref: v1.5.0 - name: Setup libgit2 shell: bash run: | - cd ci - git clone --depth=1 --branch=v1.5.0 --quiet https://github.com/libgit2/libgit2.git - cd libgit2 + cd ci/libgit2 mkdir build cd build cmake .. @@ -66,7 +108,6 @@ jobs: run: | mkdir $HOME/.nimble cd ci - git fetch --unshallow cp ci-bootstrap.cfg nim.cfg ./bootstrap-nonimble.sh ./nimph refresh @@ -82,11 +123,19 @@ jobs: echo "remove nim's config.nims...?" ls -l `dirname \`which nim\``/../config/ rm `dirname \`which nim\``/../config/config.nims || true - if [ "${{ matrix.os }}" == "macos-latest" ]; then - nim c --define:libgit2Lib="$(pwd)/libgit2/build/libgit2.dylib" --passC:"-I$(pwd)/libgit2/include" --define:ssl --define:release --run tests/test.nim - else - nim c --define:libgit2Lib="$(pwd)/libgit2/build/libgit2.so" --passC:"-I$(pwd)/libgit2/include" --define:ssl --define:release --run tests/test.nim - fi + + soExt= + case "$RUNNER_OS" in + macOS) + soExt=dylib + ;; + Linux) + soExt=so + esac + libgit2Lib=$(pwd)/libgit2/build/libgit2.$soExt + + nim c --define:libgit2Lib="$libgit2Lib" --passC:"-I$(pwd)/libgit2/include" --define:ssl -r tests/test.nim + nim c --define:libgit2Lib="$libgit2Lib" --passC:"-I$(pwd)/libgit2/include" --define:ssl --define:release -r tests/test.nim - name: Build docs if: ${{ matrix.docs }} == 'true' diff --git a/bootstrap-nonimble.sh b/bootstrap-nonimble.sh index 5e01507..5f7b602 100755 --- a/bootstrap-nonimble.sh +++ b/bootstrap-nonimble.sh @@ -17,14 +17,14 @@ cd temporary git clone --depth 1 --branch 1.8.31 https://github.com/disruptek/bump.git git clone --depth 1 --branch 2.0.1 https://github.com/disruptek/cutelog.git -git clone --depth 1 --branch 3.1.0 https://github.com/disruptek/gittyup.git +git clone --depth 1 --branch 3.2.2 https://github.com/disruptek/gittyup.git git clone --depth 1 --branch 2.0.3 https://github.com/disruptek/cligen.git git clone --depth 1 --branch 0.26.0 https://github.com/zevv/npeg.git git clone --depth 1 --branch 1.0.2 https://github.com/disruptek/jsonconvert.git git clone --depth 1 --branch 2.1.3 https://github.com/disruptek/badresults.git git clone --depth 1 --branch 3.0.0 https://github.com/disruptek/github.git git clone --depth 1 --branch 0.0.7 https://github.com/disruptek/ups.git -git clone --depth 1 --branch 0.1.6 https://github.com/haxscramper/hlibgit2.git +git clone --depth 1 --branch 0.1.7 https://github.com/alaviss/hlibgit2.git git clone --depth 1 --branch 0.1.5 https://github.com/haxscramper/hlibssh2.git nim c --outdir:.. --define:release --path:../src --path:hlibgit2/src --path:hlibssh2/src --path:ups --path:cligen --path:github --path:npeg/src --path:jsonconvert --path:badresults --path:bump --path:cutelog --path:gittyup $PASSES ../src/nimph.nim diff --git a/nimph.nimble b/nimph.nimble index 64938a9..d4cb2b8 100644 --- a/nimph.nimble +++ b/nimph.nimble @@ -16,11 +16,11 @@ requires "https://github.com/disruptek/github >= 3.0.0 & < 4.0.0" requires "https://github.com/disruptek/jsonconvert < 2.0.0" requires "https://github.com/disruptek/badresults >= 2.1.2 & < 3.0.0" requires "https://github.com/disruptek/cutelog >= 2.0.0 & < 3.0.0" -requires "https://github.com/disruptek/gittyup >= 3.1.0 & < 4.0.0" +requires "https://github.com/disruptek/gittyup >= 3.2.2 & < 4.0.0" requires "https://github.com/disruptek/ups >= 0.0.7 & < 1.0.0" when not defined(release): - requires "https://github.com/disruptek/balls >= 3.0.0 & < 4.0.0" + requires "https://github.com/disruptek/balls >= 3.9.10 & < 4.0.0" task test, "run unit tests": when defined(windows):