From 5e2b026f841fa57b10e669a2ab1d88a0e40f6bbe Mon Sep 17 00:00:00 2001 From: andri lim Date: Tue, 13 Feb 2024 20:59:41 +0700 Subject: [PATCH] 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 --- .appveyor.yml | 50 ---------------------------------------- .github/workflows/ci.yml | 16 ++++++------- .gitignore | 4 +++- .travis.yml | 45 ------------------------------------ config.nims | 13 +++++++++++ rocksdb.nim | 13 +++++++---- 6 files changed, 33 insertions(+), 108 deletions(-) delete mode 100644 .appveyor.yml delete mode 100644 .travis.yml create mode 100644 config.nims diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 4717958..0000000 --- a/.appveyor.yml +++ /dev/null @@ -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 - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 961d9f0..2de3f9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }}' diff --git a/.gitignore b/.gitignore index b282186..a10c7af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ nimcache/ # Executables shall be put in an ignored build/ directory -build/ \ No newline at end of file +build/ + +nimble.paths diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a0f13ef..0000000 --- a/.travis.yml +++ /dev/null @@ -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 diff --git a/config.nims b/config.nims new file mode 100644 index 0000000..1f5d13e --- /dev/null +++ b/config.nims @@ -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 diff --git a/rocksdb.nim b/rocksdb.nim index f7878ab..3578789 100644 --- a/rocksdb.nim +++ b/rocksdb.nim @@ -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)