mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-07 21:48:13 -08:00
feat: add Dockerfile / Docker-driven CI job
This commit is contained in:
parent
a1976273e7
commit
5aca0ea5b1
6 changed files with 99 additions and 138 deletions
126
.travis.yml
126
.travis.yml
|
|
@ -3,9 +3,8 @@ language: go
|
||||||
dist: xenial
|
dist: xenial
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
go:
|
services:
|
||||||
# - "1.13"
|
- docker
|
||||||
- "1.14"
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# - LIBVIPS=7.42.3
|
# - LIBVIPS=7.42.3
|
||||||
|
|
@ -29,118 +28,15 @@ cache:
|
||||||
directories:
|
directories:
|
||||||
- $HOME/libvips
|
- $HOME/libvips
|
||||||
|
|
||||||
addons:
|
before_install:
|
||||||
apt:
|
- docker build -t bimg:testing --build-arg LIBVIPS_VERSION=$LIBVIPS .
|
||||||
update: true
|
|
||||||
sources:
|
|
||||||
# use a more recent imagemagick instead of 6.8.9-9
|
|
||||||
- sourceline: 'ppa:cran/imagemagick'
|
|
||||||
- sourceline: 'ppa:strukturag/libheif'
|
|
||||||
- sourceline: 'ppa:strukturag/libde265'
|
|
||||||
packages:
|
|
||||||
- curl
|
|
||||||
- automake
|
|
||||||
- gtk-doc-tools
|
|
||||||
- gobject-introspection
|
|
||||||
- python3-pip
|
|
||||||
- python3-setuptools
|
|
||||||
- python3-wheel
|
|
||||||
- libfftw3-dev
|
|
||||||
- libexif-dev
|
|
||||||
- libjpeg-turbo8-dev
|
|
||||||
- libpng12-dev
|
|
||||||
- libwebp-dev
|
|
||||||
# missing on xenial, unfortunately
|
|
||||||
# - libwebpmux2
|
|
||||||
- libtiff5-dev
|
|
||||||
- libheif-dev
|
|
||||||
- libexpat1-dev
|
|
||||||
- libmagick++-dev
|
|
||||||
- libcfitsio3-dev
|
|
||||||
- libgsl0-dev
|
|
||||||
- libmatio-dev
|
|
||||||
- liborc-0.4-dev
|
|
||||||
- liblcms2-dev
|
|
||||||
- libpoppler-glib-dev
|
|
||||||
- librsvg2-dev
|
|
||||||
- libgif-dev
|
|
||||||
- libopenexr-dev
|
|
||||||
- libpango1.0-dev
|
|
||||||
- libgsf-1-dev
|
|
||||||
- libopenslide-dev
|
|
||||||
- libffi-dev
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- >
|
- docker run bimg:testing sh -c 'go vet . && golint . && go test -v -race -covermode=atomic -coverprofile=coverage.out'
|
||||||
cd /tmp && \
|
# - diff -u <(echo -n) <(gofmt -s -d ./)
|
||||||
curl -fsSLO https://github.com/libvips/libvips/releases/download/v${LIBVIPS}/vips-${LIBVIPS}.tar.gz && \
|
# - diff -u <(echo -n) <(go vet ./)
|
||||||
tar zvxf vips-${LIBVIPS}.tar.gz && \
|
# - diff -u <(echo -n) <(golint ./)
|
||||||
cd /tmp/vips-${LIBVIPS} && \
|
# - go test -v -race -covermode=atomic -coverprofile=coverage.out
|
||||||
test -f autogen.sh && ./autogen.sh || ./bootstrap.sh && \
|
|
||||||
CFLAGS="-g -O3" CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -g -O3" \
|
|
||||||
./configure \
|
|
||||||
--disable-debug \
|
|
||||||
--disable-dependency-tracking \
|
|
||||||
--disable-introspection \
|
|
||||||
--disable-static \
|
|
||||||
--enable-gtk-doc-html=no \
|
|
||||||
--enable-gtk-doc=no \
|
|
||||||
--enable-pyvips8=no \
|
|
||||||
--without-orc \
|
|
||||||
--without-python \
|
|
||||||
--prefix=$HOME/libvips $1 && \
|
|
||||||
make && \
|
|
||||||
make install && \
|
|
||||||
ldconfig
|
|
||||||
- cd ..
|
|
||||||
- export PATH=$PATH:$HOME/libvips/bin
|
|
||||||
- export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/libvips/lib/pkgconfig
|
|
||||||
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/libvips/lib
|
|
||||||
- vips --vips-version
|
|
||||||
- go get -u golang.org/x/lint/golint
|
|
||||||
|
|
||||||
# - >
|
# after_success:
|
||||||
# test "$LIBVIPS" != "master" -a "$LIBVIPS" \< "8.4" \
|
# - goveralls -coverprofile=coverage.out -service=travis-ci
|
||||||
# && wget http://www.vips.ecs.soton.ac.uk/supported/${LIBVIPS%.*}/vips-${LIBVIPS}.tar.gz -O vips.tgz \
|
|
||||||
# || echo ":-)"
|
|
||||||
# - >
|
|
||||||
# test "$LIBVIPS" != "master" -a "$LIBVIPS" \> "8.4" \
|
|
||||||
# && wget https://github.com/libvips/libvips/archive/v${LIBVIPS}.tar.gz -O vips.tgz \
|
|
||||||
# || echo ":-)"
|
|
||||||
# - >
|
|
||||||
# test $LIBVIPS == "master" \
|
|
||||||
# && wget https://github.com/libvips/libvips/archive/${LIBVIPS}.tar.gz -O vips.tgz \
|
|
||||||
# || echo ":-)"
|
|
||||||
# - mkdir libvips
|
|
||||||
# - tar xf vips.tgz -C libvips --strip-components 1
|
|
||||||
# - cd libvips
|
|
||||||
# - test -f autogen.sh && ./autogen.sh || ./bootstrap.sh
|
|
||||||
# - >
|
|
||||||
# CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
|
|
||||||
# ./configure
|
|
||||||
# --disable-debug
|
|
||||||
# --disable-dependency-tracking
|
|
||||||
# --disable-introspection
|
|
||||||
# --disable-static
|
|
||||||
# --enable-gtk-doc-html=no
|
|
||||||
# --enable-gtk-doc=no
|
|
||||||
# --enable-pyvips8=no
|
|
||||||
# --without-orc
|
|
||||||
# --without-python
|
|
||||||
# --prefix=$HOME/libvips
|
|
||||||
# $1
|
|
||||||
# - make
|
|
||||||
# - make install
|
|
||||||
# - cd ..
|
|
||||||
# - export PATH=$PATH:$HOME/libvips/bin
|
|
||||||
# - export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/libvips/lib/pkgconfig
|
|
||||||
# - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/libvips/lib
|
|
||||||
# - vips --vips-version
|
|
||||||
# script:
|
|
||||||
- diff -u <(echo -n) <(gofmt -s -d ./)
|
|
||||||
- diff -u <(echo -n) <(go vet ./)
|
|
||||||
- diff -u <(echo -n) <(golint ./)
|
|
||||||
- go test -v -race -covermode=atomic -coverprofile=coverage.out
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- goveralls -coverprofile=coverage.out -service=travis-ci
|
|
||||||
|
|
|
||||||
65
Dockerfile
Normal file
65
Dockerfile
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
FROM golang:1.14
|
||||||
|
LABEL maintainer "tomas@aparicio.me"
|
||||||
|
|
||||||
|
ARG LIBVIPS_VERSION=8.9.2
|
||||||
|
ARG GOLANGCILINT_VERSION=1.23.3
|
||||||
|
|
||||||
|
# Installs libvips + required libraries
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install --no-install-recommends -y \
|
||||||
|
ca-certificates \
|
||||||
|
automake build-essential curl \
|
||||||
|
gobject-introspection gtk-doc-tools libglib2.0-dev libjpeg62-turbo-dev libpng-dev \
|
||||||
|
libwebp-dev libtiff5-dev libgif-dev libexif-dev libxml2-dev libpoppler-glib-dev \
|
||||||
|
swig libmagickwand-dev libpango1.0-dev libmatio-dev libopenslide-dev libcfitsio-dev \
|
||||||
|
libgsf-1-dev fftw3-dev liborc-0.4-dev librsvg2-dev libimagequant-dev libheif-dev && \
|
||||||
|
cd /tmp && \
|
||||||
|
curl -fsSLO https://github.com/libvips/libvips/releases/download/v${LIBVIPS_VERSION}/vips-${LIBVIPS_VERSION}.tar.gz && \
|
||||||
|
tar zvxf vips-${LIBVIPS_VERSION}.tar.gz && \
|
||||||
|
cd /tmp/vips-${LIBVIPS_VERSION} && \
|
||||||
|
CFLAGS="-g -O3" CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0 -g -O3" \
|
||||||
|
./configure \
|
||||||
|
--disable-debug \
|
||||||
|
--disable-dependency-tracking \
|
||||||
|
--disable-introspection \
|
||||||
|
--disable-static \
|
||||||
|
--enable-gtk-doc-html=no \
|
||||||
|
--enable-gtk-doc=no \
|
||||||
|
--enable-pyvips8=no \
|
||||||
|
--prefix=/vips && \
|
||||||
|
make && \
|
||||||
|
make install && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
# Install runtime dependencies
|
||||||
|
# RUN DEBIAN_FRONTEND=noninteractive \
|
||||||
|
# apt-get update && \
|
||||||
|
# apt-get install --no-install-recommends -y \
|
||||||
|
# libglib2.0-0 libjpeg62-turbo libpng16-16 libopenexr23 \
|
||||||
|
# libwebp6 libwebpmux3 libwebpdemux2 libtiff5 libgif7 libexif12 libxml2 libpoppler-glib8 \
|
||||||
|
# libmagickwand-6.q16-6 libpango1.0-0 libmatio4 libopenslide0 \
|
||||||
|
# libgsf-1-114 fftw3 liborc-0.4-0 librsvg2-2 libcfitsio7 libimagequant0 libheif1 && \
|
||||||
|
# apt-get autoremove -y && \
|
||||||
|
# apt-get autoclean && \
|
||||||
|
# apt-get clean && \
|
||||||
|
# rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
# Install Go lint
|
||||||
|
RUN go get -u golang.org/x/lint/golint
|
||||||
|
|
||||||
|
ENV LD_LIBRARY_PATH="/vips/lib:$LD_LIBRARY_PATH"
|
||||||
|
ENV PKG_CONFIG_PATH="/vips/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig"
|
||||||
|
|
||||||
|
WORKDIR ${GOPATH}/src/github.com/h2non/bimg
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# RUN \
|
||||||
|
# # Clean up
|
||||||
|
# apt-get remove -y automake curl build-essential && \
|
||||||
|
# apt-get autoremove -y && \
|
||||||
|
# apt-get autoclean && \
|
||||||
|
# apt-get clean && \
|
||||||
|
# rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
CMD [ "/bin/bash" ]
|
||||||
|
|
@ -224,5 +224,5 @@ type Options struct {
|
||||||
Threshold float64
|
Threshold float64
|
||||||
Gamma float64
|
Gamma float64
|
||||||
OutputICC string
|
OutputICC string
|
||||||
InputICC string
|
InputICC string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ func saveImage(image *C.VipsImage, o Options) ([]byte, error) {
|
||||||
Interlace: o.Interlace,
|
Interlace: o.Interlace,
|
||||||
NoProfile: o.NoProfile,
|
NoProfile: o.NoProfile,
|
||||||
Interpretation: o.Interpretation,
|
Interpretation: o.Interpretation,
|
||||||
InputICC: o.InputICC,
|
InputICC: o.InputICC,
|
||||||
OutputICC: o.OutputICC,
|
OutputICC: o.OutputICC,
|
||||||
StripMetadata: o.StripMetadata,
|
StripMetadata: o.StripMetadata,
|
||||||
Lossless: o.Lossless,
|
Lossless: o.Lossless,
|
||||||
|
|
|
||||||
|
|
@ -591,22 +591,22 @@ func TestIfBothSmartCropOptionsAreIdentical(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSkipCropIfTooSmall(t *testing.T) {
|
func TestSkipCropIfTooSmall(t *testing.T) {
|
||||||
testCases := [] struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
options Options
|
options Options
|
||||||
} {
|
}{
|
||||||
{
|
{
|
||||||
name: "smart crop",
|
name: "smart crop",
|
||||||
options: Options{
|
options: Options{
|
||||||
Width: 140,
|
Width: 140,
|
||||||
Height: 140,
|
Height: 140,
|
||||||
Crop: true,
|
Crop: true,
|
||||||
Gravity: GravitySmart,
|
Gravity: GravitySmart,
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "centre crop",
|
name: "centre crop",
|
||||||
options: Options{
|
options: Options{
|
||||||
Width: 140,
|
Width: 140,
|
||||||
Height: 140,
|
Height: 140,
|
||||||
Crop: true,
|
Crop: true,
|
||||||
|
|
@ -615,19 +615,19 @@ func TestSkipCropIfTooSmall(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "embed",
|
name: "embed",
|
||||||
options: Options{
|
options: Options{
|
||||||
Width: 140,
|
Width: 140,
|
||||||
Height: 140,
|
Height: 140,
|
||||||
Embed: true,
|
Embed: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "extract",
|
name: "extract",
|
||||||
options: Options{
|
options: Options{
|
||||||
Top: 0,
|
Top: 0,
|
||||||
Left: 0,
|
Left: 0,
|
||||||
AreaWidth: 140,
|
AreaWidth: 140,
|
||||||
AreaHeight: 140,
|
AreaHeight: 140,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
vips.go
2
vips.go
|
|
@ -52,7 +52,7 @@ type vipsSaveOptions struct {
|
||||||
NoProfile bool
|
NoProfile bool
|
||||||
StripMetadata bool
|
StripMetadata bool
|
||||||
Lossless bool
|
Lossless bool
|
||||||
InputICC string // Absolute path to the input ICC profile
|
InputICC string // Absolute path to the input ICC profile
|
||||||
OutputICC string // Absolute path to the output ICC profile
|
OutputICC string // Absolute path to the output ICC profile
|
||||||
Interpretation Interpretation
|
Interpretation Interpretation
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue