Reorganize directory structure and other clean-ups #381
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
name: Analyzers | |
on: | |
push: | |
paths: | |
- '.github/workflows/analyzers.yml' | |
- 'CMakeLists.txt' | |
- 'src/**' | |
- 'test/**' | |
- 'modules/**' | |
- '3rdparty/**' | |
- '**.imp' | |
pull_request: | |
paths: | |
- '.github/workflows/analyzers.yml' | |
- 'CMakeLists.txt' | |
- 'src/**' | |
- 'test/**' | |
- 'modules/**' | |
- '3rdparty/**' | |
- '**.imp' | |
release: | |
types: published | |
jobs: | |
analyze-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
tool: [clang-analyzer, iwyu, CodeQL] | |
config: [Release, Debug] | |
permissions: | |
# required for all codeql to report detected outcomes | |
security-events: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
submodules: recursive | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt install -y libglfw3-dev libopenal-dev libglvnd-core-dev iwyu clang clang-tidy clang-tools ninja-build | |
# TODO: Really, this should only be fetching the build dependencies, so we can only use the in-tree version | |
sudo apt install -y libsdl2-dev | |
- name: Configure | |
run: | | |
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=${{ matrix.config }} | |
# Compile deps before initializing codeql, to avoid unnecessary analysis. | |
- name: Compile Dependencies | |
if: ${{ matrix.tool == 'CodeQL' }} | |
run: | | |
cmake --build build --parallel --config ${{ matrix.config }} --target compile-osp-magnum-deps compile-test-deps | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
if: ${{ matrix.tool == 'CodeQL' }} | |
with: | |
languages: cpp | |
- name: Reconfigure for CodeQL | |
if: ${{ matrix.tool == 'CodeQL' }} | |
run: | | |
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=${{ matrix.config }} | |
- name: Compile for CodeQL | |
if: ${{ matrix.tool == 'CodeQL' }} | |
run: | | |
cmake --build build --parallel --target osp-magnum compile-tests | |
# Unlike clang-analyzer and include-what-you-use, CodeQL can't operate on just the config step. Need to actually build everything. | |
- name: Perform CodeQL Analysis | |
if: ${{ matrix.tool == 'CodeQL' }} | |
uses: github/codeql-action/analyze@v2 | |
# Implicitly requires build/compile_commands.json to exist | |
- name: Run Clang Analyzer | |
if: ${{ matrix.tool == 'clang-analyzer' }} | |
run: | | |
wget https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-11.0.1/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py | |
chmod +x run-clang-tidy.py | |
./run-clang-tidy.py -j $(nproc) -p build | |
# Implicitly requires build/compile_commands.json to exist | |
- name: Run IWYU | |
if: ${{ matrix.tool == 'iwyu' }} | |
run: | | |
wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/clang_11/iwyu_tool.py | |
chmod +x iwyu_tool.py | |
./iwyu_tool.py -j $(nproc) -p build -- -Xiwyu --mapping_file=${GITHUB_WORKSPACE}/iwyu-ubuntu.imp | |
analyze-windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
tool: [msvc-code-analysis] | |
config: [Release, Debug] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
submodules: recursive | |
- name: Configure (MSVC) | |
run: | | |
cmake -B build -DCMAKE_CONFIGURATION_TYPES=${{ matrix.config }} | |
- name: Initialize MSVC Code Analysis | |
uses: microsoft/[email protected] | |
# Provide a unique ID to access the sarif output path | |
id: run-analysis | |
with: | |
cmakeBuildDirectory: build | |
buildConfiguration: ${{ matrix.config }} | |
# Ruleset file that will determine what checks will be run | |
ruleset: NativeRecommendedRules.ruleset | |
ignoredPaths: 3rdparty | |
ignoredIncludePaths: 3rdparty | |
# Upload SARIF file to GitHub Code Scanning Alerts | |
- name: Upload SARIF to GitHub | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: ${{ steps.run-analysis.outputs.sarif }} |