first ci version (#12)

This commit is contained in:
Ivan FB 2026-04-29 23:48:36 +02:00 committed by GitHub
parent df2277e726
commit e3eca63236
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 87 additions and 2 deletions

85
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,85 @@
name: CI
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
env:
NIM_VERSION: '2.2.4'
NIMBLE_VERSION: '0.22.3'
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-15, windows-latest]
nim-version: ['2.2.4', 'stable']
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} / Nim ${{ matrix.nim-version }}
steps:
- uses: actions/checkout@v4
- name: Setup Nim
uses: jiro4989/setup-nim-action@v2
with:
nim-version: ${{ matrix.nim-version }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Nimble ${{ env.NIMBLE_VERSION }}
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$PATH"
fi
cd /tmp && nimble install "nimble@${{ env.NIMBLE_VERSION }}" -y
echo "$HOME/.nimble/bin" >> $GITHUB_PATH
- name: Cache nimble deps
id: cache-nimbledeps
uses: actions/cache@v4
with:
path: |
nimbledeps/
nimble.paths
key: ${{ runner.os }}-nimbledeps-${{ matrix.nim-version }}-${{ hashFiles('*.nimble') }}
restore-keys: |
${{ runner.os }}-nimbledeps-${{ matrix.nim-version }}-
${{ runner.os }}-nimbledeps-
- name: Install nimble deps
if: steps.cache-nimbledeps.outputs.cache-hit != 'true'
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH"
fi
nimble setup --localdeps -y
- name: Build
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH"
fi
nimble buildffi -y
- name: Run allocation tests
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH"
fi
nimble test_alloc -y
- name: Run FFI context tests
shell: bash
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH"
fi
nimble test_ffi -y

View File

@ -14,8 +14,8 @@ requires "taskpools"
const nimFlags = "--mm:orc -d:chronicles_log_level=WARN"
task build, "Compile the library":
exec "nim c " & nimFlags & " --noMain ffi.nim"
task buildffi, "Compile the library":
exec "nim c " & nimFlags & " --app:lib --noMain ffi.nim"
task test, "Run all tests":
exec "nim c -r " & nimFlags & " tests/test_alloc.nim"