Files
lammps/.github/workflows/codeql-analysis.yml
2021-02-01 20:31:36 -05:00

51 lines
1.5 KiB
YAML

# GitHub action to run static code analysis on C++ and Python code
name: "CodeQL Code Analysis"
on:
push:
branches: [master]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['cpp', 'python']
steps:
- name: Checkout repository
if: ${{ github.repository == 'lammps/lammps' }}
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.repository == 'lammps/lammps' && github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
if: ${{ github.repository == 'lammps/lammps' }}
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Building LAMMPS via CMake
if: ${{ github.repository == 'lammps/lammps' }}
run: |
mkdir build
cd build
cmake -C ../cmake/presets/most.cmake ../cmake -DBUILD_SHARED_LIBS=on
make
- name: Perform CodeQL Analysis
if: ${{ github.repository == 'lammps/lammps' }}
uses: github/codeql-action/analyze@v1