Skip to content

Commit

Permalink
add github action based CI
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Apr 11, 2023
1 parent c655c56 commit 2caae69
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 40 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/run_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: ZMat CI

on: [push, pull_request]

jobs:
octave_test:
name: Octave tests
strategy:
# provided octave versions: ubuntu-20.04 = 5.2, ubuntu-22.04 = 6.4, macos-11 = 8.1, windows-2019 = 7.3
matrix:
os: [ubuntu-20.04, ubuntu-22.04, macos-11, windows-2019]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash

steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Install dependencies
run: |
[[ "$RUNNER_OS" == "Linux" ]] && sudo apt-get update && sudo apt-get install -y octave
[[ "$RUNNER_OS" == "macOS" ]] && brew install octave
if [[ "$RUNNER_OS" == "Windows" ]]; then
curl --retry 3 -kL http://cdimage.debian.org/mirror/gnu.org/gnu/octave/windows/octave-7.3.0-w64-64.7z --output octave_7.3.0.7z
7z x octave_7.3.0.7z -ooctave -y
echo "$PWD/octave/octave-7.3.0-w64-64/mingw64/bin" >> $GITHUB_PATH
fi
- name: Build static library
run: |
make -C src lib
make -C example/c all LIBTYPE=
if [ "$TRAVIS_OS_NAME" = "macOS" ]; then
DYLD_LIBRARY_PATH=lib example/c/testzmat;
else
LD_LIBRARY_PATH=lib example/c/testzmat;
fi
- name: Build dynamic library
run: |
make -C src dll
make -C example/c all LIBTYPE=
if [ "$RUNNER_OS" = "macOS" ]; then
DYLD_LIBRARY_PATH=lib example/c/testzmat;
else
LD_LIBRARY_PATH=lib example/c/testzmat;
fi
- name: Build octave mex
run: |
make -C src oct;
- name: Run octave test
run: |
octave-cli --version
octave-cli --eval "addpath(pwd);cd test;run_zmat_test";
matlab_test:
name: MATLAB test
strategy:
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
- name: Build octave mex
run: |
make -C src mex;
- name: Run MATLAB examples
uses: matlab-actions/run-command@v1
with:
command: addpath(pwd);cd test;run_zmat_test
18 changes: 4 additions & 14 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ ZMATDIR ?=$(ROOTDIR)
LIBDIR ?=$(ROOTDIR)/lib

MKDIR :=mkdir
HAVE_MINIZ ?=no
HAVE_LZMA ?=yes
HAVE_LZ4 ?=yes
HAVE_ZSTD ?=yes
Expand Down Expand Up @@ -65,14 +64,6 @@ else
endif
endif

ifeq ($(HAVE_MINIZ),no)
CFLAGS+=-DNO_MINIZ
LINKOPT+=-lz
else
INCLUDEDIRS+=-Iminiz
FILES+=miniz/miniz
endif

ifeq ($(HAVE_LZMA),no)
CFLAGS+=-DNO_LZMA
else
Expand Down Expand Up @@ -131,16 +122,15 @@ ifeq ($(MAKECMDGOALS),dll)
OUTPUTFLAG :=-o
BINARY :=libzmat.so.1
OUTPUT_DIR :=$(LIBDIR)
LINKOPT +=-lz

ifeq ($(findstring Darwin,$(PLATFORM)), Darwin)
ARFLAGS :=-shared -Wl,-install_name,$(BINARY)
ARFLAGS :=-shared -Wl,-install_name,$(BINARY) -lz
else
ARFLAGS :=-shared -Wl,-soname,$(BINARY)
ARFLAGS :=-shared -Wl,-soname,$(BINARY) -lz
endif
endif

export HAVE_MINIZ HAVE_LZ4 HAVE_ZSTD

dll: CPPOPT +=$(DLLFLAG)
dll: ARFLAGS ?=-shared -Wl,-soname,$(BINARY).1
dll: LINKOPT +=$(LDFLAGS)
Expand All @@ -156,7 +146,7 @@ oct: LINKOPT+=--mex $(INCLUDEDIRS)
mex: CXX=$(MEX)
mex: OUTPUTFLAG:=-output
mex: AR=$(MEX) zmat.cpp $(INCLUDEDIRS)
mex: LINKOPT+= -cxx CXXLIBS='$$CXXLIBS -static-libgcc -static-libstdc++' -outdir $(ZMATDIR)
mex: LINKOPT+= -cxx CXXLIBS='$$CXXLIBS -lz -static-libgcc -static-libstdc++' -outdir $(ZMATDIR)
mex: ARFLAGS :=
mex: OUTPUT_DIR=..

Expand Down
21 changes: 1 addition & 20 deletions src/blosc2/blosc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ ECHO := echo
BINARY:=blosc2
OUTPUT_DIR=$(ZMATDIR)

HAVE_MINIZ ?=yes
HAVE_LZ4 ?=yes
HAVE_ZSTD ?=yes

DOXY := doxygen
DOCDIR := $(ZMATDIR)/doc
DOXYCFG=zmat.cfg
Expand All @@ -36,22 +32,7 @@ PLATFORM = $(shell uname -s)

DLLFLAG=-fPIC

CPPOPT=-g -Wall -Wextra -O3 -msse2 -DNDEBUG $(DLLFLAG) -std=gnu99 #-g -Wall -std=c99 # -DUSE_OS_TIMER

ifeq ($(HAVE_MINIZ),yes)
CPPOPT+= -DHAVE_MINIZ
else
CPPOPT+= -DHAVE_ZLIB
endif

ifeq ($(HAVE_LZ4),yes)
CPPOPT+= -DHAVE_LZ4
endif

ifeq ($(HAVE_ZSTD),yes)
CPPOPT+= -DHAVE_ZSTD
endif

CPPOPT=-g -Wall -Wextra -O3 -msse2 -DHAVE_ZSTD -DHAVE_ZLIB -DHAVE_LZ4 -DNDEBUG $(DLLFLAG) -std=gnu99 #-g -Wall -std=c99 # -DUSE_OS_TIMER

OUTPUTFLAG:=-o
OBJSUFFIX=.o
Expand Down
7 changes: 1 addition & 6 deletions src/zmatlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@
#include <assert.h>

#include "zmatlib.h"

#ifndef NO_MINIZ
#include "miniz.h"
#else
#include "zlib.h"
#endif
#include "zlib.h"

#ifndef NO_LZMA
#include "easylzma/compress.h"
Expand Down

0 comments on commit 2caae69

Please sign in to comment.