|
| 1 | +# Copyright 2025 Chainguard, Inc. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: "CodeQL Advanced" |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + push: |
| 9 | + # branches: ["main"] |
| 10 | + schedule: |
| 11 | + - cron: "35 23 * * 0" |
| 12 | + |
| 13 | +env: |
| 14 | + CODEQL_EXTRACTOR_GO_BUILD_TRACING: "on" |
| 15 | + |
| 16 | +permissions: {} |
| 17 | + |
| 18 | +jobs: |
| 19 | + analyze: |
| 20 | + runs-on: mal-ubuntu-latest-8-core |
| 21 | + permissions: |
| 22 | + actions: read |
| 23 | + contents: read |
| 24 | + packages: read |
| 25 | + security-events: write |
| 26 | + steps: |
| 27 | + - uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 |
| 28 | + with: |
| 29 | + egress-policy: audit |
| 30 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 31 | + - name: Checkout virusTotal/yara-x |
| 32 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 33 | + with: |
| 34 | + fetch-depth: 0 |
| 35 | + fetch-tags: true |
| 36 | + repository: virusTotal/yara-x |
| 37 | + path: yara-x |
| 38 | + ref: refs/tags/v0.14.0 |
| 39 | + - name: Install Rust for yara-x-capi |
| 40 | + uses: dtolnay/rust-toolchain@888c2e1ea69ab0d4330cbf0af1ecc7b68f368cc1 |
| 41 | + with: |
| 42 | + toolchain: stable |
| 43 | + - name: Install cargo-c and yara-x-capi |
| 44 | + run: | |
| 45 | + cd ${{ github.workspace }}/yara-x |
| 46 | + cargo install cargo-c --locked |
| 47 | + sudo -E env "PATH=$PATH" cargo cinstall -p yara-x-capi --features=native-code-serialization --release |
| 48 | + sudo ldconfig -v |
| 49 | + cd ${{ github.workspace }} |
| 50 | + sudo rm -rf ${{ github.workspace }}/yara-x |
| 51 | + - name: Set up Go |
| 52 | + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 |
| 53 | + with: |
| 54 | + go-version-file: "go.mod" |
| 55 | + check-latest: true |
| 56 | + cache: false |
| 57 | + - name: Initialize CodeQL |
| 58 | + uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15 |
| 59 | + with: |
| 60 | + languages: go |
| 61 | + build-mode: manual |
| 62 | + - run: | |
| 63 | + go build -o /dev/null ./... |
| 64 | + go test -o /dev/null -c ./... |
| 65 | + - name: Perform CodeQL Analysis |
| 66 | + uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15 |
| 67 | + with: |
| 68 | + category: "/language:go" |
| 69 | + analyze-actions: |
| 70 | + runs-on: ubuntu-latest |
| 71 | + permissions: |
| 72 | + actions: read |
| 73 | + contents: read |
| 74 | + packages: read |
| 75 | + security-events: write |
| 76 | + steps: |
| 77 | + - uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1 |
| 78 | + with: |
| 79 | + egress-policy: audit |
| 80 | + - name: Checkout repository |
| 81 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 82 | + - name: Initialize CodeQL |
| 83 | + uses: github/codeql-action/init@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15 |
| 84 | + with: |
| 85 | + languages: actions |
| 86 | + build-mode: none |
| 87 | + - name: Perform CodeQL Analysis |
| 88 | + uses: github/codeql-action/analyze@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15 |
| 89 | + with: |
| 90 | + category: "/language:actions" |
0 commit comments