diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 831440d..55c9e9d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,66 +1,19 @@ -name: website +name: CI -#on: [push] # debugging only -on: - push: - tags: - - '[0-9]+.[0-9]+.[0-9]+' +on: [push, pull_request] jobs: - publish: - runs-on: ubuntu-latest + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macOS-latest, windows-latest] steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set output - id: vars - run: echo ::set-output name=tag::${GITHUB_REF:10} - - name: Cache choosenim - id: cache-choosenim - uses: actions/cache@v1 - with: - path: ~/.choosenim - key: ${{ runner.os }}-choosenim-stable - - name: Cache nimble - id: cache-nimble - uses: actions/cache@v1 - with: - path: ~/.nimble - key: ${{ runner.os }}-nimble-stable - - uses: jiro4989/setup-nim-action@v1 - with: - nim-version: 'stable' - - name: Install libsnappy - run: sudo apt-get install libsnappy1v5 - - name: Install leveldb c library - run: | - wget http://ftp.us.debian.org/debian/pool/main/l/leveldb/libleveldb1d_1.22-3_amd64.deb - wget http://ftp.us.debian.org/debian/pool/main/l/leveldb/libleveldb-dev_1.22-3_amd64.deb - sudo dpkg -i *.deb - - name: Build and test - env: - RELEASE_VERSION: ${{ steps.vars.outputs.tag }} - run: | - nimble build -Y - nimble test -Y - - name: Build doc - env: - RELEASE_VERSION: ${{ steps.vars.outputs.tag }} - run: | - # Due to bug https://github.com/nim-lang/Nim/issues/14281, compile the documentation separately. - nimble doc --project --git.url:https://github.com/$GITHUB_REPOSITORY --git.commit:$RELEASE_VERSION src/leveldb.nim - find . - # Deploying documentation of the latest version. - mkdir -p ./public - mv src/htmldocs/* public/ - cd ./public/ - ln -s ./leveldb.html index.html - cd ../ - - name: Deploy - if: success() - uses: crazy-max/ghaction-github-pages@v1.3.0 - with: - target_branch: gh-pages - build_dir: ./public - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + with: + submodules: true + - uses: iffy/install-nim@v3 + - name: Build + run: nimble install -y + - name: Test + run: nimble test -y diff --git a/build.sh b/build.sh index 60fb27c..1e02541 100644 --- a/build.sh +++ b/build.sh @@ -6,11 +6,27 @@ if ! [ -x "$(command -v toast)" ]; then nimble install -y nimterop@0.6.13 fi +cmake -S "${root}/sources" -B "${root}/build" + +# prelude: not needed? + +echo >> "${root}/leveldb.nim" + +# assemble files to be compiled: +extensions="c cc cpp" +for ext in ${extensions}; do + echo ${ext} + for file in `find "${root}/sources" -type f -name "*.${ext}"`; do + echo ${file} + done +done + # generate nim wrapper with nimterop -toast \ - --compile="${root}/sources/randombytes.c" \ - --compile="${root}/sources/hazmat.c" \ - --pnim \ - --noHeader \ - "${root}/sources/randombytes.h" \ - "${root}/sources/hazmat.h" > "${root}/sss/cwrapper.nim" +#toast \ +# --compile="${root}/sources/randombytes.c" \ +# --compile="${root}/sources/hazmat.c" \ +# --pnim \ +# --noHeader \ +# "${root}/sources/randombytes.h" \ +# "${root}/sources/hazmat.h" > "${root}/sss/cwrapper.nim" +~ ~ ~ \ No newline at end of file