Skip to content

Commit

Permalink
Moving from Travis to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Nov 28, 2020
1 parent b7a8e6c commit ce62a87
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 62 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: run-go-tests

env:
GO111MODULE: on

on:
pull_request:
branches:
- "*"
push:
branches:
- "*"
schedule:
- cron: '* 22 * * *'

jobs:
test:
strategy:
matrix:
go-version: [ 1.15.x ]
#go-version: [ 1.14.x, 1.15.x ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod # Module download cache
~/.cache/go-build # Build cache (Linux)
~/Library/Caches/go-build # Build cache (Mac)
'%LocalAppData%\go-build' # Build cache (Windows)
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Run linter and tests
run: make test-ci
- name: Update code coverage
run: bash <(curl -s https://codecov.io/bash)
14 changes: 8 additions & 6 deletions .make/Makefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ lint: ## Run the golangci-lint application (install if not found)
@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;
@#AWS CodePipeline
@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;
@#Github Actions
@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;
@#Brew - MacOS
@if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then brew install golangci-lint; fi;
@echo "running golangci-lint..."
Expand All @@ -60,19 +62,19 @@ test-short: ## Runs vet, lint and tests (excludes integration tests)
@echo "running tests (short)..."
@go test ./... -v -test.short

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

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

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

uninstall: ## Uninstall the application (and remove files)
Expand Down
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

55 changes: 28 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# go-bitcoin

> A library for working with Bitcoin (BSV) transactions, addresses, keys, encryption, and more.
[![Release](https://img.shields.io/github/release-pre/BitcoinSchema/go-bitcoin.svg?logo=github&style=flat&v=4)](https://github.com/BitcoinSchema/go-bitcoin/releases)
[![Build Status](https://travis-ci.com/BitcoinSchema/go-bitcoin.svg?branch=master&v=4)](https://travis-ci.com/BitcoinSchema/go-bitcoin)
[![Build Status](https://img.shields.io/github/workflow/status/BitcoinSchema/go-bitcoin/run-go-tests?logo=github&v=3)](https://github.com/BitcoinSchema/go-bitcoin/actions)
[![Report](https://goreportcard.com/badge/github.com/BitcoinSchema/go-bitcoin?style=flat&v=4)](https://goreportcard.com/report/github.com/BitcoinSchema/go-bitcoin)
[![codecov](https://codecov.io/gh/BitcoinSchema/go-bitcoin/branch/master/graph/badge.svg?v=4)](https://codecov.io/gh/BitcoinSchema/go-bitcoin)
[![Go](https://img.shields.io/github/go-mod/go-version/BitcoinSchema/go-bitcoin?v=4)](https://golang.org/)
Expand Down Expand Up @@ -119,38 +118,40 @@ make help
List of all current commands:

```text
all Runs multiple commands
clean Remove previous builds and any test cache data
clean-mods Remove all the Go mod cache
coverage Shows the test coverage
godocs Sync the latest tag with GoDocs
help Show this help message
install Install the application
install-go Install the application (Using Native Go)
lint Run the Go lint application
release Full production release (creates release in Github)
release Runs common.release then runs godocs
release-snap Test the full release (build binaries)
release-test Full production test release (everything except deploy)
replace-version Replaces the version in HTML/JS (pre-deploy)
tag Generate a new tag and push (tag version=0.0.0)
tag-remove Remove a tag if found (tag-remove version=0.0.0)
tag-update Update an existing tag to current commit (tag-update version=0.0.0)
test Runs vet, lint and ALL tests
test-short Runs vet, lint and tests (excludes integration tests)
test-travis Runs all tests via Travis (also exports coverage)
test-travis-short Runs unit tests via Travis (also exports coverage)
uninstall Uninstall the application (and remove files)
vet Run the Go vet application
all Runs multiple commands
clean Remove previous builds and any test cache data
clean-mods Remove all the Go mod cache
coverage Shows the test coverage
godocs Sync the latest tag with GoDocs
help Show this help message
install Install the application
install-go Install the application (Using Native Go)
lint Run the golangci-lint application (install if not found)
release Full production release (creates release in Github)
release Runs common.release then runs godocs
release-snap Test the full release (build binaries)
release-test Full production test release (everything except deploy)
replace-version Replaces the version in HTML/JS (pre-deploy)
tag Generate a new tag and push (tag version=0.0.0)
tag-remove Remove a tag if found (tag-remove version=0.0.0)
tag-update Update an existing tag to current commit (tag-update version=0.0.0)
test Runs vet, lint and ALL tests
test-ci Runs all tests via CI (exports coverage)
test-ci-no-race Runs all tests via CI (no race) (exports coverage)
test-ci-short Runs unit tests via CI (exports coverage)
test-short Runs vet, lint and tests (excludes integration tests)
uninstall Uninstall the application (and remove files)
update-linter Update the golangci-lint package (macOS only)
vet Run the Go vet application
```

</details>

<br/>

## Examples & Tests

All unit tests and [examples](examples) run via [Travis CI](https://travis-ci.com/bitcoinschema/go-bitcoin) and uses [Go version 1.15.x](https://golang.org/doc/go1.15). View the [deployment configuration file](.travis.yml).
All unit tests and [examples](examples) run via [Github Actions](https://github.com/tonicpow/go-bitcoin/actions) and
uses [Go version 1.15.x](https://golang.org/doc/go1.15). View the [configuration file](.github/workflows/run-tests.yml).

Run all tests (including integration tests)

Expand Down

0 comments on commit ce62a87

Please sign in to comment.