mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 03:55:54 +00:00
Update the github ci action to use cache and matrix strategy
This commit is contained in:
parent
df1249d9b2
commit
244adc6bdc
1 changed files with 36 additions and 29 deletions
65
.github/workflows/ci.yml
vendored
65
.github/workflows/ci.yml
vendored
|
@ -12,56 +12,63 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v2
|
uses: golangci/golangci-lint-action@v2
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
tests-go-1-16:
|
test:
|
||||||
|
needs: [golangci]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go_version:
|
||||||
|
- '1.14'
|
||||||
|
- '1.15'
|
||||||
|
- '1.16'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
steps:
|
steps:
|
||||||
|
- name: Setup go ${{ matrix.go_version }}
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go_version }}
|
||||||
- name: Checkout Source
|
- name: Checkout Source
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Run Tests
|
- uses: actions/cache@v2
|
||||||
uses: cedrickring/golang-action@1.7.0
|
|
||||||
with:
|
with:
|
||||||
args: make test
|
path: ~/go/pkg/mod
|
||||||
tests-go-1-15:
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
runs-on: ubuntu-latest
|
restore-keys: |
|
||||||
env:
|
${{ runner.os }}-go-
|
||||||
GO111MODULE: on
|
|
||||||
steps:
|
|
||||||
- name: Checkout Source
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
uses: cedrickring/golang-action/go1.15@1.7.0
|
run: make test
|
||||||
with:
|
|
||||||
args: make test
|
|
||||||
tests-go-1-14:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
GO111MODULE: on
|
|
||||||
steps:
|
|
||||||
- name: Checkout Source
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Run Tests
|
|
||||||
uses: cedrickring/golang-action/go1.14@1.7.0
|
|
||||||
with:
|
|
||||||
args: make test
|
|
||||||
coverage:
|
coverage:
|
||||||
needs: [tests-go-1-16, tests-go-1-15, tests-go-1-14]
|
needs: [test]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GO111MODULE: on
|
GO111MODULE: on
|
||||||
steps:
|
steps:
|
||||||
|
- name: Setup go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: '1.16'
|
||||||
- name: Checkout Source
|
- name: Checkout Source
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Create Test Coverage
|
- uses: actions/cache@v2
|
||||||
uses: cedrickring/golang-action@1.7.0
|
|
||||||
with:
|
with:
|
||||||
args: make test-coverage
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
- name: Create Test Coverage
|
||||||
|
run: make test-coverage
|
||||||
- name: Upload Test Coverage
|
- name: Upload Test Coverage
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v1
|
||||||
with:
|
with:
|
||||||
|
|
Loading…
Reference in a new issue