🚀 gha: Bump actions/checkout from 3 to 4 #545
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# For most projects, this workflow file will not need changing; you simply need | |
# to commit it to your repository. | |
# | |
# You may wish to alter this file to override the set of languages analyzed, | |
# or to provide custom queries or build logic. | |
# | |
# ******** NOTE ******** | |
# We have attempted to detect the languages in your repository. Please check | |
# the `language` matrix defined below to confirm you have the correct set of | |
# supported CodeQL languages. | |
# | |
name: "CodeQL" | |
on: | |
push: | |
branches: [main, develop] | |
paths: | |
- "**.cpp" | |
- "**.h" | |
- "**.hpp" | |
- "**.py" | |
- cmake/** | |
- src/** | |
- CMakeLists.txt | |
- conanfile.py | |
- ".github/workflows/codeql-analysis.yml" | |
pull_request: | |
# The branches below must be a subset of the branches above | |
types: [opened, synchronize, reopened] | |
paths: | |
- "**.cpp" | |
- "**.h" | |
- "**.hpp" | |
- "**.py" | |
- cmake/** | |
- src/** | |
- CMakeLists.txt | |
- conanfile.py | |
- ".github/workflows/codeql-analysis.yml" | |
schedule: | |
- cron: "38 0 * * 5" | |
env: | |
# Conan cache environment variables | |
CONAN_SYSREQUIRES_MODE: enabled | |
CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" | |
CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" | |
CLANG_TIDY_VERSION: "13.0.0" | |
jobs: | |
analyze: | |
name: "CodeQL Analyze" | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
security-events: write | |
strategy: | |
fail-fast: false | |
matrix: | |
language: ["cpp", "python"] | |
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] | |
# Learn more about CodeQL language support at https://git.io/codeql-language-support | |
generator: | |
- "Ninja" | |
build_type: | |
- Debug | |
qt_version: | |
- "6.4.1" | |
qt_target: | |
- "desktop" | |
steps: | |
- name: "Cancel Previous Runs" | |
uses: styfle/cancel-workflow-action@0.11.0 | |
with: | |
access_token: ${{ github.token }} | |
- name: "🧰 Checkout" | |
uses: actions/checkout@v4 | |
with: | |
# Full git history is needed to get a proper list of changed files within `super-linter` | |
fetch-depth: 0 | |
# 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. | |
# queries: ./path/to/local/query, your-org/your-repo/queries@main | |
- name: "⚙️ Install Python" | |
id: python | |
uses: actions/setup-python@v4 | |
with: | |
# Read python version from a file .python-version | |
# python-version-file: ".python-version" | |
check-latest: true | |
cache: pip | |
- name: "⚙️ Install Python dependencies" | |
if: matrix.language == 'cpp' | |
shell: bash | |
id: python-deps | |
run: | | |
python -m pip install --upgrade pip | |
pip3 install "conan<2" | |
- name: "🐧 ⚙️ Install Linux dependencies" | |
if: matrix.language == 'cpp' | |
run: | | |
sudo apt install -y libclang-dev ninja-build gcovr ccache | |
echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV | |
echo "CXX=g++-11" >> $GITHUB_ENV | |
echo "CC=gcc-11" >> $GITHUB_ENV | |
- name: Configure Conan | |
if: matrix.language == 'cpp' | |
shell: bash | |
run: | | |
echo "Setup conan" | |
conan user | |
conan config init | |
conan profile show default | |
- name: restore ccache | |
if: matrix.language == 'cpp' | |
uses: pat-s/always-upload-cache@v3.0.11 | |
with: | |
path: ${{runner.workspace}}/ccache | |
key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} | |
restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} | |
- name: check ccache stats prior to build | |
if: matrix.language == 'cpp' | |
run: ccache --zero-stats --show-stats | |
- name: "Add GCC problem matcher" | |
if: matrix.language == 'cpp' | |
uses: ammaraskar/gcc-problem-matcher@master | |
- name: "🔧 Setup Cache" | |
uses: ./.github/actions/setup_cache | |
with: | |
build_type: ${{ matrix.build_type }} | |
generator: ${{ matrix.generator }} | |
- name: "⚙️ Install Qt Version ${{ matrix.qt_version }}" | |
if: matrix.language == 'cpp' | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ matrix.qt_version }} | |
# host: ${{ runner.os }} | |
target: ${{ matrix.qt_target }} | |
# arch: ${{ matrix.qt_arch }} | |
install-deps: "true" | |
# modules: 'qtcharts qtwebengine' | |
cached: ${{ steps.cache-qt.outputs.cache-hit }} | |
setup-python: "true" | |
# tools: "tools_ifw" | |
set-env: "true" | |
- name: "Create Build Environment" | |
if: matrix.language == 'cpp' | |
# Some projects don't allow in-source building, so create a separate build directory | |
# We'll use this as our working directory for all subsequent commands | |
run: cmake -E make_directory build | |
# make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage | |
# has meaningful results | |
- name: "⚙️ 🐧 Configure CMake" | |
if: matrix.language == 'cpp' | |
working-directory: build | |
shell: bash | |
run: | | |
cmake -S .. -B . -G "${{matrix.generator}}" \ | |
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ | |
-DCMAKE_INSTALL_PREFIX:PATH="./usr" \ | |
-DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} \ | |
-DOPTION_BUILD_TESTS:BOOL="TRUE" | |
- name: "📦 Build" | |
if: matrix.language == 'cpp' | |
# Execute the build. You can specify a specific target with "--target <NAME>" | |
run: | | |
cmake --build ./build --config ${{matrix.build_type}} | |
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). | |
# If this step fails, then you should remove it and run the build manually (see below) | |
- name: "📦 Autobuild" | |
if: matrix.language != 'cpp' | |
uses: github/codeql-action/autobuild@v2 | |
- name: "Perform CodeQL Analysis" | |
uses: github/codeql-action/analyze@v2 |