2022-03-30 11:42:07 +00:00
|
|
|
name: Test PR
|
2020-11-20 20:33:08 +00:00
|
|
|
on:
|
2021-04-22 00:26:37 +00:00
|
|
|
pull_request_target:
|
2020-11-20 20:33:08 +00:00
|
|
|
workflow_dispatch:
|
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
|
2023-09-01 14:02:01 +00:00
|
|
|
uses: actions/setup-go@v4.1.0
|
2020-03-03 05:33:41 +00:00
|
|
|
with:
|
2022-02-08 21:56:44 +00:00
|
|
|
go-version: 1.17
|
2020-03-03 05:33:41 +00:00
|
|
|
id: go
|
|
|
|
|
2020-03-04 04:59:37 +00:00
|
|
|
- name: Checkout
|
2022-03-30 11:03:28 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-03-30 11:27:49 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2020-03-03 05:33:41 +00:00
|
|
|
|
2020-11-22 00:15:40 +00:00
|
|
|
- name: golangci-lint
|
2024-11-01 14:31:35 +00:00
|
|
|
uses: golangci/golangci-lint-action@v6.1.1
|
2020-11-22 00:15:40 +00:00
|
|
|
with:
|
2022-02-08 21:56:44 +00:00
|
|
|
version: v1.44
|
2020-03-03 10:59:20 +00:00
|
|
|
|
|
|
|
test:
|
|
|
|
name: Test
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
2020-11-22 00:15:40 +00:00
|
|
|
- name: Setup Go
|
2023-09-01 14:02:01 +00:00
|
|
|
uses: actions/setup-go@v4.1.0
|
2020-03-03 10:59:20 +00:00
|
|
|
with:
|
2022-02-08 21:56:44 +00:00
|
|
|
go-version: 1.17
|
2020-03-03 10:59:20 +00:00
|
|
|
id: go
|
|
|
|
|
2020-03-04 04:59:37 +00:00
|
|
|
- name: Checkout
|
2022-03-30 11:03:28 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-03-30 11:27:49 +00:00
|
|
|
with:
|
|
|
|
ref: "refs/pull/${{ github.event.number }}/merge"
|
2020-03-03 10:59:20 +00:00
|
|
|
|
|
|
|
- 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
|
2022-03-30 11:03:28 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-03-30 11:02:19 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-03-30 11:17:02 +00:00
|
|
|
ref: "refs/pull/${{ github.event.number }}/merge"
|
2020-03-10 12:55:13 +00:00
|
|
|
|
2020-11-22 00:15:40 +00:00
|
|
|
- name: Setup Go
|
2023-09-01 14:02:01 +00:00
|
|
|
uses: actions/setup-go@v4.1.0
|
2020-03-10 12:55:13 +00:00
|
|
|
with:
|
2022-02-08 21:56:44 +00:00
|
|
|
go-version: 1.17
|
2020-03-10 12:55:13 +00:00
|
|
|
id: go
|
|
|
|
|
|
|
|
- name: Run GoReleaser
|
2023-07-01 14:45:01 +00:00
|
|
|
uses: goreleaser/goreleaser-action@v4.3.0
|
2020-03-10 12:55:13 +00:00
|
|
|
with:
|
|
|
|
version: latest
|
2022-03-30 10:51:55 +00:00
|
|
|
args: release --rm-dist --snapshot
|
2020-03-10 12:55:13 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Scan image
|
2024-10-01 14:07:40 +00:00
|
|
|
uses: anchore/scan-action@v4.1.2
|
2022-02-16 21:04:28 +00:00
|
|
|
id: scan
|
2020-03-10 12:55:13 +00:00
|
|
|
with:
|
2020-11-02 11:59:44 +00:00
|
|
|
image: "hipages/php-fpm_exporter:latest"
|
2022-02-16 21:04:28 +00:00
|
|
|
acs-report-enable: true
|
2022-02-16 21:18:53 +00:00
|
|
|
fail-build: false
|
2022-02-16 21:04:28 +00:00
|
|
|
|
|
|
|
- name: Upload Anchore scan SARIF report
|
2022-05-02 12:57:58 +00:00
|
|
|
uses: github/codeql-action/upload-sarif@v2
|
2022-02-16 21:04:28 +00:00
|
|
|
with:
|
|
|
|
sarif_file: ${{ steps.scan.outputs.sarif }}
|