diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..fbd1835 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,58 @@ +# CodeQL analysis for Continuous SDL / S360 compliance. +# The Go code lives under plugins/ (module github.com/tensorworks/directx-device-plugins/plugins) +# and is Windows-only (//go:build windows), so autobuild on ubuntu (GOOS=linux) +# finds no packages. We use build-mode: manual and cross-compile with +# GOOS=windows so CodeQL can trace the build and extract the Windows packages. +name: "CodeQL" + +on: + push: + branches: [main] + pull_request: + branches: [main] + schedule: + - cron: "0 9 * * 1" + workflow_dispatch: + +permissions: + contents: read + +jobs: + analyze: + name: Analyze (go) + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + language: ["go"] + + steps: + - name: Checkout repository + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: Set up Go + uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 + with: + go-version-file: plugins/go.mod + + - name: Initialize CodeQL + uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + with: + languages: ${{ matrix.language }} + build-mode: manual + + - name: Manual build (Windows target) + working-directory: plugins + env: + GOOS: windows + GOARCH: amd64 + run: go build ./... + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3.26.6 + with: + category: "/language:${{ matrix.language }}"