2020-03-11 00:54:39 +00:00
|
|
|
name: Test
|
2020-03-21 11:54:27 +00:00
|
|
|
on: [push]
|
2020-03-21 03:55:18 +00:00
|
|
|
|
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-11-02 12:19:37 +00:00
|
|
|
uses: actions/setup-go@v2.1.3
|
2020-03-03 05:33:41 +00:00
|
|
|
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
|
2020-11-02 12:19:37 +00:00
|
|
|
uses: actions/setup-go@v2.1.3
|
2020-03-03 10:59:20 +00:00
|
|
|
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
|
2020-03-11 12:47:36 +00:00
|
|
|
run: go test -coverprofile cover.out ./...
|
|
|
|
|
|
|
|
- name: SonarCloud Scan
|
|
|
|
uses: sonarsource/sonarcloud-github-action@master
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
2020-03-04 04:59:37 +00:00
|
|
|
|
2020-03-10 12:55:13 +00:00
|
|
|
image-scan:
|
|
|
|
name: Image Scan
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Unshallow
|
|
|
|
run: git fetch --prune --unshallow
|
|
|
|
|
|
|
|
- name: Set up Go
|
2020-11-02 12:19:37 +00:00
|
|
|
uses: actions/setup-go@v2.1.3
|
2020-03-10 12:55:13 +00:00
|
|
|
with:
|
|
|
|
go-version: 1.14
|
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: Run GoReleaser
|
2020-11-02 12:24:31 +00:00
|
|
|
uses: goreleaser/goreleaser-action@v2.2.1
|
2020-03-10 12:55:13 +00:00
|
|
|
with:
|
|
|
|
version: latest
|
|
|
|
args: release --rm-dist --skip-validate --skip-publish
|
|
|
|
key: ${{ secrets.YOUR_PRIVATE_KEY }}
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Scan image
|
2020-11-02 11:59:44 +00:00
|
|
|
uses: anchore/scan-action@v2
|
2020-03-10 12:55:13 +00:00
|
|
|
with:
|
2020-11-02 11:59:44 +00:00
|
|
|
image: "hipages/php-fpm_exporter:latest"
|
2020-03-10 12:55:13 +00:00
|
|
|
fail-build: true
|
|
|
|
|
2020-03-04 04:59:37 +00:00
|
|
|
tag:
|
|
|
|
name: Tag
|
|
|
|
runs-on: ubuntu-latest
|
2020-03-11 00:36:41 +00:00
|
|
|
needs: [lint, test, image-scan]
|
2020-03-04 04:59:37 +00:00
|
|
|
if: github.ref == 'refs/heads/master'
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Setup Node.js for use with actions
|
2020-11-02 12:21:39 +00:00
|
|
|
uses: actions/setup-node@v2.1.2
|
2020-03-04 04:59:37 +00:00
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Unshallow
|
|
|
|
run: git fetch --prune --unshallow
|
2020-03-10 12:55:13 +00:00
|
|
|
|
2020-03-04 04:59:37 +00:00
|
|
|
- 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
|
2020-03-04 05:51:09 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|