Browse Source

REVIEWED: `CodeQL` workflow, cleaning and organization

Ray 1 year ago
parent
commit
a810976aa6
1 changed files with 27 additions and 26 deletions
  1. 27 26
      .github/workflows/codeql.yml

+ 27 - 26
.github/workflows/codeql.yml

@@ -3,12 +3,6 @@
 #
 #
 # You may wish to alter this file to override the set of languages analyzed,
 # You may wish to alter this file to override the set of languages analyzed,
 # or to provide custom queries or build logic.
 # 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"
 name: "CodeQL"
 
 
 on:
 on:
@@ -18,6 +12,9 @@ on:
   - cron: '0 0 * * 1'
   - cron: '0 0 * * 1'
   pull_request:
   pull_request:
     branches: '*'
     branches: '*'
+env:
+  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
+  BUILD_TYPE: Release
 
 
 jobs:
 jobs:
   analyze:
   analyze:
@@ -49,6 +46,27 @@ jobs:
       with:
       with:
         submodules: recursive
         submodules: recursive
 
 
+   - name: Create Build Environment
+      # 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 ${{github.workspace}}/build
+
+    - name: Setup Environment
+      run: |
+        sudo apt-get update -qq
+        sudo apt-get install gcc-multilib
+        sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev
+
+    - name: Configure CMake
+      # Use a bash shell so we can use the same syntax for environment variable
+      # access regardless of the host operating system
+      shell: bash
+      working-directory: ${{github.workspace}}/build
+      # Note the current convention is to use the -S and -B options here to specify source
+      # and build directories, but this is only available with CMake 3.13 and higher.
+      # The CMake binaries on the Github Actions machines are (as of this writing) 3.12
+      run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLATFORM=Desktop
+
     # Initializes the CodeQL tools for scanning.
     # Initializes the CodeQL tools for scanning.
     - name: Initialize CodeQL
     - name: Initialize CodeQL
       uses: github/codeql-action/init@v2
       uses: github/codeql-action/init@v2
@@ -62,26 +80,9 @@ jobs:
         # queries: security-extended,security-and-quality
         # queries: security-extended,security-and-quality
         queries: security-and-quality
         queries: security-and-quality
 
 
-
-    # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
-    # If this step fails, then you should remove it and run the build manually (see below)
-    #- name: Autobuild
-    #  uses: github/codeql-action/autobuild@v2
-
-    # ℹ️ Command-line programs to run using the OS shell.
-    # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
-
-    #   If the Autobuild fails above, remove it and uncomment the following three lines.
-    #   modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
-
-    - run: |
-        cmake -E make_directory build
-
-        sudo apt-get update -qq
-        sudo apt-get install -y gcc-multilib
-        sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev
-
-        BUILD_TYPE=Release
+    - name: Build
+      # Execute the build.  You can specify a specific target with "--target <NAME>"
+      run: |
         cd build
         cd build
         cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLATFORM=Desktop
         cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPLATFORM=Desktop
         cmake --build . --config $BUILD_TYPE
         cmake --build . --config $BUILD_TYPE