Skip to content

Commit b223bbf

Browse files
authored
Merge pull request #101 from hyp3rd/feat/modernize
test(bench): add regression yardsticks and harden CI quality gate
2 parents fa5b229 + e3c2916 commit b223bbf

92 files changed

Lines changed: 7256 additions & 1949 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/codeql.yml

Lines changed: 61 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,65 +10,96 @@
1010
# the `language` matrix defined below to confirm you have the correct set of
1111
# supported CodeQL languages.
1212
#
13-
name: "CodeQL"
13+
name: "CodeQL Advanced"
1414

1515
on:
1616
push:
17-
branches: ["main"]
17+
branches: [ "main" ]
1818
pull_request:
19-
# The branches below must be a subset of the branches above
20-
branches: ["main"]
19+
branches: [ "main" ]
2120
schedule:
22-
- cron: "33 23 * * 3"
21+
- cron: "31 1 * * 4"
22+
23+
permissions:
24+
contents: read
2325

2426
jobs:
2527
analyze:
26-
name: Analyze
27-
runs-on: ubuntu-latest
28+
name: Analyze (${{ matrix.language }})
29+
# Runner size impacts CodeQL analysis time. To learn more, please see:
30+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
31+
# - https://gh.io/supported-runners-and-hardware-resources
32+
# - https://gh.io/using-larger-runners (GitHub.com only)
33+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
34+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
2835
permissions:
36+
# required for all workflows
37+
security-events: write
38+
39+
# required to fetch internal or private CodeQL packs
40+
packages: read
41+
42+
# only required for workflows in private repositories
2943
actions: read
3044
contents: read
31-
security-events: write
3245

3346
strategy:
3447
fail-fast: false
3548
matrix:
36-
language: ["go"]
37-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
38-
# Use only 'java' to analyze code written in Java, Kotlin or both
39-
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
40-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
41-
49+
include:
50+
- language: actions
51+
build-mode: none
52+
- language: go
53+
build-mode: autobuild
54+
- language: ruby
55+
build-mode: none
56+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
57+
# Use `c-cpp` to analyze code written in C, C++ or both
58+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
59+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
60+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
61+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
62+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
63+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
4264
steps:
4365
- name: Checkout repository
44-
uses: actions/checkout@v6
66+
uses: actions/checkout@v4
67+
68+
# Add any setup steps before running the `github/codeql-action/init` action.
69+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
70+
# or others). This is typically only required for manual builds.
71+
# - name: Setup runtime (example)
72+
# uses: actions/setup-example@v1
4573

4674
# Initializes the CodeQL tools for scanning.
4775
- name: Initialize CodeQL
4876
uses: github/codeql-action/init@v4
4977
with:
5078
languages: ${{ matrix.language }}
79+
build-mode: ${{ matrix.build-mode }}
5180
# If you wish to specify custom queries, you can do so here or in a config file.
5281
# By default, queries listed here will override any specified in a config file.
5382
# Prefix the list here with "+" to use these queries and those in the config file.
5483

55-
# 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
84+
# 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
5685
# queries: security-extended,security-and-quality
5786

58-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
59-
# If this step fails, then you should remove it and run the build manually (see below)
60-
- name: Autobuild
61-
uses: github/codeql-action/autobuild@v4
62-
63-
# ℹ️ Command-line programs to run using the OS shell.
64-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
65-
66-
# If the Autobuild fails above, remove it and uncomment the following three lines.
67-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
68-
69-
# - run: |
70-
# echo "Run, Build Application using script"
71-
# ./location_of_script_within_repo/buildscript.sh
87+
# If the analyze step fails for one of the languages you are analyzing with
88+
# "We were unable to automatically build your code", modify the matrix above
89+
# to set the build mode to "manual" for that language. Then modify this step
90+
# to build your code.
91+
# ℹ️ Command-line programs to run using the OS shell.
92+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
93+
- name: Run manual build steps
94+
if: matrix.build-mode == 'manual'
95+
shell: bash
96+
run: |
97+
echo 'If you are using a "manual" build mode for one or more of the' \
98+
'languages you are analyzing, replace this with the commands to build' \
99+
'your code, for example:'
100+
echo ' make bootstrap'
101+
echo ' make release'
102+
exit 1
72103
73104
- name: Perform CodeQL Analysis
74105
uses: github/codeql-action/analyze@v4

