mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
78 lines
2.1 KiB
YAML
78 lines
2.1 KiB
YAML
name: Test Go extractor
|
|
description: Run build, QL tests, and optionally basic code sanity checks (formatting and generated code) for the Go extractor
|
|
inputs:
|
|
go-test-version:
|
|
description: Which Go version to use for running the tests
|
|
required: false
|
|
default: "~1.24.0"
|
|
run-code-checks:
|
|
description: Whether to run formatting, code and qhelp generation checks
|
|
required: false
|
|
default: false
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Set up Go ${{ inputs.go-test-version }}
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ inputs.go-test-version }}
|
|
cache: false
|
|
id: go
|
|
|
|
- name: Set up CodeQL CLI
|
|
uses: ./.github/actions/fetch-codeql
|
|
|
|
- name: Enable problem matchers in repository
|
|
shell: bash
|
|
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
|
|
|
|
- name: Check checked-in generated code
|
|
if: inputs.run-code-checks == 'true'
|
|
shell: bash
|
|
run: |
|
|
bazel run go:gen
|
|
git add .
|
|
git diff --exit-code HEAD || (
|
|
echo "please run bazel run //go:gen"
|
|
exit 1
|
|
)
|
|
|
|
- name: Build
|
|
shell: bash
|
|
run: |
|
|
bazel run go:go-installer
|
|
|
|
- name: Check that all Go code is autoformatted
|
|
if: inputs.run-code-checks == 'true' && !cancelled()
|
|
shell: bash
|
|
run: |
|
|
cd go
|
|
make check-formatting
|
|
|
|
- name: Compile qhelp files to markdown
|
|
if: inputs.run-code-checks == 'true' && !cancelled()
|
|
id: markdown
|
|
shell: bash
|
|
run: |
|
|
cd go
|
|
env QHELP_OUT_DIR=qhelp-out make qhelp-to-markdown
|
|
|
|
- name: Upload qhelp markdown
|
|
if: inputs.run-code-checks == 'true' && !cancelled()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: qhelp-markdown
|
|
path: go/qhelp-out/**/*.md
|
|
|
|
- name: Cache compilation cache
|
|
id: query-cache
|
|
uses: ./.github/actions/cache-query-compilation
|
|
with:
|
|
key: go-qltest
|
|
|
|
- name: Test
|
|
shell: bash
|
|
run: |
|
|
cd go
|
|
make test cache="${{ steps.query-cache.outputs.cache-dir }}"
|