-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] add basic static check, complie, test
Signed-off-by: xiaoming <[email protected]>
- Loading branch information
Showing
45 changed files
with
223 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ "master","develop" ] | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: [ "master","develop" ] | ||
schedule: | ||
- cron: '0 17 * * 5' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
# timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'go' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ] | ||
# Use only 'java' to analyze code written in Java, Kotlin or both | ||
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both | ||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
|
||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | ||
# queries: security-extended,security-and-quality | ||
|
||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). | ||
# If this step fails, then you should remove it and run the build manually (see below) | ||
- name: Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,23 @@ on: | |
branches: [ $default-branch, "develop" ] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.19' | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Setup golangci-lint | ||
uses: golangci/[email protected] | ||
with: | ||
version: v1.52.2 | ||
args: --verbose | ||
|
||
test: | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -21,15 +37,13 @@ jobs: | |
run: make test | ||
|
||
build: | ||
needs: test | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
- name: Set dependencies | ||
run: sudo apt update && sudo apt install musl-tools | ||
- name: Build | ||
run: make build | ||
run: go build -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
run: | ||
timeout: 5m | ||
linters: | ||
enable: | ||
# Simple linter to check that your code does not contain non-ASCII identifiers. | ||
- asciicheck | ||
# Go linter that checks if package imports are in a list of acceptable packages. | ||
#- depguard | ||
# Checks for pointers to enclosing loop variables. | ||
- exportloopref | ||
# Gofmt checks whether code was gofmt-ed | ||
- gofmt | ||
# Inspects source code for security problems. | ||
- gosec | ||
# Finds naked returns in functions greater than a specified function length. | ||
- nakedret | ||
# Reports ill-formed or insufficient nolint directives. | ||
- nolintlint | ||
# Checks for dangerous unicode character sequences. | ||
- bidichk | ||
disable: | ||
# ignore unused check | ||
- unused | ||
# ignore errcheck | ||
- errcheck | ||
linters-settings: | ||
gosec: | ||
# Available rules: https://github.com/securego/gosec#available-rules | ||
excludes: | ||
- G101 # Look for hard coded credentials | ||
- G204 # Audit use of command execution | ||
- G401 # Detect the usage of DES, RC4, MD5 or SHA1 | ||
- G403 # Ensure minimum RSA key length of 2048 bits | ||
- G404 # Insecure random number source (rand) | ||
- G501 # Import blocklist: crypto/md5 | ||
- G502 # Import blocklist: crypto/des | ||
- G503 # Import blocklist: crypto/rc4 | ||
- G504 # Import blocklist: net/http/cgi | ||
- G505 # Import blocklist: crypto/sha1 | ||
- G601 # Implicit memory aliasing of items from a range statement | ||
|
||
staticcheck: | ||
# Use default values for all except the SA4006(it will check unused variable). '-' means ignorance | ||
checks: ["all", "-ST1000", "-ST1003", "-ST1016", "-ST1020", "-ST1021", "-ST1022", "-SA4006"] | ||
|
||
issues: | ||
# Fix found issues (if it's supported by the linter). | ||
fix: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.