| 1 |
name: build |
| 2 |
on: [push, pull_request] |
| 3 |
jobs: |
| 4 |
golangci: |
| 5 |
name: Lint |
| 6 |
runs-on: ubuntu-latest |
| 7 |
# Prevent duplicate builds on internal PRs. |
| 8 |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository |
| 9 |
steps: |
| 10 |
- uses: actions/checkout@v2 |
| 11 |
- name: golangci-lint |
| 12 |
uses: golangci/golangci-lint-action@v2 |
| 13 |
with: |
| 14 |
version: v1.29 |
| 15 |
build: |
| 16 |
name: Test with Go ${{ matrix.go-version }} |
| 17 |
runs-on: ubuntu-latest |
| 18 |
# Prevent duplicate builds on internal PRs. |
| 19 |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository |
| 20 |
strategy: |
| 21 |
matrix: |
| 22 |
go-version: [1.14, 1.15] |
| 23 |
redis-version: [6] |
| 24 |
steps: |
| 25 |
- name: Install Go stable version |
| 26 |
uses: actions/setup-go@v2 |
| 27 |
with: |
| 28 |
go-version: ${{ matrix.go-version }} |
| 29 |
|
| 30 |
- name: Checkout code |
| 31 |
uses: actions/checkout@v2 |
| 32 |
|
| 33 |
- name: Start single Redis |
| 34 |
uses: supercharge/[email protected] |
| 35 |
with: |
| 36 |
redis-version: ${{ matrix.redis-version }} |
| 37 |
|
| 38 |
- name: Start Redis Cluster |
| 39 |
run: docker run -d -e "IP=0.0.0.0" -p 7000-7006:7000-7006 grokzen/redis-cluster:latest |
| 40 |
|
| 41 |
- name: Start Redis with Sentinel |
| 42 |
run: docker run -d -p 26379:26379 joshula/redis-sentinel:latest --sentinel announce-ip 1.2.3.4 --sentinel announce-port 26379 |
| 43 |
|
| 44 |
- name: Test |
| 45 |
run: go test -v -race -tags integration -coverprofile=coverage.out $(go list ./... | grep -v /_examples/) |
| 46 |
|
| 47 |
- name: Upload code coverage to codecov |
| 48 |
if: matrix.go-version == '1.15' |
| 49 |
uses: codecov/codecov-action@v1 |
| 50 |
with: |
| 51 |
file: ./coverage.out |