From d08a636e7c393c54537dd914c3bbd6ec2d2f700d Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 22 May 2020 23:09:56 -0700 Subject: [PATCH] add GitHub Actions (#293) --- .circleci/config.yml | 47 ----------------------------------- .github/workflows/release.yml | 24 ++++++++++++++++++ .github/workflows/test.yml | 34 +++++++++++++++++++++++++ README.md | 2 +- 4 files changed, 59 insertions(+), 48 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 8c8171f..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,47 +0,0 @@ -version: 2 -jobs: - release: - docker: - - image: circleci/golang:1.13 - working_directory: /go/src/github.com/d5/tegno - steps: - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: curl -sL https://git.io/goreleaser | bash - - save_cache: - key: go-mod-v1-{{ checksum "go.sum" }} - paths: - - "/go/pkg/mod" - test: - docker: - - image: circleci/golang:1.13 - working_directory: /go/src/github.com/d5/tegno - steps: - - checkout - - restore_cache: - keys: - - go-mod-v1-{{ checksum "go.sum" }} - - run: go get -u golang.org/x/lint/golint - - run: make test - - save_cache: - key: go-mod-v1-{{ checksum "go.sum" }} - paths: - - "/go/pkg/mod" -workflows: - version: 2 - test: - jobs: - - test: - filters: - tags: - ignore: /.*/ - release: - jobs: - - release: - filters: - branches: - ignore: /.*/ - tags: - only: /v[0-9]+(\.[0-9]+)*(-.*)*/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f760294 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: release +on: + push: + tags: + - '*' +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: check out + uses: actions/checkout@v2 + - name: Unshallow + run: git fetch --prune --unshallow + - name: set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.14 + - name: run goreleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..555f918 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: test +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - name: set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.14 + id: go + - name: set up Go module cache + uses: actions/cache@v1 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - name: setup env + run: | + echo "::set-env name=GOPATH::$(go env GOPATH)" + echo "::add-path::$(go env GOPATH)/bin" + shell: bash + - name: check out code + uses: actions/checkout@v2 + - name: install golint + run: go get -u golang.org/x/lint/golint + - name: run tests + run: make test diff --git a/README.md b/README.md index 47eec3c..bee1959 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ # The Tengo Language [![GoDoc](https://godoc.org/github.com/d5/tengo?status.svg)](https://godoc.org/github.com/d5/tengo) +![test](https://github.com/d5/tengo/workflows/test/badge.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/d5/tengo)](https://goreportcard.com/report/github.com/d5/tengo) -[![CircleCI](https://circleci.com/gh/d5/tengo.svg?style=svg)](https://circleci.com/gh/d5/tengo) **Tengo is a small, dynamic, fast, secure script language for Go.**