.github/workflows/lint.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ name: lint
44
on:
55
pull_request:
66
push:
7-
branches: [main]
8-
7+
branches: [ main ]
8+
permissions:
9+
contents: read
910
jobs:
1011
lint:
1112
runs-on: ubuntu-latest
@@ -32,26 +33,33 @@ jobs:
3233
path: |
3334
~/go/pkg/mod
3435
~/.cache/go-build
35-
key: ${{ runner.os }}-go-${{ steps.settings.outputs.go_version }}-${{ hashFiles('**/go.sum') }}
36+
key: ${{ runner.os }}-go-${{ steps.settings.outputs.go_version }}-${{
37+
hashFiles('**/go.sum') }}
3638
restore-keys: |
3739
${{ runner.os }}-go-${{ steps.settings.outputs.go_version }}-
3840
- name: Install tools
3941
run: |
4042
go install github.com/daixiang0/gci@latest
4143
go install mvdan.cc/gofumpt@latest
4244
go install honnef.co/go/tools/cmd/staticcheck@latest
43-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b "$(go env GOPATH)/bin" "${{ steps.settings.outputs.golangci_lint_version }}"
4445
- name: Modules
4546
run: go mod download
4647
- name: Tidy check
4748
run: |
4849
go mod tidy
4950
git diff --exit-code go.mod go.sum
5051
- name: gci
51-
run: gci write -s standard -s default -s blank -s dot -s "prefix(${{ steps.settings.outputs.gci_prefix }})" -s localmodule --skip-vendor --skip-generated $(find . -type f -name '*.go' -not -path "./pkg/api/*" -not -path "./vendor/*" -not -path "./.gocache/*" -not -path "./.git/*")
52+
run: gci write -s standard -s default -s blank -s dot -s "prefix(${{
53+
steps.settings.outputs.gci_prefix }})" -s localmodule --skip-vendor
54+
--skip-generated $(find . -type f -name '*.go' -not -path
55+
"./pkg/api/*" -not -path "./vendor/*" -not -path "./.gocache/*" -not
56+
-path "./.git/*")
5257
- name: gofumpt
53-
run: gofumpt -l -w $(find . -type f -name '*.go' -not -path "./pkg/api/*" -not -path "./vendor/*" -not -path "./.gocache/*" -not -path "./.git/*")
58+
run: gofumpt -l -w $(find . -type f -name '*.go' -not -path "./pkg/api/*" -not
59+
-path "./vendor/*" -not -path "./.gocache/*" -not -path "./.git/*")
5460
- name: staticcheck
5561
run: staticcheck ./...
5662
- name: golangci-lint
57-
run: golangci-lint run -v ./...
63+
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20
64+
# with:
65+
# version: "${{ steps.settings.outputs.golangci_lint_version }}"

.github/workflows/pre-commit.yml

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

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ jobs:
3434
${{ runner.os }}-go-${{ steps.settings.outputs.go_version }}-
3535
- name: Modules
3636
run: go mod download
37-
- name: Test (race + coverage)
38-
run: RUN_INTEGRATION_TEST=yes go test -race -coverprofile=coverage.out ./...
37+
- name: Test (race + shuffle + repeated)
38+
run: >
39+
RUN_INTEGRATION_TEST=yes
40+
go test -race -count=10 -shuffle=on -timeout=15m
41+
-coverprofile=coverage.out ./...
3942
- name: Upload coverage artifact
4043
uses: actions/upload-artifact@v6
4144
with:

0 commit comments

Comments
 (0)