Skip to content

Commit bbc2e70

Browse files
authored
Merge pull request #1149 from github/criemen/runner-autobuilders
autobuild: Update tests for C# on macOS
2 parents 8171514 + caa2a0d commit bbc2e70

File tree

6 files changed

+132
-2
lines changed

6 files changed

+132
-2
lines changed

.github/workflows/__autobuild-action.yml

+72
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/pr-checks.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,10 @@ jobs:
414414
- name: Build code
415415
shell: bash
416416
run: |
417-
../action/runner/dist/codeql-runner-macos autobuild
417+
. codeql-runner/codeql-env.sh
418+
CODEQL_RUNNER="$(cat codeql-runner/codeql-env.json | jq -r '.CODEQL_RUNNER')"
419+
echo "$CODEQL_RUNNER"
420+
$CODEQL_RUNNER ../action/runner/dist/codeql-runner-macos autobuild
418421
419422
- name: Run analyze
420423
run: |

lib/codeql.js

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/autobuild-action.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "autobuild-action"
2+
description: "Tests that the C# autobuild action works"
3+
versions: ["latest"]
4+
steps:
5+
- uses: ./../action/init
6+
with:
7+
languages: csharp
8+
tools: ${{ steps.prepare-test.outputs.tools-url }}
9+
- uses: ./../action/autobuild
10+
env:
11+
# Explicitly disable the CLR tracer.
12+
COR_ENABLE_PROFILING: ""
13+
COR_PROFILER: ""
14+
COR_PROFILER_PATH_64: ""
15+
CORECLR_ENABLE_PROFILING: ""
16+
CORECLR_PROFILER: ""
17+
CORECLR_PROFILER_PATH_64: ""
18+
- uses: ./../action/analyze
19+
env:
20+
TEST_MODE: true
21+
- name: Check database
22+
shell: bash
23+
run: |
24+
cd "$RUNNER_TEMP/codeql_databases"
25+
if [[ ! -d csharp ]]; then
26+
echo "Did not find a C# database"
27+
exit 1
28+
fi

src/codeql.ts

+14
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,20 @@ async function getCodeQLForCmd(
780780
"-Dmaven.wagon.http.pool=false",
781781
].join(" ");
782782

783+
// On macOS, System Integrity Protection (SIP) typically interferes with
784+
// CodeQL build tracing of protected binaries.
785+
// The usual workaround is to prefix `$CODEQL_RUNNER` to build commands:
786+
// `$CODEQL_RUNNER` (not to be confused with the deprecated CodeQL Runner tool)
787+
// points to a simple wrapper binary included with the CLI, and the extra layer of
788+
// process indirection helps the tracer bypass SIP.
789+
790+
// The above SIP workaround is *not* needed here.
791+
// At the `autobuild` step in the Actions workflow, we assume the `init` step
792+
// has successfully run, and will have exported `DYLD_INSERT_LIBRARIES`
793+
// into the environment of subsequent steps, to activate the tracer.
794+
// When `DYLD_INSERT_LIBRARIES` is set in the environment for a step,
795+
// the Actions runtime introduces its own workaround for SIP
796+
// (https://github.com/actions/runner/pull/416).
783797
await runTool(autobuildCmd);
784798
},
785799
async extractScannedLanguage(

0 commit comments

Comments
 (0)