Skip to content

Commit

Permalink
chore(ci) : setup test and lint workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
  • Loading branch information
mmorel-35 committed Sep 11, 2021
1 parent c15f76a commit b4fcc92
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 23 deletions.
6 changes: 5 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: daily
interval: weekly
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
60 changes: 38 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,60 @@ on:
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.42
args: --verbose
unit-tests:
strategy:
matrix:
go-version: [ 1.16 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
go-version: [1.16]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
-
name: Cache Go modules
uses: actions/cache@v1
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Setup
- name: Setup
run: make setup
-
name: Make Unit Tests
- name: Make Unit Tests
run: make test
-
name: Diff
- name: Upload Code Coverage
uses: codecov/codecov-action@v2
with:
flags: unit-tests,${{ matrix.os }}
token: ${{ secrets.CODECOV_TOKEN }}
- name: Diff
run: git diff
goreleaser:
strategy:
matrix:
go-version: [ 1.16 ]
go-version: [1.16]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
Expand All @@ -61,17 +77,18 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup
run: make setup
- name: Make build
run: make build

run: make build
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: success()
Expand All @@ -80,4 +97,3 @@ jobs:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

10 changes: 10 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
linters:
enable:
- gofumpt
disable:
- deadcode
- errcheck
- gosimple
- govet
- staticcheck
- unused

0 comments on commit b4fcc92

Please sign in to comment.