Skip to content

Commit e05530e

Browse files
committed
Moving from Travis to Github Actions
1 parent 1a60452 commit e05530e

4 files changed

Lines changed: 83 additions & 63 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: run-go-tests
2+
3+
env:
4+
GO111MODULE: on
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- "*"
10+
push:
11+
branches:
12+
- "*"
13+
schedule:
14+
- cron: '* 22 * * *'
15+
16+
jobs:
17+
test:
18+
strategy:
19+
matrix:
20+
go-version: [ 1.15.x ]
21+
#go-version: [ 1.14.x, 1.15.x ]
22+
os: [ ubuntu-latest ]
23+
runs-on: ${{ matrix.os }}
24+
steps:
25+
- name: Install Go
26+
uses: actions/setup-go@v2
27+
with:
28+
go-version: ${{ matrix.go-version }}
29+
- name: Checkout code
30+
uses: actions/checkout@v2
31+
- uses: actions/cache@v2
32+
with:
33+
path: |
34+
~/go/pkg/mod # Module download cache
35+
~/.cache/go-build # Build cache (Linux)
36+
~/Library/Caches/go-build # Build cache (Mac)
37+
'%LocalAppData%\go-build' # Build cache (Windows)
38+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
39+
restore-keys: |
40+
${{ runner.os }}-go-
41+
- name: Run linter and tests
42+
run: make test-ci
43+
- name: Update code coverage
44+
run: bash <(curl -s https://codecov.io/bash)

.make/Makefile.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ install-go: ## Install the application (Using Native Go)
4242

4343
lint: ## Run the golangci-lint application (install if not found)
4444
@#Travis (has sudo)
45-
@if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.32.2 && sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; fi;
45+
@if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.33.0 && sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; fi;
4646
@#AWS CodePipeline
47-
@if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.32.2; fi;
47+
@if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(CODEBUILD_BUILD_ID)" != "" ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.33.0; fi;
48+
@#Github Actions
49+
@if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(GITHUB_WORKFLOW)" != "" ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH)/bin v1.33.0; fi;
4850
@#Brew - MacOS
4951
@if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then brew install golangci-lint; fi;
5052
@echo "running golangci-lint..."
@@ -60,19 +62,19 @@ test-short: ## Runs vet, lint and tests (excludes integration tests)
6062
@echo "running tests (short)..."
6163
@go test ./... -v -test.short
6264

63-
test-travis: ## Runs all tests via Travis (also exports coverage)
65+
test-ci: ## Runs all tests via CI (exports coverage)
6466
@$(MAKE) lint
65-
@echo "running tests (travis)..."
67+
@echo "running tests (CI)..."
6668
@go test ./... -race -coverprofile=coverage.txt -covermode=atomic
6769

68-
test-travis-no-race: ## Runs all tests (no race) (also exports coverage)
70+
test-ci-no-race: ## Runs all tests via CI (no race) (exports coverage)
6971
@$(MAKE) lint
70-
@echo "running tests (no race)..."
72+
@echo "running tests (CI - no race)..."
7173
@go test ./... -coverprofile=coverage.txt -covermode=atomic
7274

73-
test-travis-short: ## Runs unit tests via Travis (also exports coverage)
75+
test-ci-short: ## Runs unit tests via CI (exports coverage)
7476
@$(MAKE) lint
75-
@echo "running tests (short & travis)..."
77+
@echo "running tests (CI - unit tests only)..."
7678
@go test ./... -test.short -race -coverprofile=coverage.txt -covermode=atomic
7779

7880
uninstall: ## Uninstall the application (and remove files)

.travis.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

README.md

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
> Lightweight email package with multi-provider support ([ses](https://aws.amazon.com/ses/), [mandrill](https://mailchimp.com/features/transactional-email/), [postmark](https://postmarkapp.com/))
33
44
[![Release](https://img.shields.io/github/release-pre/mrz1836/go-mail.svg?logo=github&style=flat&v=1)](https://github.com/mrz1836/go-mail/releases)
5-
[![Build Status](https://travis-ci.com/mrz1836/go-mail.svg?branch=master)](https://travis-ci.com/mrz1836/go-mail)
5+
[![Build Status](https://img.shields.io/github/workflow/status/mrz1836/go-mail/run-go-tests?logo=github&v=3)](https://github.com/mrz1836/go-mail/actions)
66
[![Report](https://goreportcard.com/badge/github.com/mrz1836/go-mail?style=flat&v=1)](https://goreportcard.com/report/github.com/mrz1836/go-mail)
77
[![codecov](https://codecov.io/gh/mrz1836/go-mail/branch/master/graph/badge.svg)](https://codecov.io/gh/mrz1836/go-mail)
88
[![Go](https://img.shields.io/github/go-mod/go-version/mrz1836/go-mail)](https://golang.org/)
@@ -91,37 +91,40 @@ make help
9191

9292
List of all current commands:
9393
```text
94-
all Runs multiple commands
95-
clean Remove previous builds and any test cache data
96-
clean-mods Remove all the Go mod cache
97-
coverage Shows the test coverage
98-
godocs Sync the latest tag with GoDocs
99-
help Show this help message
100-
install Install the application
101-
install-go Install the application (Using Native Go)
102-
lint Run the Go lint application
103-
release Full production release (creates release in Github)
104-
release Runs common.release then runs godocs
105-
release-snap Test the full release (build binaries)
106-
release-test Full production test release (everything except deploy)
107-
replace-version Replaces the version in HTML/JS (pre-deploy)
108-
run-examples Runs all the examples
109-
tag Generate a new tag and push (tag version=0.0.0)
110-
tag-remove Remove a tag if found (tag-remove version=0.0.0)
111-
tag-update Update an existing tag to current commit (tag-update version=0.0.0)
112-
test Runs vet, lint and ALL tests
113-
test-short Runs vet, lint and tests (excludes integration tests)
114-
test-travis Runs all tests via Travis (also exports coverage)
115-
test-travis-short Runs unit tests via Travis (also exports coverage)
116-
uninstall Uninstall the application (and remove files)
117-
vet Run the Go vet application
94+
all Runs multiple commands
95+
clean Remove previous builds and any test cache data
96+
clean-mods Remove all the Go mod cache
97+
coverage Shows the test coverage
98+
godocs Sync the latest tag with GoDocs
99+
help Show this help message
100+
install Install the application
101+
install-go Install the application (Using Native Go)
102+
lint Run the golangci-lint application (install if not found)
103+
release Full production release (creates release in Github)
104+
release Runs common.release then runs godocs
105+
release-snap Test the full release (build binaries)
106+
release-test Full production test release (everything except deploy)
107+
replace-version Replaces the version in HTML/JS (pre-deploy)
108+
run-examples Runs all the examples
109+
tag Generate a new tag and push (tag version=0.0.0)
110+
tag-remove Remove a tag if found (tag-remove version=0.0.0)
111+
tag-update Update an existing tag to current commit (tag-update version=0.0.0)
112+
test Runs vet, lint and ALL tests
113+
test-ci Runs all tests via CI (exports coverage)
114+
test-ci-no-race Runs all tests via CI (no race) (exports coverage)
115+
test-ci-short Runs unit tests via CI (exports coverage)
116+
test-short Runs vet, lint and tests (excludes integration tests)
117+
uninstall Uninstall the application (and remove files)
118+
update-linter Update the golangci-lint package (macOS only)
119+
vet Run the Go vet application
118120
```
119121
</details>
120122

121123
<br/>
122124

123125
## Examples & Tests
124-
All unit tests and [examples](examples/examples.go) run via [Travis CI](https://travis-ci.com/mrz1836/go-mail) and uses [Go version 1.15.x](https://golang.org/doc/go1.15). View the [deployment configuration file](.travis.yml).
126+
All unit tests and [examples](examples) run via [Github Actions](https://github.com/mrz1836/go-mail/actions) and
127+
uses [Go version 1.15.x](https://golang.org/doc/go1.15). View the [configuration file](.github/workflows/run-tests.yml).
125128

126129
Run all tests (including integration tests)
127130
```shell script

0 commit comments

Comments
 (0)