name: "CodeQL"

on:
  workflow_dispatch:
  push:
    branches: [ develop ]
    paths:
      - 'CMSIS/Core/**'
      - 'CMSIS/Core_A/**'
      - 'CMSIS/CoreValidation/**'
      - 'Device/ARM/**'
  pull_request:
    branches: [ develop ]
    paths:
      - '.github/workflows/codeql-analysis.yml'
      - 'CMSIS/Core/**'
      - 'CMSIS/Core_A/**'
      - 'CMSIS/CoreValidation/**'
      - 'Device/ARM/**'
jobs:
  analyze:
    name: Analyze
    runs-on: ubuntu-latest
    container: 
      image: ghcr.io/jonatanantoni/cmsis/linux.gnu:latest
    permissions:
      actions: read
      contents: read
      security-events: write

    strategy:
      fail-fast: false
      matrix:
        language: [ 'cpp' ]

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    # Initializes the CodeQL tools for scanning.
    - name: Initialize CodeQL
      uses: github/codeql-action/init@v1
      with:
        languages: ${{ matrix.language }}

    - run: |
       ln -s /root/.rtebuild /github/home/.rtebuild
       cd CMSIS/CoreValidation/Tests
       python3 build.py -c GCC -o low build

    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v1

name: "CodeQL"

on:
  workflow_dispatch:
  push:
    branches: [ develop ]
    paths:
      - 'CMSIS/Core/**'
      - 'CMSIS/Core_A/**'
      - 'CMSIS/CoreValidation/**'
      - 'Device/ARM/**'
  pull_request:
    branches: [ develop ]
    paths:
      - '.github/workflows/codeql-analysis.yml'
      - 'CMSIS/Core/**'
      - 'CMSIS/Core_A/**'
      - 'CMSIS/CoreValidation/**'
      - 'Device/ARM/**'
jobs:
  analyze:
    name: Analyze
    runs-on: ubuntu-latest
    container: 
      image: ghcr.io/jonatanantoni/cmsis/linux.gnu:latest
    permissions:
      actions: read
      contents: read
      security-events: write

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    # Initializes the CodeQL tools for scanning.
    - name: Initialize CodeQL
      uses: github/codeql-action/init@v2
      with:
        languages: cpp
        queries: security-and-quality
  
    - run: |
       ln -s /root/.rtebuild /github/home/.rtebuild
       cd CMSIS/CoreValidation/Tests
       python3 build.py -c GCC -o low build

    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v2

Update CodeQL workflow to use version 2 actions.
GitHub: Update CodeQL workflow to use version 2 actions.

