diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml new file mode 100644 index 0000000000..8739a1dc0f --- /dev/null +++ b/.github/workflows/codeql.yaml @@ -0,0 +1,71 @@ +--- +name: CodeQL +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.ref }} +on: + pull_request: + branches: + - main + paths-ignore: + - "docs/**" + push: + branches: + - main + paths-ignore: + - "docs/**" + schedule: + - cron: "17 4 * * 1" +permissions: + contents: read +env: + GOTOOLCHAIN: local + GOFLAGS: "-tags=nowatcher,nobadger,nomysql,nopgx" +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: c-cpp + build-mode: manual + - language: go + build-mode: manual + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - if: matrix.build-mode == 'manual' + uses: ./.github/actions/setup-go + with: + # A warm build cache skips the compiler calls the extractors trace + cache: "false" + - if: matrix.build-mode == 'manual' + uses: ./.github/actions/setup-php + - name: Install libbrotli-dev + if: matrix.build-mode == 'manual' + run: sudo apt-get install -y libbrotli-dev + - name: Set CGO flags + if: matrix.build-mode == 'manual' + run: echo "CGO_CFLAGS=$(php-config --includes)" >> "${GITHUB_ENV}" + - uses: github/codeql-action/init@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + - name: Build + if: matrix.build-mode == 'manual' + run: go build ./... + - name: Build Caddy module + if: matrix.build-mode == 'manual' + working-directory: caddy/ + run: go build ./... + - uses: github/codeql-action/analyze@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0 + with: + category: /language:${{ matrix.language }}