mirror of
https://github.com/logos-storage/nim-leopard.git
synced 2026-01-07 16:13:10 +00:00
GCC-14 (#15)
* disables pointer-compatibility error in gcc-14 * Replaces no-error passC with importc pointer type definition * simplifies CI * fix attempt for leopard on mm:orc * removes touch in ci * removes showing of symbols * attempt to fix macos if * sets runners in ci * sets shell to bash in ci * removes cmake compiler flags from ci * Removes conditional block for macos in ci
This commit is contained in:
parent
895ff24ca6
commit
3e09d8113f
156
.github/workflows/test.yml
vendored
156
.github/workflows/test.yml
vendored
@ -1,158 +1,44 @@
|
|||||||
name: Tests
|
name: Tests
|
||||||
|
on: [push, pull_request]
|
||||||
on: [pull_request, push]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tests:
|
test:
|
||||||
env:
|
|
||||||
NPROC: 2
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
matrix:
|
||||||
cache_nonce: [ 1 ]
|
|
||||||
nim_version: [ 1.6.20 ] # add stable for testing 2.0+
|
|
||||||
platform:
|
platform:
|
||||||
- {
|
- {
|
||||||
icon: 🐧,
|
icon: 🐧,
|
||||||
label: Linux,
|
label: Linux,
|
||||||
os: ubuntu,
|
os: ubuntu,
|
||||||
runner: ubuntu-latest,
|
runner: ubuntu-latest
|
||||||
shell: bash --noprofile --norc -eo pipefail
|
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
icon: 🍎,
|
icon: 🍎,
|
||||||
label: macOS,
|
label: macOS,
|
||||||
os: macos,
|
os: macos,
|
||||||
runner: macos-13, # x86
|
runner: macos-13 # x86
|
||||||
shell: bash --noprofile --norc -eo pipefail
|
|
||||||
}
|
}
|
||||||
- {
|
- {
|
||||||
icon: 🏁,
|
icon: 🏁,
|
||||||
label: Windows,
|
label: Windows,
|
||||||
os: windows,
|
os: windows,
|
||||||
runner: windows-latest,
|
runner: windows-latest
|
||||||
shell: msys2
|
|
||||||
}
|
}
|
||||||
name: ${{ matrix.platform.icon }} ${{ matrix.platform.label }} - Nim v${{ matrix.nim_version }}
|
nim: [1.6.18]
|
||||||
runs-on: ${{ matrix.platform.runner }}
|
name: ${{ matrix.platform.icon }} ${{ matrix.platform.label }} - Nim v${{ matrix.nim }}
|
||||||
|
runs-on: ${{ matrix.platform.os }}-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
shell: ${{ matrix.platform.shell }} {0}
|
shell: bash
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# - name: Install tools and libraries via APT (Linux)
|
- uses: actions/checkout@v4
|
||||||
# if: matrix.platform.os == 'ubuntu'
|
with:
|
||||||
# run: |
|
submodules: true
|
||||||
# sudo apt update
|
- uses: iffy/install-nim@v4
|
||||||
# sudo apt install -y \
|
with:
|
||||||
# ...
|
version: ${{ matrix.nim }}
|
||||||
|
- name: Install
|
||||||
- name: Install tools and libraries via Homebrew (macOS)
|
run: nimble install -y
|
||||||
if: matrix.platform.os == 'macos'
|
- name: Build and run tests
|
||||||
run: |
|
run: |
|
||||||
brew update
|
eval nimble --verbose test -d:release --mm:refc
|
||||||
brew install \
|
eval nimble --verbose test -d:release --mm:orc
|
||||||
findutils \
|
|
||||||
libomp \
|
|
||||||
llvm@14
|
|
||||||
|
|
||||||
- name: Install tools and libraries via MSYS2 (Windows)
|
|
||||||
if: matrix.platform.os == 'windows'
|
|
||||||
uses: msys2/setup-msys2@v2
|
|
||||||
with:
|
|
||||||
msystem: UCRT64
|
|
||||||
install: >
|
|
||||||
base-devel
|
|
||||||
git
|
|
||||||
mingw-w64-ucrt-x86_64-cmake
|
|
||||||
mingw-w64-ucrt-x86_64-toolchain
|
|
||||||
|
|
||||||
- name: Checkout sources from GitHub
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
- name: Calculate cache member paths
|
|
||||||
id: calc-paths
|
|
||||||
run: |
|
|
||||||
if [[ ${{ matrix.platform.os }} = windows ]]; then
|
|
||||||
echo "::set-output name=bash_env::$(cygpath -m "${HOME}")/.bash_env"
|
|
||||||
echo "::set-output name=choosenim::$(cygpath -m "${USERPROFILE}")/.choosenim"
|
|
||||||
echo "::set-output name=nimble::$(cygpath -m "${HOME}")/.nimble"
|
|
||||||
else
|
|
||||||
echo "::set-output name=bash_env::${HOME}/.bash_env"
|
|
||||||
echo "::set-output name=choosenim::${HOME}/.choosenim"
|
|
||||||
echo "::set-output name=nimble::${HOME}/.nimble"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Restore choosenim and Nim tooling from cache
|
|
||||||
id: choosenim-nim-tooling-cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ steps.calc-paths.outputs.bash_env }}
|
|
||||||
${{ steps.calc-paths.outputs.choosenim }}
|
|
||||||
${{ steps.calc-paths.outputs.nimble }}/bin
|
|
||||||
key: ${{ matrix.platform.os }}-nim_version:${{ matrix.nim_version }}-cache_nonce:${{ matrix.cache_nonce }}
|
|
||||||
|
|
||||||
- name: Install choosenim and Nim tooling
|
|
||||||
if: steps.choosenim-nim-tooling-cache.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
mkdir -p "${HOME}/Downloads"
|
|
||||||
cd "${HOME}/Downloads"
|
|
||||||
curl https://nim-lang.org/choosenim/init.sh -sSf -O
|
|
||||||
chmod +x init.sh
|
|
||||||
if [[ ${{ matrix.platform.os }} = windows ]]; then
|
|
||||||
mkdir -p "$(cygpath "${USERPROFILE}")/.nimble/bin"
|
|
||||||
fi
|
|
||||||
CHOOSENIM_CHOOSE_VERSION=${{ matrix.nim_version }} ./init.sh -y
|
|
||||||
if [[ ${{ matrix.platform.os }} = windows ]]; then
|
|
||||||
mv "$(cygpath "${USERPROFILE}")/.nimble" "${HOME}/"
|
|
||||||
# intention is to rely only on libs provided by the OS and MSYS2 env
|
|
||||||
rm -rf "${HOME}/.nimble/bin/"*.dll
|
|
||||||
rm -rf "${HOME}/.nimble/bin/"*.pem
|
|
||||||
fi
|
|
||||||
echo 'export NIMBLE_DIR="${HOME}/.nimble"' >> "${HOME}/.bash_env"
|
|
||||||
echo 'export PATH="${NIMBLE_DIR}/bin:${PATH}"' >> "${HOME}/.bash_env"
|
|
||||||
|
|
||||||
- name: Install project dependencies
|
|
||||||
run: |
|
|
||||||
source "${HOME}/.bash_env"
|
|
||||||
cd "${NIMBLE_DIR}/bin"
|
|
||||||
# delete broken symlinks, which can arise because e.g. the cache
|
|
||||||
# restored a symlink that points to an executable within
|
|
||||||
# ../pkgs/foo-1.2.3/ but the project's .nimble file has been updated
|
|
||||||
# to install foo-#head; in the case of a broken symlink, nimble's
|
|
||||||
# auto-overwrite fails
|
|
||||||
if [[ ${{ matrix.platform.os }} = macos ]]; then
|
|
||||||
gfind . -xtype l -delete
|
|
||||||
else
|
|
||||||
find . -xtype l -delete
|
|
||||||
fi
|
|
||||||
cd -
|
|
||||||
nimble --accept install
|
|
||||||
|
|
||||||
- name: Build and run tests
|
|
||||||
run: |
|
|
||||||
source "${HOME}/.bash_env"
|
|
||||||
if [[ ${{ matrix.platform.os }} = windows ]]; then
|
|
||||||
touch tests/testleopard.exe
|
|
||||||
else
|
|
||||||
touch tests/testleopard
|
|
||||||
fi
|
|
||||||
if [[ ${{ matrix.platform.os }} = macos ]]; then
|
|
||||||
export PATH="$(brew --prefix llvm@14)/bin:${PATH}"
|
|
||||||
export LDFLAGS="-L$(brew --prefix libomp)/lib -L$(brew --prefix llvm@14)/lib -Wl,-rpath,$(brew --prefix llvm@14)/lib"
|
|
||||||
compiler_extra_options="-d:LeopardCmakeFlags='-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=$(brew --prefix llvm@14)/bin/clang -DCMAKE_CXX_COMPILER=$(brew --prefix llvm@14)/bin/clang++' -d:LeopardExtraCompilerlags='-fopenmp' -d:LeopardExtraLinkerFlags='-fopenmp -L$(brew --prefix libomp)/lib'"
|
|
||||||
fi
|
|
||||||
eval nimble --verbose test -d:release --mm:refc ${compiler_extra_options}
|
|
||||||
eval nimble --verbose test -d:release --mm:orc ${compiler_extra_options}
|
|
||||||
if [[ ${{ matrix.platform.os }} = macos ]]; then
|
|
||||||
echo
|
|
||||||
echo otool -L tests/testleopard
|
|
||||||
otool -L tests/testleopard
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
echo ldd tests/testleopard
|
|
||||||
ldd tests/testleopard
|
|
||||||
fi
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ func encode*(
|
|||||||
self.buffers.cuint,
|
self.buffers.cuint,
|
||||||
self.parity.cuint,
|
self.parity.cuint,
|
||||||
self.workBufferCount.cuint,
|
self.workBufferCount.cuint,
|
||||||
cast[ptr pointer](addr self.dataBufferPtr[0]),
|
cast[LeoDataPtr](addr self.dataBufferPtr[0]),
|
||||||
cast[ptr pointer](addr self.workBufferPtr[0]))
|
cast[ptr pointer](addr self.workBufferPtr[0]))
|
||||||
|
|
||||||
if ord(res) != ord(LeopardSuccess):
|
if ord(res) != ord(LeopardSuccess):
|
||||||
@ -148,8 +148,8 @@ func decode*(
|
|||||||
self.buffers.cuint,
|
self.buffers.cuint,
|
||||||
self.parity.cuint,
|
self.parity.cuint,
|
||||||
self.decodeBufferCount.cuint,
|
self.decodeBufferCount.cuint,
|
||||||
cast[ptr pointer](addr dataPtr[0]),
|
cast[LeoDataPtr](addr dataPtr[0]),
|
||||||
cast[ptr pointer](addr parityPtr[0]),
|
cast[LeoDataPtr](addr parityPtr[0]),
|
||||||
cast[ptr pointer](addr self.decodeBufferPtr[0]))
|
cast[ptr pointer](addr self.decodeBufferPtr[0]))
|
||||||
|
|
||||||
if ord(res) != ord(LeopardSuccess):
|
if ord(res) != ord(LeopardSuccess):
|
||||||
|
|||||||
@ -67,6 +67,9 @@ import std/compilesettings
|
|||||||
import std/os
|
import std/os
|
||||||
import std/strutils
|
import std/strutils
|
||||||
|
|
||||||
|
type
|
||||||
|
LeoDataPtr* {.importc: "const void* const*", bycopy.} = pointer
|
||||||
|
|
||||||
const
|
const
|
||||||
LeopardCmakeFlags {.strdefine.} =
|
LeopardCmakeFlags {.strdefine.} =
|
||||||
when defined(macosx):
|
when defined(macosx):
|
||||||
@ -225,7 +228,7 @@ proc leoEncode*(
|
|||||||
originalCount: cuint;
|
originalCount: cuint;
|
||||||
recoveryCount: cuint;
|
recoveryCount: cuint;
|
||||||
workCount: cuint;
|
workCount: cuint;
|
||||||
originalData: ptr pointer;
|
originalData: LeoDataPtr;
|
||||||
workData: ptr pointer): LeopardResult {.leo, importc: "leo_encode".}
|
workData: ptr pointer): LeopardResult {.leo, importc: "leo_encode".}
|
||||||
## Number of bytes in each data buffer
|
## Number of bytes in each data buffer
|
||||||
## Number of original_data[] buffer pointers
|
## Number of original_data[] buffer pointers
|
||||||
@ -277,8 +280,8 @@ proc leoDecode*(
|
|||||||
originalCount: cuint;
|
originalCount: cuint;
|
||||||
recoveryCount: cuint;
|
recoveryCount: cuint;
|
||||||
workCount: cuint;
|
workCount: cuint;
|
||||||
originalData: ptr pointer;
|
originalData: LeoDataPtr;
|
||||||
recoveryData: ptr pointer;
|
recoveryData: LeoDataPtr;
|
||||||
workData: ptr pointer): LeopardResult {.leo, importc: "leo_decode".}
|
workData: ptr pointer): LeopardResult {.leo, importc: "leo_decode".}
|
||||||
## Number of bytes in each data buffer
|
## Number of bytes in each data buffer
|
||||||
## Number of original_data[] buffer pointers
|
## Number of original_data[] buffer pointers
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user