Skip to content

optimization

optimization #95

Workflow file for this run

name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
go: [1.16, 1.17, 1.18, 1.19, 1.20.x]
name: build & test
runs-on: ubuntu-latest
services:
etcd:
image: gcr.io/etcd-development/etcd:v3.5.0
ports:
- 2379:2379
env:
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
consul:
image: consul:1.12.3
ports:
- 8500:8500
redis:
image: redis:6.0
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Build
run: go build -v ./...
- name: Test
run: |
go test -v -cover ./... -coverprofile coverage.out -coverpkg ./...
go tool cover -func coverage.out -o coverage.out # Replaces coverage.out with the analysis of coverage.out
- name: Go Coverage Badge
uses: tj-actions/coverage-badge-go@v1
if: ${{ runner.os == 'Linux' && matrix.go == '1.16' }} # Runs this on only one of the ci builds.
with:
green: 80
filename: coverage.out
- uses: stefanzweifel/git-auto-commit-action@v4
id: auto-commit-action
with:
commit_message: Apply Code Coverage Badge
skip_fetch: false
skip_checkout: true
file_pattern: ./README.md
- name: Push Changes
if: steps.auto-commit-action.outputs.changes_detected == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3