2020-01-29 19:09:51 +02:00
|
|
|
name: Go
|
|
|
|
|
2020-02-04 11:00:02 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-01-29 19:09:51 +02:00
|
|
|
|
|
|
|
jobs:
|
2020-01-31 16:18:34 +02:00
|
|
|
unit:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v1
|
|
|
|
with:
|
2020-09-17 08:44:42 +02:00
|
|
|
go-version: '1.15.x'
|
2020-07-22 12:01:05 +02:00
|
|
|
- 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-
|
2020-01-31 16:18:34 +02:00
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: unit-test
|
2020-07-22 12:30:15 +02:00
|
|
|
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/
|
2020-01-29 19:09:51 +02:00
|
|
|
format:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v1
|
|
|
|
with:
|
2020-09-17 08:44:42 +02:00
|
|
|
go-version: '1.15.x'
|
2020-07-22 12:01:05 +02:00
|
|
|
- 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-
|
2020-01-29 19:09:51 +02:00
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: format
|
|
|
|
run: go fmt ./...
|
|
|
|
- name: verify
|
2021-03-12 11:12:40 +02:00
|
|
|
run: git diff --exit-code
|
2020-01-29 19:09:51 +02:00
|
|
|
generate:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v1
|
|
|
|
with:
|
2020-09-17 08:44:42 +02:00
|
|
|
go-version: '1.15.x'
|
2020-07-22 12:01:05 +02:00
|
|
|
- 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-
|
2020-01-29 19:09:51 +02:00
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: generate
|
|
|
|
run: go run pkg/generator/step-metadata.go
|
|
|
|
- name: verify
|
2021-01-04 14:23:30 +02:00
|
|
|
run: git diff --exit-code
|
2020-01-29 19:09:51 +02:00
|
|
|
dependencies:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v1
|
|
|
|
with:
|
2020-09-17 08:44:42 +02:00
|
|
|
go-version: '1.15.x'
|
2020-07-22 12:01:05 +02:00
|
|
|
- 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-
|
2020-01-29 19:09:51 +02:00
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: cleanup dependencies
|
|
|
|
run: go mod tidy
|
|
|
|
- name: verify
|
|
|
|
run: git diff --name-only --exit-code
|