Skip to content

Commit 073d9e6

Browse files
committed
Fix .github/codeql/codeql-config.yml for corrected workflow
Remove unnecessary Test step Use Ninja to generate `compile_commands.json` instead of a full build Copy compile_commands.json to the correct place Diagnosis for compile_commands.json issues More diagnostics for compile_commands.json issues Revert "Use Ninja to generate `compile_commands.json` instead of a full build" This reverts commit 0cc2448. Further attempts to help codeql Disable CodeQL autobuild Configure CMake to use CodeQL's compiler wrapper Revert to `build_mode: none` Consider C++, Python and GitHub Actions separately More corrections to matrixed workflow Try different inputs Use default path in config Ignore Python test scripts correctly Fix C++ instrumentation Fix parse error fix(ci): Resolve CodeQL PRELOAD error by isolating build environment The CodeQL analysis was failing with an `LD_PRELOAD` error because the build-tracing environment set by the `codeql-action/init` step was being overwritten. The custom `build-cmake` composite action was sourcing the container's `/entrypoint.sh` script, which reset the environment. This change removes the sourcing of the entrypoint script from the `build-cmake` action. The `setup-build-env` action already configures the necessary environment, making this step redundant and disruptive to CodeQL's build tracing. More diagnostics fix(ci): Resolve CodeQL PRELOAD error by preserving environment The CodeQL analysis was failing with an `LD_PRELOAD` error because the build-tracing environment set by the `codeql-action/init` step was being overwritten by a setup script. The `configure-cmake` and `build-cmake` composite actions source the container's `/entrypoint.sh` script, which resets the environment and changes `LD_PRELOAD` to an unexpanded, generic value. This change preserves the `LD_PRELOAD` variable across the sourcing of the entrypoint script in both actions. It saves the value before the script is sourced and restores it immediately after, ensuring that the CodeQL build tracer functions correctly while still allowing the entrypoint script to perform its necessary setup. Simplify CI actions to attempt to prevent LD_PRELOAD mangling Restore erroneously-removed `shell: bash` directives Fix thinko Better fix to check enviroment Restore sourcing to actions Inline configure/build to (hopefully) avoid LD_PRELOAD issues Fix YAML issue One last try for LD_PRELOAD Fix thinko and add diagnostics Remove redundant diagnostics
1 parent 28beaa2 commit 073d9e6

File tree

6 files changed

+29
-49
lines changed

6 files changed

+29
-49
lines changed

.github/actions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This directory contains reusable composite actions for Phlex CI/CD workflows.
66

77
### setup-build-env
88

9-
Sets up the Phlex build environment by sourcing the entrypoint script and creating build directories.
9+
Verifies the container build environment and creates build directories.
1010

1111
**Inputs:**
1212

.github/actions/REFACTORING_SUMMARY.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ Refactored GitHub Actions workflows to use composite actions for better maintain
1010

1111
**Location**: `.github/actions/setup-build-env/action.yaml`
1212

13-
**Purpose**: Sets up the build environment by sourcing the container entrypoint script and creating directories
13+
**Purpose**: Verifies the Spack build environment and creates build directories
1414

1515
**Provides**:
1616

17-
- Sources `/entrypoint.sh`
1817
- Creates build directory
1918
- Outputs source and build directory paths
2019

@@ -41,7 +40,6 @@ Refactored GitHub Actions workflows to use composite actions for better maintain
4140

4241
- Configurable target selection
4342
- Auto-detected or custom parallel jobs
44-
- Sources entrypoint for environment
4543

4644
## Updated Workflows
4745

.github/actions/build-cmake/action.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ runs:
2424
steps:
2525
- shell: bash
2626
run: |
27-
# Source the container entrypoint script
28-
. /entrypoint.sh
29-
3027
cd "$GITHUB_WORKSPACE/$BUILD_PATH"
3128
3229
# Determine parallel jobs

.github/actions/setup-build-env/action.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ runs:
2525
- id: setup
2626
shell: bash
2727
run: |
28-
# Source the container entrypoint script
29-
. /entrypoint.sh
30-
3128
# Create and export build directory
3229
mkdir -p "$GITHUB_WORKSPACE/$BUILD_PATH"
3330

.github/codeql/codeql-config.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ queries:
55
- uses: security-extended
66
- uses: code-quality
77

