Skip to content

Commit

Permalink
Update the github ci action to use cache and matrix strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorel-35 committed May 31, 2021
1 parent df1249d commit 244adc6
Showing 1 changed file with 35 additions and 28 deletions.
63 changes: 35 additions & 28 deletions .github/workflows/ci.yml
Expand Up @@ -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: Checkout Source
uses: actions/checkout@v2
- name: Run Tests
uses: cedrickring/golang-action@1.7.0
- name: Setup go ${{ matrix.go_version }}
uses: actions/setup-go@v2
with:
args: make test
tests-go-1-15:
runs-on: ubuntu-latest
env:
GO111MODULE: on
steps:
go-version: ${{ matrix.go_version }}
- name: Checkout Source
uses: actions/checkout@v2
- name: Run Tests
uses: cedrickring/golang-action/go1.15@1.7.0
- uses: actions/cache@v2
with:
args: make test
tests-go-1-14:
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.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:
Expand Down

0 comments on commit 244adc6

Please sign in to comment.