Created
February 7, 2021 19:12
-
-
Save Aoi-hosizora/52269fc8b093f98e85f29153e7952575 to your computer and use it in GitHub Desktop.
golang travis & codecov
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: go | |
go: | |
- 1.13 | |
- 1.14 | |
- 1.15 | |
services: | |
- mysql | |
- redis | |
before_install: | |
# mysql | |
- mysql -e "CREATE DATABASE db_test;" | |
- mysql -e "use mysql; update user set authentication_string=PASSWORD('123') where User='root'; update user set plugin='mysql_native_password'; FLUSH PRIVILEGES;" | |
# redis | |
- redis-cli CONFIG SET requirepass "123" | |
# neo4j | |
- wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add - | |
- echo 'deb https://debian.neo4j.com stable 3.5' | sudo tee -a /etc/apt/sources.list.d/neo4j.list | |
- sudo apt-get update && sudo apt-get install neo4j=1:3.5.26 | |
- sudo service neo4j start | |
- sudo neo4j-admin set-initial-password "123" | |
# golang | |
- go get -t -v ./... | |
script: | |
- sh ./go.test.sh | |
after_success: | |
- bash <(curl -s https://codecov.io/bash) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
echo "" > coverage.txt | |
for d in $(go list ./... | grep -v vendor); do | |
go test -v -race -coverprofile=profile.out -covermode=atomic "$d" | |
if [ -f profile.out ]; then | |
cat profile.out >> coverage.txt | |
rm profile.out | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment