Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: "CodeQL"

on:
push:
branches: [ 'develop', 'main', 'vnext' ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ 'develop' ]
schedule:
- cron: '43 8 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'csharp' && 'windows-latest') || 'ubuntu-latest' }}

permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp', 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive

- if: matrix.language == 'csharp'
name: Setup vcpkg
working-directory: ../
run: |
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.bat

- if: matrix.language == 'csharp'
name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1

- if: matrix.language == 'csharp'
uses: nuget/setup-nuget@v1
with:
nuget-version: latest

- if: matrix.language == 'csharp'
name: Nuget restore
run: nuget restore Telegram.sln

- if: matrix.language == 'csharp'
name: Build vcpkg
working-directory: ../vcpkg
run: |
./vcpkg.exe install ffmpeg[opus,vpx]:x64-uwp lz4:x64-uwp openssl:x64-uwp zlib:x64-uwp libwebp:x64-uwp libogg:x64-uwp opus:x64-uwp
./vcpkg.exe integrate install

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- if: matrix.language == 'csharp'
name: Build C#
env:
CONFIG: RELEASE
ARCH: x64
MODE: SideloadOnly
CERTIFICATE: PackageCertificateThumbprint=60FFAEE648D4D34A1089405643B511F50BEF8A49
run: |
.\UpdateManifest.ps1 -path "Telegram.Msix\\" -config "$CONFIG" -mode "$MODE"
msbuild Telegram.sln /target:Telegram_Msix /p:Configuration=Release /p:Platform="$ARCH" /p:UapAppxPackageBuildMode=$MODE /p:AppxBundlePlatforms="$ARCH" /p:AppxBundle=Always /p:AppxPackageSigningEnabled=True /p:$certificate

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- if: matrix.language != 'csharp'
name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"