mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
0998a80f07
* chore: update to go 1.17 Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com> * update workflows Co-authored-by: Pavel Busko <pavel.busko@sap.com> * fixed multipart upload tests Co-authored-by: Johannes Dillmann <j.dillmann@sap.com> * go fmt Co-authored-by: Pavel Busko <pavel.busko@sap.com> * Update to go 1.17 Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com> * Update vault to v1.9.3 Co-authored-by: Pavel Busko <pavel.busko@sap.com> Co-authored-by: Ralf Pannemans <ralf.pannemans@sap.com> Co-authored-by: Pavel Busko <pavel.busko@sap.com> Co-authored-by: Johannes Dillmann <j.dillmann@sap.com> Co-authored-by: ffeldmann <f.feldmann@sap.com>
107 lines
2.9 KiB
YAML
107 lines
2.9 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.17.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.17.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 --exit-code
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 1
|
|
- name: staticcheck
|
|
uses: dominikh/staticcheck-action@v1.1.0
|
|
with:
|
|
cache-key: ${{ runner.os }}-golang-staticcheck
|
|
generate:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-go@v1
|
|
with:
|
|
go-version: '1.17.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 --exit-code
|
|
dependencies:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-go@v1
|
|
with:
|
|
go-version: '1.17.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
|