Skip to content

Commit

Permalink
run codeql in tests.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc committed Jun 26, 2023
1 parent c832231 commit 3087f9f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 73 deletions.
61 changes: 0 additions & 61 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Static Analysis

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]


jobs:
build:
name: "golangci-lint + codeql"
runs-on: ubuntu-latest

permissions:
security-events: write

steps:

- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.20.5

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: go, python

- name: Build
run: |
make build
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
args: --issues-exit-code=1 --timeout 10m
only-new-issues: false
# the cache is already managed above, enabling it here
# gives errors when extracting
skip-pkg-cache: true
skip-build-cache: true

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
11 changes: 0 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,3 @@ jobs:
EOT
sleep 5
sudo -E pipenv run pytest ./test/install/with_crowdsec
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.51
args: --issues-exit-code=1 --timeout 10m
only-new-issues: false
# the cache is already managed above, enabling it here
# gives errors when extracting
skip-pkg-cache: true
skip-build-cache: true
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ linters:
# Disabled
#
- gci # Gci control golang package import order and make it always deterministic.
- depguard # Go linter that checks if package imports are in a list of acceptable packages

#
# Enabled
Expand All @@ -59,7 +60,6 @@ linters:
# - containedctx # containedctx is a linter that detects struct contained context.Context field
# - contextcheck # check the function whether use a non-inherited context
# - decorder # check declaration order and count of types, constants, variables and functions
# - depguard # Go linter that checks if package imports are in a list of acceptable packages
# - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f())
# - durationcheck # check for two durations multiplied together
# - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases
Expand Down

0 comments on commit 3087f9f

Please sign in to comment.