Skip to content

upload coverage to codecov. #138

upload coverage to codecov.

upload coverage to codecov. #138

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "r1.0" ]
pull_request:
branches: [ "r1.0" ]
jobs:
go20_redis7_mysql8:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and start containers
run: docker-compose -f tests/environments/go1.20_redis7_mysql8/docker-compose.yml up -d --build && docker ps
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
check-latest: true
- name: Build
run: go mod tidy && go build -v ./...
- name: Test
run: |
go test -race -cover -v ./... -coverprofile coverage.out -coverpkg ./...
go tool cover -func=coverage.out -o=coverage.out
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Go Coverage Badge
uses: tj-actions/coverage-badge-go@v2
with:
green: 80
filename: coverage.out
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files
with:
files: README.md
- name: Commit coverage changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "chore: Updated coverage badge."
- name: Push coverage changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ github.token }}
branch: refs/heads/r1.0
- name: Benchmark
run: go test -race -v ./... -bench . -run ^$ -count 10 -benchmem
- name: Stop containers
if: always()
run: docker-compose -f tests/environments/go1.20_redis7_mysql8/docker-compose.yml down
go21_redis7_mysql8:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and start containers
run: docker-compose -f tests/environments/go1.21_redis7_mysql8/docker-compose.yml up -d --build && docker ps
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
check-latest: true
- name: Build
run: go mod tidy && go build -v ./...
- name: Test
run: go test -race -v ./...
- name: Benchmark
run: go test -race -v ./... -bench . -run ^$ -count 10 -benchmem
- name: Stop containers
if: always()
run: docker-compose -f tests/environments/go1.21_redis7_mysql8/docker-compose.yml down