mirror of
https://github.com/cheikh2shift/godex.git
synced 2026-10-21 10:40:08 -05:00
77 lines
1.9 KiB
YAML
77 lines
1.9 KiB
YAML
name: "CodeQL Advanced"
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main" ]
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
analyze:
|
|
name: Analyze (${{ matrix.language }})
|
|
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
|
permissions:
|
|
security-events: write
|
|
packages: read
|
|
actions: read
|
|
contents: read
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- language: actions
|
|
build-mode: none
|
|
- language: go
|
|
build-mode: manual
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Initialize CodeQL
|
|
uses: github/codeql-action/init@v4
|
|
with:
|
|
languages: ${{ matrix.language }}
|
|
build-mode: ${{ matrix.build-mode }}
|
|
|
|
- name: Run manual build steps
|
|
if: matrix.build-mode == 'manual'
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
export CGO_ENABLED=0
|
|
pkgs=$(go list ./...)
|
|
for GOOS in linux windows darwin; do
|
|
echo "Building for $GOOS..."
|
|
if [ "$GOOS" = "linux" ]; then
|
|
GOOS=$GOOS GOARCH=amd64 go test ./...
|
|
continue
|
|
fi
|
|
for pkg in $pkgs; do
|
|
out="/tmp/$(echo "$pkg" | tr '/' '_').test"
|
|
GOOS=$GOOS GOARCH=amd64 go test -c -o "$out" "$pkg"
|
|
done
|
|
done
|
|
|
|
- name: Perform CodeQL Analysis
|
|
uses: github/codeql-action/analyze@v4
|
|
with:
|
|
category: "/language:${{matrix.language}}"
|
|
|
|
semgrep:
|
|
name: Semgrep (Malicious Patterns)
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
security-events: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Semgrep scan
|
|
uses: docker://semgrep/semgrep
|
|
with:
|
|
args: semgrep scan --config auto --config .semgrep/malicious-api.yml --sarif --output semgrep.sarif
|
|
- name: Upload SARIF
|
|
uses: github/codeql-action/upload-sarif@v4
|
|
with:
|
|
sarif_file: semgrep.sarif
|