mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 11:35:52 +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
|
||||
steps:
|
||||
- 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
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
continue-on-error: true
|
||||
with:
|
||||
version: latest
|
||||
tests-go-1-16:
|
||||
test:
|
||||
needs: [golangci]
|
||||
strategy:
|
||||
matrix:
|
||||
go_version:
|
||||
- '1.14'
|
||||
- '1.15'
|
||||
- '1.16'
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
- name: Setup go ${{ matrix.go_version }}
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go_version }}
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2
|
||||
- name: Run Tests
|
||||
uses: cedrickring/golang-action@1.7.0
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
args: make test
|
||||
tests-go-1-15:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Run Tests
|
||||
uses: cedrickring/golang-action/go1.15@1.7.0
|
||||
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
|
||||
run: make test
|
||||
coverage:
|
||||
needs: [tests-go-1-16, tests-go-1-15, tests-go-1-14]
|
||||
needs: [test]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
- name: Setup go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: '1.16'
|
||||
- name: Checkout Source
|
||||
uses: actions/checkout@v2
|
||||
- name: Create Test Coverage
|
||||
uses: cedrickring/golang-action@1.7.0
|
||||
- uses: actions/cache@v2
|
||||
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
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
|
|
Loading…
Reference in a new issue