mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
485faed812
* Update go to 1.15 to reduce binary size Go made improvements to reduce binary size, cf https://golang.org/doc/go1.15 > Go 1.15 reduces typical binary sizes by around 5% compared to Go 1.14 by eliminating certain types of GC metadata and more aggressively eliminating unused type metadata. In my test, this equates to about 3 mb diff between Go 1.13 and Go 1.15: -rwxr-xr-x 1 root root 36M Aug 31 14:43 piper-go-113 -rwxr-xr-x 1 root root 33M Aug 31 14:44 piper-go-115 * Go Generate * go mod tidy Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com> Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
96 lines
2.5 KiB
YAML
96 lines
2.5 KiB
YAML
name: Go
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
unit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-go@v1
|
|
with:
|
|
go-version: '1.15.x'
|
|
- name: Cache Golang Packages
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-golang-${{ hashFiles('go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-golang-
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: unit-test
|
|
uses: paambaati/codeclimate-action@v2.6.0
|
|
env:
|
|
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_REPORTER_ID }}
|
|
with:
|
|
coverageCommand: go test ./... -coverprofile cover.out
|
|
coverageLocations: cover.out:gocov
|
|
# truncate package name from file paths in report
|
|
prefix: github.com/SAP/jenkins-library/
|
|
format:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-go@v1
|
|
with:
|
|
go-version: '1.15.x'
|
|
- name: Cache Golang Packages
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-golang-format${{ hashFiles('go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-golang-format
|
|
${{ runner.os }}-golang-
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: format
|
|
run: go fmt ./...
|
|
- name: verify
|
|
run: git diff --name-only --exit-code
|
|
generate:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-go@v1
|
|
with:
|
|
go-version: '1.15.x'
|
|
- name: Cache Golang Packages
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-golang-generate${{ hashFiles('go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-golang-generate
|
|
${{ runner.os }}-golang-
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: generate
|
|
run: go run pkg/generator/step-metadata.go
|
|
- name: verify
|
|
run: git diff --name-only --exit-code
|
|
dependencies:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-go@v1
|
|
with:
|
|
go-version: '1.15.x'
|
|
- name: Cache Golang Packages
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-golang-dependencies${{ hashFiles('go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-golang-dependencies
|
|
${{ runner.os }}-golang-
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
- name: cleanup dependencies
|
|
run: go mod tidy
|
|
- name: verify
|
|
run: git diff --name-only --exit-code
|