php-fpm-exporter/.github/workflows/go.yml

91 lines
2 KiB
YAML
Raw Normal View History

2020-03-03 05:33:41 +00:00
name: Go
2020-03-04 22:37:30 +00:00
on: [push, pull_request]
2020-03-03 05:33:41 +00:00
jobs:
2020-03-03 10:59:20 +00:00
lint:
2020-03-03 05:46:33 +00:00
name: Lint
2020-03-03 05:33:41 +00:00
runs-on: ubuntu-latest
steps:
2020-03-04 04:59:37 +00:00
- name: Set up Go
2020-03-03 05:33:41 +00:00
uses: actions/setup-go@v1
with:
2020-03-03 10:47:07 +00:00
go-version: 1.14
2020-03-03 05:33:41 +00:00
id: go
2020-03-04 04:59:37 +00:00
- name: Checkout
2020-03-03 05:33:41 +00:00
uses: actions/checkout@v2
2020-03-03 10:47:07 +00:00
- name: Install golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.7
- name: Lint
2020-03-03 10:50:25 +00:00
run: $(go env GOPATH)/bin/golangci-lint run
2020-03-03 10:59:20 +00:00
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
2020-03-04 04:59:37 +00:00
- name: Checkout
2020-03-03 10:59:20 +00:00
uses: actions/checkout@v2
- name: Test
run: go test ./...
2020-03-04 04:59:37 +00:00
tag:
name: Tag
runs-on: ubuntu-latest
needs: [lint, test]
if: github.ref == 'refs/heads/master'
steps:
- name: Setup Node.js for use with actions
uses: actions/setup-node@v1.1.0
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Install semantic-release
run: yarn global add --no-progress --non-interactive "semantic-release" "@semantic-release/exec"
- name: Run semantic-release
run: $(yarn global bin)/semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2020-03-04 04:59:37 +00:00
release:
runs-on: ubuntu-latest
needs: [lint, test]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
key: ${{ secrets.YOUR_PRIVATE_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}