Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

Commit 6af723a

Browse files
author
odacremolbap
committed
add linter workflow
1 parent 274e5f8 commit 6af723a

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

.github/workflows/codeql.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CodeQL scanning
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: '0 0 * * 0' # At 00:00 every Sunday
10+
jobs:
11+
12+
codeql:
13+
runs-on: ubuntu-latest
14+
env:
15+
# Force CodeQL to run the extraction on the files compiled by our custom
16+
# build command, as opposed to letting the autobuilder figure it out.
17+
# This approach is more efficient because TriggerMesh is composed of
18+
# multiple small programs.
19+
CODEQL_EXTRACTOR_GO_BUILD_TRACING: 'on'
20+
21+
permissions:
22+
security-events: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v3
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@v3
30+
with:
31+
go-version: 1.19.x
32+
33+
- name: Go caches
34+
uses: actions/cache@v3
35+
with:
36+
path: |
37+
~/.cache/go-build
38+
~/go/pkg/mod
39+
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
40+
restore-keys: |
41+
${{ github.job }}-${{ runner.os }}-go-
42+
43+
- name: Initialize CodeQL
44+
uses: github/codeql-action/init@v2
45+
with:
46+
languages: go
47+
48+
- name: Build Go code
49+
run: go build ./cmd/...
50+
51+
52+
- name: Perform CodeQL Analysis
53+
uses: github/codeql-action/analyze@v2

.github/workflows/static.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Static code analysis
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
11+
lint-code:
12+
name: Code Linting
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v3
20+
with:
21+
go-version: 1.19.x
22+
23+
# This action takes care of caching/restoring modules and build caches.
24+
# Therefore, this step should remain the first one that is executed after
25+
# the Go setup, in case other steps are added to this job in the future.
26+
- name: Lint Go code
27+
uses: golangci/golangci-lint-action@v3
28+
with:
29+
# (hack) By default, errors are reported to the GitHub commit view only
30+
# (or the "Files changed" tab on PRs). We also want errors to be logged
31+
# with line numbers to the execution logs of the workflow.
32+
#
33+
# The args below result in the following flags being passed to the
34+
# linter command, which works, quite surprisingly:
35+
# --out-format=github-actions --out-format=colored-line-number
36+
#
37+
# Ref. https://github.com/golangci/golangci-lint-action/issues/119#issuecomment-981090648
38+
args: --out-${NO_FUTURE}format=colored-line-number --timeout 15m
39+

0 commit comments

Comments
 (0)