Skip to content

Commit

Permalink
Actions (#9)
Browse files Browse the repository at this point in the history
* Add actions for golang

* Add MARIADB in actions

* Add port and init mariaDB

* Using ip:port

* No ip

* Test show docker

* Show docker logs

* Stop default mysql

* Try env

* Add ls

* Try login db

* Using ip

* Using localhost

* Add health check

* Add MYSQL_DATABASE

* Remove test_mariadb

* Try clean code

* Add more test

* Get more cover info

* Long timeout

* Remove check

* Remove travis.yml
  • Loading branch information
toomore authored Apr 25, 2021
1 parent 0eb2646 commit 2b08fcb
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 53 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Go

on: push

jobs:

build:
runs-on: ubuntu-20.04

services:
mariadb:
image: mariadb:10.1.48-bionic
ports:
- 3306:3306
env:
MYSQL_DATABASE: mailbox
MYSQL_ROOT_PASSWORD: mailboxdbs
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=4s --health-retries=5

steps:
- uses: actions/checkout@v2

- name: Add hosts to /etc/hosts
run: |
sudo echo "127.0.0.1 MARIADB" | sudo tee -a /etc/hosts
sudo cat /etc/hosts
- name: ps docker
run: |
docker ps --all
- name: init mariadb
run: |
ls -alh
mysql -h MARIADB -uroot -pmailboxdbs < ./sql/database.sql
mysql -h MARIADB -uroot -pmailboxdbs mailbox < ./sql/tables.sql
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16.3

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

- name: Run more test
run: |
go get -v ./...
go test -race ./campaign...
go test -race ./mails...
go test -race ./reader...
go test -race ./utils...
sh ./goclean.sh
go test -v -bench=Bench -benchmem -run='Bench' ./mails
go test -v -bench=Bench -benchmem -run='Bench' ./utils
sh ./build-base.sh
sh ./build-min.sh
docker images
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions build-base.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
docker pull alpine:3.9
docker pull golang:1.12.3-alpine3.9
docker pull alpine:3.13.5
docker pull golang:1.16.3-alpine3.13
docker build -t toomore/mailbox:base ./
1 change: 1 addition & 0 deletions goclean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fi
done

go tool cover -func coverage.cov
cat coverage.cov

# To submit the test coverage result to coveralls.io,
# use goveralls (https://github.com/mattn/goveralls)
Expand Down

0 comments on commit 2b08fcb

Please sign in to comment.