Skip to content

Commit

Permalink
Setup CI with GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
minamijoyo committed Mar 22, 2022
1 parent 62ad713 commit 7641a6e
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: lint
permissions:
contents: read
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.43.0
36 changes: 36 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: test
permissions:
contents: read

on:
push:
branches:
- master
paths-ignore:
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- '**.md'

jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '1.17.8'
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: test
run: make test
12 changes: 12 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://golangci-lint.run/usage/configuration/
linters:
disable-all: true
enable:
- errcheck
- goimports
- gosec
- gosimple
- govet
- ineffassign
- revive
- staticcheck
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
NAME := tfmigrate-storage

.DEFAULT_GOAL := check

.PHONY: lint
lint:
golangci-lint run ./...

.PHONY: test
test:
go test ./...

.PHONY: check
check: lint test

0 comments on commit 7641a6e

Please sign in to comment.