Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
github: add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
BohuTANG committed Mar 11, 2020
1 parent 09e78c2 commit 21ee2a9
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 9 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/mydumper-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: mydumper Build
on: [push, pull_request]
jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

- name: Check out code
uses: actions/checkout@v2

- name: Build
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make build
23 changes: 23 additions & 0 deletions .github/workflows/mydumper-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: mydumper Coverage
on: [push, pull_request]
jobs:

coverage:
name: Coverage
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

- name: Check out code
uses: actions/checkout@v2

- name: Coverage
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make coverage
bash <(curl -s https://codecov.io/bash) -f "!mock.go" -t 139cd284-7f04-4e98-9e4b-4c697f007b59
22 changes: 22 additions & 0 deletions .github/workflows/mydumper-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: mydumper Test
on: [push, pull_request]
jobs:

test:
name: Test
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go

- name: Check out code
uses: actions/checkout@v2

- name: Test
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make test
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
[![Build Status](https://travis-ci.org/xelabs/go-mydumper.png)](https://travis-ci.org/xelabs/go-mydumper) [![Go Report Card](https://goreportcard.com/badge/github.com/xelabs/go-mydumper)](https://goreportcard.com/report/github.com/xelabs/go-mydumper) [![codecov.io](https://codecov.io/gh/xelabs/go-mydumper/graphs/badge.svg)](https://codecov.io/gh/xelabs/go-mydumper/branch/master)
[![Github Actions Status](https://github.com/xelabs/go-mydumper/workflows/mydumper%20Build/badge.svg)](https://github.com/xelabs/go-mydumper/actions?query=workflow%3A%22mydumper+Build%22)
[![Github Actions Status](https://github.com/xelabs/go-mydumper/workflows/mydumper%20Test/badge.svg)](https://github.com/xelabs/go-mydumper/actions?query=workflow%3A%22mydumper+Test%22)
[![Github Actions Status](https://github.com/xelabs/go-mydumper/workflows/mydumper%20Coverage/badge.svg)](https://github.com/xelabs/go-mydumper/actions?query=workflow%3A%22mydumper+Coverage%22)
[![Go Report Card](https://goreportcard.com/badge/github.com/xelabs/go-mydumper)](https://goreportcard.com/report/github.com/xelabs/go-mydumper) [![codecov.io](https://codecov.io/gh/xelabs/go-mydumper/graphs/badge.svg)](https://codecov.io/gh/xelabs/go-mydumper/branch/master)

# go-mydumper

Expand Down
15 changes: 8 additions & 7 deletions conf/mydumper.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ outdir = ./dumper-sql
# Split tables into chunks of this output file size. This value is in MB
chunksize = 128
# Session variables, split by ;
vars= "xx=xx;xx=xx;"
# vars= "xx=xx;xx=xx;"
vars= ""

# Use this to restrict exported data. These are optional
[where]
sample_table1 = created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
sample_table2 = created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
# sample_table1 = created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)
# sample_table2 = created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)

# Use this to override value returned from tables. These are optional
[select]
user.salt = 'reset salt of all system users'
user.password = 'reset password of all system users'
# user.salt = 'reset salt of all system users'
# user.password = 'reset password of all system users'

customer.first_name = CONCAT('Bohu', id)
customer.last_name = 'Last'
# customer.first_name = CONCAT('Bohu', id)
# customer.last_name = 'Last'
9 changes: 8 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ get:
@echo "--> go get..."
go get github.com/xelabs/go-mysqlstack/driver
go get github.com/dlintw/goconf

gettest:
@echo "--> go get..."
go get github.com/stretchr/testify/assert
go get github.com/pierrre/gotestcover

Expand All @@ -28,6 +31,8 @@ fmt:
go vet ./...

test:
@$(MAKE) get
@$(MAKE) gettest
@echo "--> Testing..."
@$(MAKE) testcommon

Expand All @@ -37,8 +42,10 @@ testcommon:
# code coverage
COVPKGS = common
coverage:
@$(MAKE) get
@$(MAKE) gettest
go build -v -o bin/gotestcover \
src/github.com/pierrre/gotestcover/*.go;
gotestcover -coverprofile=coverage.out -v $(COVPKGS)
bin/gotestcover -coverprofile=coverage.out -v $(COVPKGS)
go tool cover -html=coverage.out
.PHONY: get build clean fmt test coverage

0 comments on commit 21ee2a9

Please sign in to comment.