Skip to content

Commit

Permalink
Merge pull request #258 from go-shiori/ci
Browse files Browse the repository at this point in the history
Add GitHub Action to lint code and run unit tests on supported platforms + Go versions.
  • Loading branch information
deanishe authored Aug 6, 2020
2 parents acc86d7 + c5fd200 commit 7124dc2
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/zsh -e

golint -set_exit_status ./...
go mod tidy -v
55 changes: 55 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x

- name: Check out code
uses: actions/checkout@v2

- name: Install golint
run: go get golang.org/x/lint/golint

- name: Lint Go source code
run: golint -set_exit_status ./...

test:
name: Unit tests
strategy:
matrix:
go-version: [1.12.x, 1.13.x, 1.14.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Check out code
uses: actions/checkout@v2

- name: Fetch dependencies
run: |
go get -v -t -d ./...
- name: Run unit tests
run: go test ./...

# - name: Codecov
# if: ${{ matrix.go-version == '1.14.x' && matrix.platform == 'ubuntu-latest' }}
# uses: codecov/codecov-action@v1
# with:
# file: coverage.out
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
/shiori*

# Exclude development data
/dev-data
/dev-data

# Coverage data
/coverage.out
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Shiori

[![CI](https://github.com/go-shiori/shiori/workflows/CI/badge.svg)](https://github.com/go-shiori/shiori/actions?query=workflow%3ACI)
[![Go Report Card](https://goreportcard.com/badge/github.com/go-shiori/shiori)](https://goreportcard.com/report/github.com/go-shiori/shiori)
[![Docker Image](https://img.shields.io/static/v1?label=image&message=Docker&color=1488C6&logo=docker)](https://hub.docker.com/r/radhifadlillah/shiori)
[![Deploy Heroku](https://img.shields.io/static/v1?label=deploy&message=Heroku&color=430098&logo=heroku)](https://heroku.com/deploy)
Expand Down
31 changes: 31 additions & 0 deletions modd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
modd.conf
**/*.go {
prep: "
# run tests
go test -cover @dirmods
"
}

modd.conf
**/*.go
!**/*_test.go {
prep: "
# build
go build -v -tags dev
"
}

modd.conf
internal/view/** {
prep: "
# compile static assets
go generate ./...
"
}

modd.conf
**/*.html
**/*.js
shiori {
daemon: ./shiori serve -p 5061
}

0 comments on commit 7124dc2

Please sign in to comment.