8-
paths:
9-
- phlex-src/**
108
paths-ignore:
11-
- phlex-src/build/**
12-
- phlex-src/doc/**
13-
- phlex-src/test/**
9+
- "*-build/**"
10+
- build/**
11+
- doc/**
12+
- test/**

.github/workflows/codeql-analysis.yaml

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@ permissions:
1717

1818
env:
1919
BUILD_TYPE: RelWithDebInfo
20+
CPP_COMPILER: g++
2021

2122
jobs:
2223
codeql:
23-
name: Analyze with CodeQL
24+
name: Analyze ${{ matrix.language }} with CodeQL
2425
runs-on: ubuntu-24.04
2526
container:
2627
image: ghcr.io/framework-r-d/phlex-ci:latest
2728
strategy:
2829
fail-fast: false
2930
matrix: # Necessry to disable yaml-language-server warning
30-
single-run: [ true ]
31+
language: ['cpp', 'python', 'actions']
3132
timeout-minutes: 120
3233
steps:
3334
- name: Checkout repository
@@ -38,49 +39,37 @@ jobs:
3839

3940
- name: Setup build environment
4041
uses: ./phlex-src/.github/actions/setup-build-env
42+
with:
43+
build-path: phlex-build
4144

4245
- name: Initialize CodeQL
4346
uses: github/codeql-action/init@v4
4447
with:
45-
languages: cpp, python, actions
48+
languages: ${{ matrix.language }}
4649
config-file: phlex-src/.github/codeql/codeql-config.yml
4750
source-root: phlex-src
48-
build-mode: none
49-
50-
- name: Configure CMake
51-
uses: ./phlex-src/.github/actions/configure-cmake
52-
with:
53-
build-type: ${{ env.BUILD_TYPE }}
51+
build-mode: ${{ matrix.language == 'cpp' && 'manual' || 'none' }}
5452

55-
- name: Build
56-
uses: ./phlex-src/.github/actions/build-cmake
57-
58-
- name: Test
53+
- name: Configure and build (C++ only)
54+
if: matrix.language == 'cpp'
5955
run: |
6056
. /entrypoint.sh
61-
cd $GITHUB_WORKSPACE/phlex-build
62-
ctest -j $(nproc) || true
63-
64-
- name: Verify compile_commands.json and publish for diagnostics
65-
run: |
66-
set -euo pipefail
67-
echo "Looking for compile_commands.json in common build locations..."
68-
# Prefer phlex-src/build/compile_commands.json
69-
if [ -f "$GITHUB_WORKSPACE/phlex-src/build/compile_commands.json" ]; then
70-
echo "Found phlex-src/build/compile_commands.json"
71-
cp "$GITHUB_WORKSPACE/phlex-src/build/compile_commands.json" "$GITHUB_WORKSPACE/compile_commands.json"
72-
elif [ -f "$GITHUB_WORKSPACE/phlex-build/compile_commands.json" ]; then
73-
echo "Found phlex-build/compile_commands.json"
74-
cp "$GITHUB_WORKSPACE/phlex-build/compile_commands.json" "$GITHUB_WORKSPACE/compile_commands.json"
75-
else
76-
echo "No compile_commands.json found in phlex-src/build or phlex-build; continuing."
77-
fi
78-
echo "Workspace listing (for debugging):"
79-
ls -la "$GITHUB_WORKSPACE" || true
57+
cd "$GITHUB_WORKSPACE/phlex-build"
58+
# For reasons unknown, CodeQL's choice of LD_PRELOAD needs to
59+
# be corrected
60+
export LD_PRELOAD="$SEMMLE_PRELOAD_libtrace64"
61+
echo "LD_PRELOAD=$LD_PRELOAD"
62+
cmake --preset=default -S "$GITHUB_WORKSPACE/phlex-src" \
63+
-B "$GITHUB_WORKSPACE/phlex-build" -GNinja \
64+
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
65+
-DCMAKE_CXX_COMPILER="$CPP_COMPILER" \
66+
-DPHLEX_USE_FORM=TRUE \
67+
-DFORM_USE_ROOT_STORAGE=TRUE || exit
68+
cmake --build . || exit
8069
8170
# Run CodeQL analysis (uploads results to code scanning)
8271
- name: Perform CodeQL Analysis
8372
uses: github/codeql-action/analyze@v4
8473
with:
85-
category: "CodeQL"
86-
output: codeql-results.sarif
74+
checkout_path: phlex-src
75+
category: ${{ matrix.language }}

0 commit comments

Comments
 (0)