name: "CodeQL"

on:
  workflow_dispatch:
  push:
    branches: [ develop ]
  pull_request:
    # The branches below must be a subset of the branches above
    branches: [ develop ]

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
