# Copyright (C) The libssh2 project and its contributors. # # SPDX-License-Identifier: BSD-3-Clause name: 'CodeQL' 'on': push: branches: - master - '*/ci' pull_request: branches: - master - '*/ci' schedule: - cron: '0 0 * * 4' concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true permissions: {} cache-mode: none env: DO_NOT_TRACK: '1' HOMEBREW_NO_INSTALL_CLEANUP: '1' jobs: gha: if: ${{ github.repository_owner == 'libssh2' || github.event_name != 'schedule' }} name: 'GHA' runs-on: ubuntu-26.04-arm permissions: security-events: write # To create/update security events steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: 'initialize' uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 with: languages: actions queries: security-extended - name: 'perform analysis' uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 c: if: ${{ github.repository_owner == 'libssh2' || github.event_name != 'schedule' }} name: 'C' runs-on: ${{ matrix.platform == 'Linux' && 'ubuntu-26.04-arm' || 'windows-2022' }} permissions: security-events: write # To create/update security events strategy: fail-fast: false matrix: platform: [Linux, Windows] env: MATRIX_PLATFORM: '${{ matrix.platform }}' steps: - name: 'install prereqs' if: ${{ matrix.platform == 'Linux' }} timeout-minutes: 5 run: | sudo find /etc/apt/sources.list.d -type f -not -name 'ubuntu.sources' -delete -print sudo apt-get -o Dpkg::Use-Pty=0 update sudo apt-get -o Dpkg::Use-Pty=0 install zlib1g-dev libssl-dev libgcrypt-dev libwolfssl-dev /home/linuxbrew/.linuxbrew/bin/brew install mbedtls@3 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: 'initialize' uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 with: languages: cpp build-mode: manual trap-caching: false - name: 'build' timeout-minutes: 5 shell: bash run: | if [ "${MATRIX_PLATFORM}" = 'Windows' ]; then cmake -B . -DCRYPTO_BACKEND=WinCNG -DCMAKE_VS_GLOBALS=TrackFileAccess=false cmake --build . --verbose else eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" export PKG_CONFIG_PATH; PKG_CONFIG_PATH="$(brew --prefix mbedtls@3)/lib/pkgconfig" for crypto in OpenSSL Libgcrypt mbedTLS wolfSSL; do options='' if [ "${crypto}" = 'OpenSSL' ]; then options+=' -DBUILD_OSSFUZZ=ON' fi cmake -B _bld-"${crypto}" -G Ninja -DCRYPTO_BACKEND="${crypto}" -DENABLE_ZLIB_COMPRESSION=ON ${options} cmake --build _bld-"${crypto}" --verbose if [ "${crypto}" = 'OpenSSL' ]; then cmake --build _bld-"${crypto}" --verbose --target libssh2-examples fi done fi - name: 'perform analysis' uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2