diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..ccbc925 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,35 @@ +name: CI + +on: [push] + +jobs: + test: + + runs-on: ubuntu-18.04 + + strategy: + fail-fast: false + max-parallel: 4 + matrix: + compiler: [dmd, ldc, dmd-beta, ldc-beta] + + steps: + - uses: actions/checkout@v1 + + - name: download-tf + run: | + mkdir -p download + cd download + wget https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz + tar xvf libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz + + - name: test + run: | + source $(curl https://dlang.org/install.sh | bash -s -- ${{ matrix.compiler }} -a) + LIBRARY_PATH=`pwd`/download/lib + LD_LIBRARY_PATH=`pwd`/download/lib + dub test --parallel -b=unittest-cov + + - name: codecov + if: ${{ matrix.compiler == 'dmd' }} + run: bash <(curl -s https://codecov.io/bash) diff --git a/.github/workflows/ci.yml b/.github/workflows/windows.yml similarity index 51% rename from .github/workflows/ci.yml rename to .github/workflows/windows.yml index 77daaa0..7e426d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/windows.yml @@ -3,42 +3,7 @@ name: CI on: [push] jobs: - test-linux: - - runs-on: ubuntu-18.04 - - strategy: - fail-fast: false - max-parallel: 4 - matrix: - compiler: [dmd, ldc, dmd-beta, ldc-beta] - - steps: - - uses: actions/checkout@v1 - # with: - # submodules: true - - - name: download-tf - run: | - mkdir -p download - cd download - wget https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz - tar xvf libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz - - - name: test - run: | - source $(curl https://dlang.org/install.sh | bash -s -- ${{ matrix.compiler }} -a) - LIBRARY_PATH=`pwd`/download/lib - LD_LIBRARY_PATH=`pwd`/download/lib - dub test --parallel -b=unittest-cov - - - name: codecov - if: ${{ matrix.compiler == 'dmd' }} - run: bash <(curl -s https://codecov.io/bash) - - - test-windows: - + test: runs-on: windows-2019 strategy: @@ -49,8 +14,6 @@ jobs: steps: - uses: actions/checkout@v1 - # with: - # submodules: true - name: download-tf run: | diff --git a/Makefile b/Makefile deleted file mode 100644 index 0614c6c..0000000 --- a/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -PROTOC_VERSION := 1.3.3 - -.PHONY: all clean - -all: source/tfd/c_api.d # generated/tensorflow/op_def_pb.d generated/lib/libtensorflow_pb.a - -# Generate D bindings -%.d: %.dpp download/include/tensorflow/c/c_api.h - dub run dpp -- --preprocess-only --include-path ./download/include $< - -generated/tensorflow/c_api.d: download/include/tensorflow/c/c_api.h - bash ./dpp.sh tensorflow/c/c_api.h $@ tensorflow.c_api - -generated/tensorflow/op_def_pb.d: generated/tensorflow/core/framework/op_def.pb-c.h - bash ./dpp.sh tensorflow/core/framework/op_def.pb-c.h $@ tensorflow.op_def_pb - - -# Download deps -download/include/tensorflow/c/c_api.h: - mkdir -p download - cd download && wget https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz - cd download && tar xvf libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz - -download/bin/protoc-c: - mkdir -p download - cd download && wget https://github.com/protobuf-c/protobuf-c/releases/download/v$(PROTOC_VERSION)/protobuf-c-$(PROTOC_VERSION).tar.gz - cd download && tar xvf protobuf-c-$(PROTOC_VERSION).tar.gz - cd download/protobuf-c-$(PROTOC_VERSION) && ./configure --prefix=$(PWD)/download && make -j4 && make install - - -# Generate ProtocolBuffer in C -generated/tensorflow/core/framework/op_def.pb-c.h: download/include/tensorflow/c/c_api.h download/bin/protoc-c - mkdir -p generated - cd tensorflow && ../download/bin/protoc-c --c_out=../generated tensorflow/core/framework/*.proto - -generated/lib/libtensorflow_pb.a: generated/tensorflow/core/framework/op_def.pb-c.h - mkdir -p generated/lib - cd generated/lib && gcc -c ../tensorflow/core/framework/*.c -I.. -I../../download/include && ar rcs libtensorflow_pb.a *.o && rm *.o - - -clean: - dub clean - rm -rfv generated - -test: all - LIBRARY_PATH=`pwd`/download/lib && LD_LIBRARY_PATH=`pwd`/download/lib && dub test --parallel -b=unittest-cov diff --git a/README.md b/README.md index 88fd784..dd1f11d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # tfd: tensorflow for D -![CI](https://github.com/ShigekiKarita/tfd/workflows/CI/badge.svg) +[![linux](https://github.com/ShigekiKarita/tfd/workflows/linux/badge.svg)](https://github.com/ShigekiKarita/tfd/actions?query=workflow:linux) +[![windows](https://github.com/ShigekiKarita/tfd/workflows/windows/badge.svg)](https://github.com/ShigekiKarita/tfd/actions?query=workflow:windows) [![codecov](https://codecov.io/gh/ShigekiKarita/tfd/branch/master/graph/badge.svg)](https://codecov.io/gh/ShigekiKarita/tfd) [![Dub version](https://img.shields.io/dub/v/tfd.svg)](https://code.dlang.org/packages/tfd) diff --git a/dpp.sh b/dpp.sh deleted file mode 100755 index 16b7cca..0000000 --- a/dpp.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!bash - -set -euo - -# e.g., tensorflow/c/c_api.h -cfile=$1 -# e.g., generated/tensorflow/c_api.d -dfile=$2 -# e.g., tensorflow.c_api -dmodule=$3 -mkdir -p $(dirname $dfile) -echo "module ${dmodule}; -#include <${cfile}>" > ${dfile}pp - -# dub fetch dpp -dub run dpp -- --preprocess-only \ - --include-path ./download/include \ - --include-path ./generated \ - --include-path tensorflow/ ${dfile}pp