Skip to content

Commit

Permalink
ci(Github Actions) Add actions for unit tests and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
stanleynguyen committed May 1, 2020
1 parent ee1a107 commit 84ef20a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "lint"

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
name: Lint codebase
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-go@v1
with:
go-version: "1.13"
- run: go mod download
- run: go vet ./...
- run: make lint-prepare
- run: ./bin/golangci-lint run
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "test"

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.13.x]
name: Test with Go version ${{ matrix.go-version }}
steps:
- name: Setup go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v2
- run: go test ./...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

# Dependency directories (remove the comment below to include it)
# vendor/
bin/
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Install tools for development
.PHONY: init
init: lint-prepare

.PHONY: lint-prepare
lint-prepare:
@echo "Preparing Linter"
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s latest
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# is-thirteen

[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c)](https://pkg.go.dev/github.com/stanleynguyen/is-thirteen)
![](https://github.com/stanleynguyen/is-thirteen/workflows/test/badge.svg)
![](https://github.com/stanleynguyen/is-thirteen/workflows/lint/badge.svg)

Check if a number is equal to 13.

0 comments on commit 84ef20a

Please sign in to comment.