Fix broken CI (#35)

* Remove appveyor and travis scripts

* Fix broken CI

* Fix set pointer field to nil with typed nil

* Add liblz4 in CI deps of linux i386
This commit is contained in:
andri lim 2024-02-13 20:59:41 +07:00 committed by GitHub
parent 724b72fe10
commit 5e2b026f84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 33 additions and 108 deletions

View File

@ -1,50 +0,0 @@
version: '{build}'
image: Visual Studio 2015
cache:
- nimbus-deps.zip -> .appveyor.yml
- NimBinaries
matrix:
# We always want 32 and 64-bit compilation
fast_finish: false
platform:
- x86
- x64
# when multiple CI builds are queued, the tested commit needs to be in the last X commits cloned with "--depth X"
clone_depth: 10
install:
- SET "ROCKSDB_URL=https://github.com/status-im/nimbus-deps/releases/download/nimbus-deps/nimbus-deps.zip"
- SET "ROCKSDB_ARCHIVE=nimbus-deps.zip"
# use the newest versions documented here: https://www.appveyor.com/docs/windows-images-software/#mingw-msys-cygwin
- IF "%PLATFORM%" == "x86" SET PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin;%PATH%
- IF "%PLATFORM%" == "x64" SET PATH=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%PATH%
- MKDIR %CD%\bin
- SET PATH=%CD%\bin;%CD%\Nim\bin;%PATH%
# Unpack rocksdb
- IF not exist "%ROCKSDB_ARCHIVE%" appveyor DownloadFile "%ROCKSDB_URL%" -FileName "%ROCKSDB_ARCHIVE%"
- 7z x -y "%ROCKSDB_ARCHIVE%" > nul
- IF "%PLATFORM%" == "x64" ( copy %CD%\x64\librocksdb.dll %CD%\bin\librocksdb.dll ) ELSE ( copy %CD%\x86\librocksdb.dll %CD%\bin\librocksdb.dll )
# build nim from our own branch - this to avoid the day-to-day churn and
# regressions of the fast-paced Nim development while maintaining the
# flexibility to apply patches
- curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh
- env MAKE="mingw32-make -j2" ARCH_OVERRIDE=%PLATFORM% bash build_nim.sh Nim csources dist/nimble NimBinaries
build_script:
- cd C:\projects\%APPVEYOR_PROJECT_SLUG%
- bash -c "nimble install -y"
test_script:
- nimble test
deploy: off

View File

@ -22,15 +22,15 @@ jobs:
cpu: amd64
#- os: windows
#cpu: i386
branch: [version-1-2, version-1-4, version-1-6, devel]
branch: [version-1-6, version-2-0, devel]
include:
- target:
os: linux
builder: ubuntu-18.04
builder: ubuntu-20.04
shell: bash
- target:
os: macos
builder: macos-10.15
builder: macos-11
shell: bash
- target:
os: windows
@ -43,10 +43,10 @@ jobs:
name: '${{ matrix.target.os }}-${{ matrix.target.cpu }} (Nim ${{ matrix.branch }})'
runs-on: ${{ matrix.builder }}
continue-on-error: ${{ matrix.branch == 'version-1-6' || matrix.branch == 'devel' }}
#continue-on-error: ${{ matrix.branch == 'version-1-6' || matrix.branch == 'devel' }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true
@ -57,7 +57,7 @@ jobs:
sudo apt-fast update -qq
sudo DEBIAN_FRONTEND='noninteractive' apt-fast install \
--no-install-recommends -yq gcc-multilib g++-multilib \
libz-dev:i386 libbz2-dev:i386 libssl-dev:i386
libz-dev:i386 libbz2-dev:i386 libssl-dev:i386 liblz4-dev:i386
mkdir -p external/bin
cat << EOF > external/bin/gcc
#!/bin/bash
@ -73,7 +73,7 @@ jobs:
- name: Restore rocksdb from cache (Linux + macOS)
if: runner.os != 'Windows'
id: rocksdb-cache
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: rocks-db-cache-${{ matrix.target.cpu }}
key: 'rocksdb-v1-${{ matrix.target.os }}-${{ matrix.target.cpu }}'
@ -116,7 +116,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@v4
with:
path: external/dlls-${{ matrix.target.cpu }}
key: 'dlls-${{ matrix.target.cpu }}'

4
.gitignore vendored
View File

@ -1,4 +1,6 @@
nimcache/
# Executables shall be put in an ignored build/ directory
build/
build/
nimble.paths

View File

@ -1,45 +0,0 @@
language: c
# https://docs.travis-ci.com/user/caching/
cache:
directories:
- NimBinaries
- rocksdbCache
git:
# when multiple CI builds are queued, the tested commit needs to be in the last X commits cloned with "--depth X"
depth: 10
matrix:
include:
# Build and test using both gcc and clang
# For faster testing we don't test clang on linux, only on macOS
- os: linux
compiler: gcc
sudo: required
before_install:
- export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
- os: osx
compiler: clang
before_install:
- launchctl setenv LIBRARY_PATH /usr/local/lib # for RocksDB
install:
# build nim from our own branch - this to avoid the day-to-day churn and
# regressions of the fast-paced Nim development while maintaining the
# flexibility to apply patches
- curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_nim.sh
- env MAKE="make -j2" bash build_nim.sh Nim csources dist/nimble NimBinaries
- export PATH=$PWD/Nim/bin:$PATH
# build our own rocksdb to test with a fixed version that we think works
- curl -O -L -s -S https://raw.githubusercontent.com/status-im/nimbus-build-system/master/scripts/build_rocksdb.sh
- bash build_rocksdb.sh rocksdbCache
script:
- nimble install -y
- nimble test
branches:
except:
- gh-pages

13
config.nims Normal file
View File

@ -0,0 +1,13 @@
# nim-rocksdb
# Copyright (c) 2019-2023 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
# at your option.
# This file may not be copied, modified, or distributed except according to
# those terms.
# begin Nimble config (version 1)
when fileExists("nimble.paths"):
include "nimble.paths"
# end Nimble config

View File

@ -214,18 +214,23 @@ proc backup*(db: RocksDBInstance): RocksDBResult[void] =
# https://github.com/nim-lang/Nim/issues/8112
# proc `=destroy`*(db: var RocksDBInstance) =
proc close*(db: var RocksDBInstance) =
template freeField(name) =
template freeField(name) =
type FieldType = typeof db.`name`
if db.`name`.isNil:
`rocksdb name destroy`(db.`name`)
db.`name` = nil
db.`name` = FieldType(nil)
template setFieldToNil(name) =
type FieldType = typeof db.`name`
db.`name` = FieldType(nil)
freeField(writeOptions)
freeField(readOptions)
freeField(options)
if not db.backupEngine.isNil:
rocksdb_backup_engine_close(db.backupEngine)
db.backupEngine = nil
setFieldToNil(backupEngine)
if not db.db.isNil:
rocksdb_close(db.db)
db.db = nil
setFieldToNil(db)