Skip to content

Commit 17685f3

Browse files
committed
Add e2e test
1 parent 87ef6f5 commit 17685f3

3 files changed

Lines changed: 208 additions & 1 deletion

File tree

‎.github/workflows/__unsupported-macos.yml‎

Lines changed: 134 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Unsupported macOS"
2+
description: "Tests that unsupported macOS versions are detected and result in appropriate diagnostics."
3+
versions:
4+
- linked
5+
- nightly-latest
6+
installNode: true
7+
8+
operatingSystems:
9+
- os: macos
10+
runner-image: xcode-27
11+
12+
env:
13+
# Allow the failed SARIF file to be generated.
14+
CODEQL_ACTION_SKIP_GENERATE_FAILED_SARIF: false
15+
# But don't actually upload it.
16+
CODEQL_ACTION_SKIP_SARIF_UPLOAD: true
17+
# Mark telemetry for this workflow so it can be treated separately.
18+
CODEQL_ACTION_TESTING_ENVIRONMENT: codeql-action-pr-checks
19+
20+
steps:
21+
- name: Check xcode_select_link
22+
run: |
23+
readlink /private/var/db/xcode_select_link
24+
file -h /private/var/db/xcode_select_link
25+
26+
- uses: ./../action/init
27+
id: init
28+
continue-on-error: true
29+
env:
30+
CODEQL_ACTION_SKIP_UNSUPPORTED_TRACED_ANALYSIS: true
31+
with:
32+
languages: swift
33+
tools: ${{ steps.prepare-test.outputs.tools-url }}
34+
35+
- name: Analyze
36+
# We could run `analyze` here from `./../analyze`, but `getAnalyzeActionName` in `workflow.ts`
37+
# can't cope with that unless we introduce a different testing environment. Since this step
38+
# would just fail on `xcode-27` anyway, we just skip it instead.
39+
if: false
40+
uses: ./analyze
41+
with:
42+
category: "/test-codeql-version:${{ matrix.version }}"
43+
44+
validationJobs:
45+
unsupported-macos-sarif-checks:
46+
checkout: true
47+
installNode: true
48+
steps:
49+
- name: Download workflow artifact
50+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
51+
with:
52+
pattern: test-mode-sarif-*
53+
path: sarif
54+
55+
- name: List artifact contents
56+
run: ls -laR ./sarif
57+
58+
- name: Check diagnostics appear in SARIF
59+
env:
60+
SARIF_PATH: "./sarif/"
61+
DIAGNOSTIC_ID: "codeql-action/unsupported-traced-analysis-macos"
62+
DIAGNOSTIC_NAME: "Traced analysis is not supported on this version of macOS"
63+
EXPECTED_LOCATIONS: "0"
64+
EXPECTED_MESSAGE: |
65+
Traced analysis is not supported on macOS 27 or above.
66+
run: npx tsx ./pr-checks/check-diagnostics.ts

‎pr-checks/sync.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ interface JobSpecification {
124124

125125
type ValidationJobSpecification = JobSpecification & {
126126
checkout?: boolean;
127+
/** Optional condition for the validation job. */
128+
if?: string;
127129
};
128130

129131
/** Describes language/framework-specific steps and inputs. */
@@ -666,9 +668,14 @@ function generateValidationJob(
666668
// Add the generated steps in front of the ones from the specification.
667669
specSteps.items.unshift(...checkoutStep, ...steps);
668670

671+
const baseCondition = "github.triggering_actor != 'dependabot[bot]'";
672+
669673
const validationJob: Record<string, any> = {
670674
name: jobSpecification.name,
671-
if: "github.triggering_actor != 'dependabot[bot]'",
675+
if:
676+
jobSpecification.if !== undefined
677+
? `${baseCondition} && ${jobSpecification.if}`
678+
: baseCondition,
672679
needs: [checkName],
673680
permissions: {
674681
contents: "read",

0 commit comments

Comments
 (0)