From 40e332c4f033879d0f23e79b47acf2b8dfb92bbd Mon Sep 17 00:00:00 2001 From: DarthSim Date: Thu, 31 Mar 2022 16:10:08 +0600 Subject: [PATCH] Lint with GH actions --- {.circleci => .github/workflows}/Dockerfile | 22 ++++++------ .github/workflows/lint.yml | 40 +++++++++++++++++++++ 2 files changed, 50 insertions(+), 12 deletions(-) rename {.circleci => .github/workflows}/Dockerfile (80%) create mode 100644 .github/workflows/lint.yml diff --git a/.circleci/Dockerfile b/.github/workflows/Dockerfile similarity index 80% rename from .circleci/Dockerfile rename to .github/workflows/Dockerfile index 7f5ee8f9..d2619e88 100644 --- a/.circleci/Dockerfile +++ b/.github/workflows/Dockerfile @@ -7,16 +7,8 @@ RUN apt-get -qq update \ build-essential \ curl \ git \ - mercurial \ - make \ - binutils \ - bison \ - gcc \ - gobject-introspection \ libglib2.0-dev \ - libexpat1-dev \ libxml2-dev \ - libfftw3-dev \ libjpeg-dev \ libpng-dev \ libwebp-dev \ @@ -27,9 +19,8 @@ RUN apt-get -qq update \ libavformat-dev \ libavutil-dev \ libswscale-dev \ - libopencv-dev - -RUN curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer | bash - + libopencv-core-dev \ + libopencv-dnn-dev RUN \ mkdir /root/vips \ @@ -59,7 +50,14 @@ RUN \ && rm -rf $VIPS_RELEASE.tar.gz vips-$VIPS_RELEASE; \ done +RUN echo "Name: OpenCV\n" \ + "Description: Open Source Computer Vision Library\n" \ + "Version: 4.5.1\n" \ + "Libs: -L/usr/lib/x86_64-linux-gnu -lopencv_dnn -lopencv_imgproc -lopencv_core\n" \ + "Libs.private: -ldl -lm -lpthread -lrt\n" \ + "Cflags: -I/usr/include/opencv4\n" \ + > /usr/lib/x86_64-linux-gnu/pkgconfig/opencv4.pc + WORKDIR /go/src -ENV GOPATH=/go ENTRYPOINT [ "/bin/bash" ] diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..8e20fd70 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,40 @@ +name: Lint + +on: + - push + - pull_request + +env: + CGO_LDFLAGS_ALLOW: "-s|-w" + +jobs: + lint: + runs-on: ubuntu-latest + container: + image: darthsim/imgproxy-ci:latest + strategy: + matrix: + go-version: ["1.18.x"] + vips-version: ["8.12"] + steps: + - name: Checkout + uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Cache mods + uses: actions/cache@v3 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + - name: Download mods + run: go mod download + - name: Lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.45.2 + args: --timeout 2m0s + skip-cache: true + env: + LD_LIBRARY_PATH: "${{ env.LD_LIBRARY_PATH }}:/root/vips/${{ matrix.vips-version }}/lib" + PKG_CONFIG_PATH: "${{ env.PKG_CONFIG_PATH }}:/root/vips/${{ matrix.vips-version }}/lib/pkgconfig"