Skip to content

Commit

Permalink
adding new pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
theflyingcodr committed May 14, 2021
1 parent 1b83985 commit 4445010
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 33 deletions.
75 changes: 45 additions & 30 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,58 @@
name: run-go-tests

env:
GO111MODULE: on
name: Go

on:
pull_request:
branches:
- "*"
push:
branches:
- "*"
schedule:
- cron: '1 4 * * *'
tags:
- '*'
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
golangci:
strategy:
matrix:
go-version: [ 1.14.x, 1.15.x ]
os: [ ubuntu-latest ]
go-version: [1.15.x,1.16.x]
os: [macos-latest, ubuntu-latest]
name: lint
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
build:
strategy:
matrix:
go-version: [ 1.13.x,1.14.x,1.15.x, 1.16.x ]
os: [ macos-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod # Module download cache
~/.cache/go-build # Build cache (Linux)
~/Library/Caches/go-build # Build cache (Mac)
'%LocalAppData%\go-build' # Build cache (Windows)
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run linter and tests
run: make test-ci

- name: Tests
run: make test-unit
- name: Update code coverage
run: bash <(curl -s https://codecov.io/bash)
run: bash <(curl -s https://codecov.io/bash)
- name: Build
run: go build -v ./...
release:
needs: [golangci,build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: release
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18 changes: 15 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# ---------------------------
# GENERAL
# ---------------------------
before:
hooks:
- make all
snapshot:
name_template: "{{ .Tag }}"
changelog:
Expand All @@ -19,6 +16,21 @@ changelog:
# ---------------------------
build:
skip: true
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
# ---------------------------
# Github Release
# ---------------------------
Expand Down
3 changes: 3 additions & 0 deletions .make/go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ test-short: ## Runs vet, lint and tests (excludes integration tests)
@echo "running tests (short)..."
@go test ./... -v -test.short

test-unit:
@go test ./... -race -coverprofile=coverage.txt -covermode=atomic

test-ci: ## Runs all tests via CI (exports coverage)
@$(MAKE) lint
@echo "running tests (CI)..."
Expand Down

0 comments on commit 4445010

Please sign in to comment.