Skip to content

Commit d37021f

Browse files
committed
ci: add CodeQL workflow and optimize builds
1 parent 2fc290d commit d37021f

File tree

2 files changed

+38
-22
lines changed

2 files changed

+38
-22
lines changed

.github/workflows/codeql.yml

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
# supported CodeQL languages.
1111
#
1212
name: "CodeQL"
13-
timeout-minutes: 60
1413
on:
1514
push:
1615
branches: ["main"]
16+
paths:
17+
- "**.go"
1718
pull_request:
18-
# The branches below must be a subset of the branches above
1919
branches: ["main"]
20+
paths:
21+
- "**.go"
2022
schedule:
2123
- cron: "0 0 * * *"
2224

@@ -26,7 +28,7 @@ permissions:
2628
jobs:
2729
analyze:
2830
name: Analyze
29-
runs-on: ubuntu-latest
31+
runs-on: ubuntu-8core
3032
if: ${{ github.actor != 'dependabot[bot]' }}
3133
permissions:
3234
actions: read
@@ -52,25 +54,12 @@ jobs:
5254
- name: Initialize CodeQL
5355
uses: github/codeql-action/init@42213152a85ae7569bdb6bec7bcd74cd691bfe41 # v3.30.9
5456
with:
55-
languages: ${{ matrix.language }}
56-
# If you wish to specify custom queries, you can do so here or in a config file.
57-
# By default, queries listed here will override any specified in a config file.
58-
# Prefix the list here with "+" to use these queries and those in the config file.
57+
languages: go
58+
dependency-caching: true
5959

60-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
61-
# If this step fails, then you should remove it and run the build manually (see below)
62-
- name: Autobuild
63-
uses: github/codeql-action/autobuild@42213152a85ae7569bdb6bec7bcd74cd691bfe41 # v3.30.9
64-
65-
# ℹ️ Command-line programs to run using the OS shell.
66-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
67-
68-
# If the Autobuild fails above, remove it and uncomment the following three lines.
69-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
70-
71-
# - run: |
72-
# echo "Run, Build Application using script"
73-
# ./location_of_script_within_repo/buildscript.sh
60+
# Build with slim tag to exclude heavy cloud provider dependencies (AWS/Azure/GCP SDKs)
61+
- name: Build
62+
run: go build -tags slim ./...
7463

7564
- name: Perform CodeQL Analysis
7665
uses: github/codeql-action/analyze@42213152a85ae7569bdb6bec7bcd74cd691bfe41 # v3.30.9

.github/workflows/test.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ jobs:
1616
go-version: 1.25.x
1717
- name: Checkout code
1818
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
19+
- name: Install deps
20+
uses: flanksource/[email protected]
21+
with:
22+
tools: |
23+
bun
24+
uv
25+
powershell
26+
postgrest
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1928
- uses: buildjet/cache@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4
2029
with:
2130
path: |
@@ -65,6 +74,15 @@ jobs:
6574
go-version: 1.25.x
6675
- name: Checkout code
6776
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
77+
- name: Install deps
78+
uses: flanksource/[email protected]
79+
with:
80+
tools: |
81+
bun
82+
uv
83+
powershell
84+
postgrest
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6886
- uses: buildjet/cache@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4
6987
with:
7088
path: |
@@ -79,7 +97,7 @@ jobs:
7997
make ginkgo
8098
ginkgo -r tests/e2e/
8199
env:
82-
DUTY_DB_DISABLE_RLS: 'true'
100+
DUTY_DB_DISABLE_RLS: "true"
83101
LOKI_URL: http://localhost:3100
84102
OPENSEARCH_URL: http://localhost:9200
85103

@@ -104,6 +122,15 @@ jobs:
104122
key: cache-${{ hashFiles('**/go.sum') }}-${{ hashFiles('.bin/*') }}
105123
restore-keys: |
106124
cache-
125+
- name: Install deps
126+
uses: flanksource/[email protected]
127+
with:
128+
tools: |
129+
bun
130+
uv
131+
powershell
132+
postgrest
133+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107134
- name: Test
108135
run: make test-prod
109136

0 commit comments

Comments
 (0)