Skip to content

Commit

Permalink
add nimskull testing and various compatibility fixes (#168)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alaviss authored Nov 6, 2023
1 parent 2c8d484 commit 07d147a
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 18 deletions.
77 changes: 63 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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 ..
Expand All @@ -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
Expand All @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions bootstrap-nonimble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions nimph.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 07d147a

Please sign in to comment.