github.com/kubeshop/testkube@v1.17.23/.github/workflows/codeql-analysis.yml (about)

     1  # For most projects, this workflow file will not need changing; you simply need
     2  # to commit it to your repository.
     3  #
     4  # You may wish to alter this file to override the set of languages analyzed,
     5  # or to provide custom queries or build logic.
     6  #
     7  # ******** NOTE ********
     8  # We have attempted to detect the languages in your repository. Please check
     9  # the `language` matrix defined below to confirm you have the correct set of
    10  # supported CodeQL languages.
    11  #
    12  name: "CodeQL"
    13  
    14  on:
    15    push:
    16      branches: [ main, develop ]
    17      paths:
    18        - 'cmd/**'
    19        - 'pkg/**'
    20        - 'internal/**'
    21        - 'contrib/**'
    22    pull_request:
    23      # The branches below must be a subset of the branches above
    24      branches: [ main, develop ]
    25      paths:
    26        - 'cmd/**'
    27        - 'pkg/**'
    28        - 'internal/**'
    29        - 'contrib/**'      
    30    schedule:
    31      - cron: '00 12 * * 1-5'
    32  
    33  jobs:
    34    analyze:
    35      name: Analyze
    36      runs-on: ubuntu-latest
    37      permissions:
    38        actions: read
    39        contents: read
    40        security-events: write
    41  
    42      strategy:
    43        fail-fast: false
    44        matrix:
    45          language: [ 'go' ]
    46          # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
    47          # Learn more about CodeQL language support at https://git.io/codeql-language-support
    48  
    49      steps:
    50      - name: Checkout repository
    51        uses: actions/checkout@v3
    52  
    53      # Initializes the CodeQL tools for scanning.
    54      - name: Initialize CodeQL
    55        uses: github/codeql-action/init@v2
    56        with:
    57          languages: ${{ matrix.language }}
    58          # If you wish to specify custom queries, you can do so here or in a config file.
    59          # By default, queries listed here will override any specified in a config file.
    60          # Prefix the list here with "+" to use these queries and those in the config file.
    61          # queries: ./path/to/local/query, your-org/your-repo/queries@main
    62  
    63      - name: Install Go
    64        uses: actions/setup-go@v3
    65        with:
    66          go-version: 1.21
    67  
    68      - name: Get Go environment
    69        id: go-env
    70        run: |
    71          echo "::set-output name=cache::$(go env GOCACHE)"
    72          echo "::set-output name=modcache::$(go env GOMODCACHE)"
    73  
    74      - name: Set up cache
    75        uses: actions/cache@v3
    76        with:
    77          path: |
    78            ${{ steps.go-env.outputs.cache }}
    79            ${{ steps.go-env.outputs.modcache }}
    80          key: test-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    81          restore-keys: |
    82            test-${{ runner.os }}-go-
    83  
    84      - name: Perform CodeQL Analysis
    85        uses: github/codeql-action/analyze@v2