Skip to content

Commit

Permalink
add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
godzie44 committed Apr 9, 2021
1 parent 8715bf9 commit f1f1d5c
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: golangci-lint
on:
push:
branches:
- master
- main
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install libxls
run: |
wget https://github.com/libxls/libxls/releases/download/v1.6.2/libxls-1.6.2.tar.gz \
&& tar -xzvf libxls-1.6.2.tar.gz \
&& cd libxls-1.6.2 \
&& ./configure \
&& sudo make \
&& sudo make install \
&& sudo ldconfig /etc/ld.so.conf.d
shell: bash

- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.29
env:
CGO_LDFLAGS: "-lxlsreader"
50 changes: 50 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "tests"
on:
pull_request:
push:
branches:
- master
- main
jobs:
test:
strategy:
matrix:
go-version: [1.16.x]
platform: [ubuntu-latest]

runs-on: ${{ matrix.platform }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Install libxls
run: |
wget https://github.com/libxls/libxls/releases/download/v1.6.2/libxls-1.6.2.tar.gz \
&& tar -xzvf libxls-1.6.2.tar.gz \
&& cd libxls-1.6.2 \
&& ./configure \
&& sudo make \
&& sudo make install \
&& sudo ldconfig /etc/ld.so.conf.d
shell: bash

- name: Test
run: CGO_LDFLAGS=-lxlsreader go test ./...

- name: Calc coverage
run: |
CGO_LDFLAGS=-lxlsreader go test -coverpkg=./... ./... -count=1 -coverprofile=cover.cov.tmp -v
cat cover.cov.tmp | grep -v "main.go" > profile.cov
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
GO111MODULE=off go get github.com/mattn/goveralls
$(go env GOPATH)/bin/goveralls -coverprofile=profile.cov -service=github

0 comments on commit f1f1d5c

Please sign in to comment.