Switch to GitHub Actions from Travis. (#85)
Use GitHub Actions because we're deprecating use of Travis for our OSS projects. This change ran into some issues with the `generatenodirty` check so we changed it to print `git status`. We ran into an issue where `go mod download` was changing the go.sum and `go mod tidy` was alone. As a workaround for this, the CI job doesn't `go mod download` by default; we'll let the actual `test` or `build` commands do that.
This commit is contained in:
committed by
GitHub
parent
9c79392530
commit
3db2fee91a
46
.github/workflows/go.yml
vendored
Normal file
46
.github/workflows/go.yml
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
name: Go
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ['*']
|
||||||
|
tags: ['v*']
|
||||||
|
pull_request:
|
||||||
|
branches: ['*']
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
go: ["1.15.x", "1.16.x"]
|
||||||
|
include:
|
||||||
|
- go: 1.16.x
|
||||||
|
latest: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ matrix.go }}
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Load cached dependencies
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
if: matrix.latest
|
||||||
|
run: make lint
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: make cover
|
||||||
|
|
||||||
|
- name: Upload coverage to codecov.io
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
27
.travis.yml
27
.travis.yml
@@ -1,27 +0,0 @@
|
|||||||
sudo: false
|
|
||||||
language: go
|
|
||||||
go_import_path: go.uber.org/atomic
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- GO111MODULE=on
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- go: oldstable
|
|
||||||
- go: stable
|
|
||||||
env: LINT=1
|
|
||||||
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- vendor
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- go version
|
|
||||||
|
|
||||||
script:
|
|
||||||
- test -z "$LINT" || make lint
|
|
||||||
- make cover
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
|
||||||
1
Makefile
1
Makefile
@@ -69,6 +69,7 @@ generate: $(GEN_ATOMICINT) $(GEN_ATOMICWRAPPER)
|
|||||||
generatenodirty:
|
generatenodirty:
|
||||||
@[ -z "$$(git status --porcelain)" ] || ( \
|
@[ -z "$$(git status --porcelain)" ] || ( \
|
||||||
echo "Working tree is dirty. Commit your changes first."; \
|
echo "Working tree is dirty. Commit your changes first."; \
|
||||||
|
git status; \
|
||||||
exit 1 )
|
exit 1 )
|
||||||
@make generate
|
@make generate
|
||||||
@status=$$(git status --porcelain); \
|
@status=$$(git status --porcelain); \
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ Released under the [MIT License](LICENSE.txt).
|
|||||||
|
|
||||||
[doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg
|
[doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg
|
||||||
[doc]: https://godoc.org/go.uber.org/atomic
|
[doc]: https://godoc.org/go.uber.org/atomic
|
||||||
[ci-img]: https://travis-ci.com/uber-go/atomic.svg?branch=master
|
[ci-img]: https://github.com/uber-go/atomic/actions/workflows/go.yml/badge.svg
|
||||||
[ci]: https://travis-ci.com/uber-go/atomic
|
[ci]: https://github.com/uber-go/atomic/actions/workflows/go.yml
|
||||||
[cov-img]: https://codecov.io/gh/uber-go/atomic/branch/master/graph/badge.svg
|
[cov-img]: https://codecov.io/gh/uber-go/atomic/branch/master/graph/badge.svg
|
||||||
[cov]: https://codecov.io/gh/uber-go/atomic
|
[cov]: https://codecov.io/gh/uber-go/atomic
|
||||||
[reportcard-img]: https://goreportcard.com/badge/go.uber.org/atomic
|
[reportcard-img]: https://goreportcard.com/badge/go.uber.org/atomic
|
||||||
|
|||||||
1
go.sum
1
go.sum
@@ -1,4 +1,3 @@
|
|||||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
|||||||
Reference in New Issue
Block a user