Repository navigation
128 lines (114 loc) · 4.51 KB
/
Copy pathcodeql.yml
File metadata and controls
128 lines (114 loc) · 4.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# SPDX-License-Identifier: Apache-2.0
# Copyright Tony Burns
---
# CodeQL static analysis for the Go source and for the GitHub
# Actions workflows themselves. Runs on every pull request, every
# push to `main`, and weekly so the analysis re-evaluates `main`
# against newly published query updates even when nothing in the
# tree changed. Results upload to the repository's code-scanning
# dashboard as SARIF.
#
# Two languages analyze in parallel matrix slots. `go` builds with
# CodeQL autobuild; the vendored module graph lets `go build ./...`
# resolve without network fetches. `actions` scans the workflow
# files with no build step. Both run the `security-extended` query
# suite, which widens the security ruleset without pulling in the
# code-quality queries that would overlap golangci-lint.
name: codeql
on:
push:
branches: [main]
pull_request:
schedule:
# Weekly, Sunday 03:27 UTC. Off-peak and off the top of the hour
# so the run avoids the busiest scheduler slots.
- cron: "27 3 * * 0"
# Nightly mutation testing uses a separate schedule from CodeQL.
- cron: "43 4 * * *"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
analyze:
if: github.event_name != 'schedule' || github.event.schedule == '27 3 * * 0'
name: "analyze (${{ matrix.language }})"
runs-on: ubuntu-26.04
timeout-minutes: 30
permissions:
contents: read
security-events: write # upload the CodeQL results to Code Scanning
actions: read # read workflow run details for the analysis
packages: read # fetch CodeQL query packs
strategy:
fail-fast: false
matrix:
include:
- language: go
build-mode: autobuild
- language: actions
build-mode: none
steps:
- name: Harden the runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Pin the Go toolchain to the version in go.mod so autobuild
# builds with it instead of the CodeQL bundle's older Go.
- name: Set up Go
if: matrix.language == 'go'
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
check-latest: false
- name: Initialize CodeQL
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
queries: security-extended
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
with:
category: "/language:${{ matrix.language }}"
# Advisory: known survivors are reported without failing the job.
# internal/store/store.go:235:16 BRANCH_IF: equivalent; NextSequence cannot fail
# after earlier writes succeed.
# internal/store/store.go:259:10 RETURN_ZERO: equivalent; entries is already a nil slice.
# internal/store/store.go:236:10 RETURN_ERROR_NIL: not covered; needs dependency fault injection.
# internal/store/store.go:236:37 ERRORF_WRAP: not covered; same fault injection path.
mutation:
name: store mutation
if: github.event_name == 'schedule' && github.event.schedule == '43 4 * * *'
runs-on: ubuntu-26.04
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Bazel for CI
uses: tbhb-dev/rules/.github/actions/setup-bazel-ci@60295689201c97560855aebec77af4ff8c836ae9 # main
with:
disk-cache: nightly-mutation-linux
cache-save: true
- name: Test store mutations
run: bazelisk test --config=ci //:store_mutation_nightly_test --test_output=all
- name: Keep the test logs
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: store-mutation-testlogs
path: |
.bazel-testlogs/**/test.log
.bazel-testlogs/**/test.xml
include-hidden-files: true
if-no-files-found: ignore