This commit is contained in:
jangko 2023-06-04 11:31:45 +07:00
parent 1322d860a8
commit c1d640184b
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
4 changed files with 19 additions and 17 deletions

View File

@ -8,6 +8,7 @@ jobs:
max-parallel: 20
matrix:
test_lang: [c]
branch: [version-1-6]
target:
- os: linux
cpu: amd64
@ -17,24 +18,22 @@ jobs:
cpu: amd64
- os: windows
cpu: amd64
- os: windows
cpu: i386
include:
- target:
os: linux
builder: ubuntu-18.04
builder: ubuntu-20.04
- target:
os: macos
builder: macos-10.15
builder: macos-11
- target:
os: windows
builder: windows-2019
builder: windows-latest
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.test_lang }}'
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ matrix.test_lang }}-(Nim ${{ matrix.branch }})'
runs-on: ${{ matrix.builder }}
steps:
- name: Checkout nim-ethash
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: nim-ethash
submodules: false
@ -62,7 +61,7 @@ jobs:
- name: Restore MinGW-W64 (Windows) from cache
if: runner.os == 'Windows'
id: windows-mingw-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: external/mingw-${{ matrix.target.cpu }}
key: 'mingw-${{ matrix.target.cpu }}'
@ -70,7 +69,7 @@ jobs:
- name: Restore Nim DLLs dependencies (Windows) from cache
if: runner.os == 'Windows'
id: windows-dlls-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: external/dlls-${{ matrix.target.cpu }}
key: 'dlls-${{ matrix.target.cpu }}'
@ -120,11 +119,11 @@ jobs:
git ls-remote "https://github.com/$1" "${2:-HEAD}" | cut -f 1
}
nbsHash=$(getHash status-im/nimbus-build-system)
echo "::set-output name=nimbus_build_system::$nbsHash"
echo "nimbus_build_system=$nbsHash" >> $GITHUB_OUTPUT
- name: Restore prebuilt Nim from cache
id: nim-cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: NimBinaries
key: '${{ matrix.test_lang }}-${{ matrix.target.os }}-${{ matrix.target.cpu }}-${{ steps.versions.outputs.nimbus_build_system }}'
@ -143,7 +142,9 @@ jobs:
else
MAKE_CMD="make"
fi
env MAKE="$MAKE_CMD -j2" ARCH_OVERRIDE=$PLATFORM CC=gcc bash build_nim.sh nim csources dist/nimble NimBinaries
env MAKE="$MAKE_CMD -j2" ARCH_OVERRIDE=$PLATFORM NIM_COMMIT=${{ matrix.branch }} \
QUICK_AND_DIRTY_COMPILER=1 QUICK_AND_DIRTY_NIMBLE=1 CC=gcc \
bash build_nim.sh nim csources dist/nimble NimBinaries
echo '${{ github.workspace }}/nim/bin' >> $GITHUB_PATH
- name: Run nim-ethash tests

3
.gitignore vendored
View File

@ -5,4 +5,5 @@ nimcache/
build/
*.so
*.dylib
*.a
*.a
*.exe

View File

@ -24,8 +24,8 @@ proc bit_length*[T: SomeInteger](n: T): T =
## Calculates how many bits are necessary to represent the number
when withBuiltins and T is TbuiltinSupported:
result = if n == T(0): 0 # Removing this branch would make divmod 4x faster :/
else: T.sizeof * 8 - builtin_clz(n)
result = if n == T(0): 0.T # Removing this branch would make divmod 4x faster :/
else: T(T.sizeof) * 8.T - builtin_clz(n).T
else:
var x = n

View File

@ -11,8 +11,8 @@ suite "[Internal] Testing multi-precision arithmetic":
randomize(42) # random seed for reproducibility
for _ in 0 ..< 10_000_000:
let
a = random(high(int)).uint64
b = random(high(int)).uint64
a = rand(high(int)).uint64
b = rand(high(int)).uint64
check: a * b == mulCarry(a, b).unit