Skip to content

Commit a1ffed1

Browse files
committed
ci: update
1 parent ef381ed commit a1ffed1

File tree

9 files changed

+347
-130
lines changed

9 files changed

+347
-130
lines changed

.github/workflows/codeql.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: codeql
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
analyze:
11+
name: analyze
12+
runs-on: ubuntu-latest
13+
permissions:
14+
actions: read
15+
contents: read
16+
security-events: write
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
language: [ 'go' ]
22+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
23+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v2
28+
29+
# Initializes the CodeQL tools for scanning.
30+
- name: Initialize CodeQL
31+
uses: github/codeql-action/init@v1
32+
with:
33+
languages: ${{ matrix.language }}
34+
# If you wish to specify custom queries, you can do so here or in a config file.
35+
# By default, queries listed here will override any specified in a config file.
36+
# Prefix the list here with "+" to use these queries and those in the config file.
37+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
38+
39+
- name: Install Go
40+
uses: actions/setup-go@v2.1.4
41+
with:
42+
go-version: 1.17
43+
44+
- name: Perform CodeQL Analysis
45+
uses: github/codeql-action/analyze@v1

.github/workflows/commit.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: commit
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
if: github.actor != 'dependabot[bot]'
13+
steps:
14+
- uses: actions/checkout@v2.4.0
15+
with:
16+
fetch-depth: 0
17+
- uses: wagoid/commitlint-github-action@v4.1.9

.github/workflows/cover.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: cover
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Install Go
14+
uses: actions/setup-go@v2.1.4
15+
with:
16+
go-version: 1.17
17+
18+
- name: Get Go environment
19+
id: go-env
20+
run: |
21+
echo "::set-output name=cache::$(go env GOCACHE)"
22+
echo "::set-output name=modcache::$(go env GOMODCACHE)"
23+
- name: Set up cache
24+
uses: actions/cache@v2.1.6
25+
with:
26+
path: |
27+
${{ steps.go-env.outputs.cache }}
28+
${{ steps.go-env.outputs.modcache }}
29+
key: test-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30+
restore-keys: |
31+
test-${{ runner.os }}-go-
32+
33+
- name: Checkout code
34+
uses: actions/checkout@v2.4.0
35+
36+
- name: Run tests with coverage
37+
run: make coverage
38+
39+
- name: Upload artifact
40+
uses: actions/upload-artifact@v2.2.4
41+
with:
42+
name: coverage
43+
path: profile.out
44+
if-no-files-found: error
45+
retention-days: 1
46+
47+
- name: Send coverage
48+
uses: codecov/codecov-action@v2.1.0
49+
with:
50+
file: profile.out
51+
52+
send:
53+
runs-on: ubuntu-latest
54+
needs:
55+
- run
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v2.4.0
59+
60+
- name: Download artifact
61+
uses: actions/download-artifact@v2.0.10
62+
with:
63+
name: coverage
64+
65+
- name: Send coverage
66+
uses: codecov/codecov-action@v2.1.0
67+
with:
68+
file: profile.out

.github/workflows/lint.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2.4.0
15+
16+
- name: Install Go
17+
uses: actions/setup-go@v2.1.4
18+
with:
19+
go-version: 1.17
20+
21+
- name: Lint
22+
uses: golangci/golangci-lint-action@v2.5.2
23+
with:
24+
version: latest
25+
args: --timeout 5m
26+
skip-go-installation: true
27+
28+
# Check if there are any dirty changes after go mod tidy
29+
mod:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v2.4.0
34+
35+
- name: Install Go
36+
uses: actions/setup-go@v2.1.4
37+
with:
38+
go-version: 1.17
39+
40+
- name: Get Go environment
41+
id: go-env
42+
run: |
43+
echo "::set-output name=cache::$(go env GOCACHE)"
44+
echo "::set-output name=modcache::$(go env GOMODCACHE)"
45+
- name: Set up cache
46+
uses: actions/cache@v2.1.6
47+
with:
48+
path: |
49+
${{ steps.go-env.outputs.cache }}
50+
${{ steps.go-env.outputs.modcache }}
51+
key: check-mod-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
52+
restore-keys: |
53+
check-mod-${{ runner.os }}-go-
54+
55+
- name: Tidy
56+
run: go mod tidy
57+
58+
- name: Check git diff
59+
run: git diff --exit-code
60+
61+
# Check if there are any dirty changes after go generate
62+
gen:
63+
runs-on: ubuntu-latest
64+
steps:
65+
- name: Checkout code
66+
uses: actions/checkout@v2.4.0
67+
68+
- name: Install Go
69+
uses: actions/setup-go@v2.1.4
70+
with:
71+
go-version: 1.17
72+
73+
- name: Get Go environment
74+
id: go-env
75+
run: |
76+
echo "::set-output name=cache::$(go env GOCACHE)"
77+
echo "::set-output name=modcache::$(go env GOMODCACHE)"
78+
- name: Set up cache
79+
uses: actions/cache@v2.1.6
80+
with:
81+
path: |
82+
${{ steps.go-env.outputs.cache }}
83+
${{ steps.go-env.outputs.modcache }}
84+
key: check-generate-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
85+
restore-keys: |
86+
check-generate-${{ runner.os }}-go-
87+
88+
- name: Generate
89+
run: go generate ./...
90+
91+
- name: Check git diff
92+
run: git diff --exit-code

.github/workflows/nancy.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: nancy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
run:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2.4.0
15+
16+
- name: Install Go
17+
uses: actions/setup-go@v2.1.4
18+
with:
19+
go-version: 1.17
20+
21+
- name: List dependencies
22+
run: go list -json -m all > go.list
23+
24+
- name: Run nancy
25+
uses: sonatype-nexus-community/nancy-github-action@v1.0.2

.github/workflows/pr-extra.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/pr.yml

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)