Skip to content

Commit 4cccb3a

Browse files
authored
Merge pull request #4072 from github/redsun82-linux-arm64-support
Add support for Linux Arm64 runners
2 parents 276e2ce + 0250090 commit 4cccb3a

9 files changed

Lines changed: 175 additions & 18 deletions

File tree

.github/workflows/__linux-arm64.yml

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ See the [releases page](https://github.com/github/codeql-action/releases) for th
44

55
## [UNRELEASED]
66

7-
No user facing changes.
7+
- The CodeQL Action now supports CodeQL releases that are compatible with Linux Arm64 and download the native `linux-arm64` CodeQL bundle when available. [#4072](https://github.com/github/codeql-action/pull/4072)
88

99
## 4.37.9 - 26 Aug 2026
1010

lib/entry-points.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/linux-arm64.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Linux Arm64"
2+
description: "An end-to-end integration test running on a Linux Arm64 runner, checking that the native linux-arm64 CodeQL bundle is downloaded and can analyze interpreted and compiled code"
3+
operatingSystems:
4+
- os: ubuntu
5+
runner-image: ubuntu-24.04-arm
6+
# The native linux-arm64 CodeQL bundle is only available in recent CLI releases, so we restrict this
7+
# check to `nightly-latest`, which is guaranteed to ship it. Older stable versions do not have an
8+
# arm64 asset, and `prepare-test` would resolve an x64 bundle URL for them on this runner.
9+
versions:
10+
- nightly-latest
11+
installGo: true
12+
steps:
13+
- uses: ./../action/init
14+
with:
15+
languages: javascript,python,go
16+
tools: ${{ steps.prepare-test.outputs.tools-url }}
17+
- name: Build Go code
18+
run: go build main.go
19+
- uses: ./../action/analyze
20+
with:
21+
upload-database: false
22+
- name: Assert databases exist
23+
run: |
24+
cd "$RUNNER_TEMP/codeql_databases"
25+
for lang in javascript python go; do
26+
if [[ ! -d "$lang" ]]; then
27+
echo "Did not find a database for $lang"
28+
exit 1
29+
fi
30+
done

src/cli-errors.test.ts

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ test("CliError constructor with empty stderr", (t) => {
128128

129129
for (const [platform, arch] of [
130130
["weird_plat", "x64"],
131-
["linux", "arm64"],
132131
["win32", "arm64"],
133132
]) {
134133
test.serial(
@@ -157,20 +156,34 @@ for (const [platform, arch] of [
157156
);
158157
}
159158

160-
test("wrapCliConfigurationError - supported platform", (t) => {
161-
const commandError = new CommandInvocationError(
162-
"codeql",
163-
["version"],
164-
1,
165-
"Some error",
166-
);
167-
const cliError = new CliError(commandError);
159+
for (const [platform, arch] of [
160+
["linux", "x64"],
161+
["linux", "arm64"],
162+
["win32", "x64"],
163+
["darwin", "x64"],
164+
["darwin", "arm64"],
165+
]) {
166+
test.serial(
167+
`wrapCliConfigurationError - ${platform}/${arch} supported`,
168+
(t) => {
169+
sinon.stub(process, "platform").value(platform);
170+
sinon.stub(process, "arch").value(arch);
171+
const commandError = new CommandInvocationError(
172+
"codeql",
173+
["version"],
174+
1,
175+
"Some error",
176+
);
177+
const cliError = new CliError(commandError);
168178

169-
const wrappedError = wrapCliConfigurationError(cliError);
179+
const wrappedError = wrapCliConfigurationError(cliError);
170180

171-
// Should return the original error since platform is supported
172-
t.is(wrappedError, cliError);
173-
});
181+
// Should return the original error since the platform is supported, rather
182+
// than replacing it with the unsupported-platform ConfigurationError.
183+
t.is(wrappedError, cliError);
184+
},
185+
);
186+
}
174187

175188
test("wrapCliConfigurationError - autobuild error", (t) => {
176189
const commandError = new CommandInvocationError(

src/cli-errors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { ConfigurationError } from "./util";
88

99
const SUPPORTED_PLATFORMS = [
1010
["linux", "x64"],
11+
["linux", "arm64"],
1112
["win32", "x64"],
1213
["darwin", "x64"],
1314
["darwin", "arm64"],

src/setup-codeql.test.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,24 +120,42 @@ test.serial(
120120
const LINKED_BUNDLE_TEST_CASES = [
121121
{
122122
platform: "linux",
123+
arch: "x64",
123124
tarSupportsZstd: true,
124125
expectedBundleName: "codeql-bundle-linux64.tar.zst",
125126
expectedCompressionMethod: "zstd",
126127
},
128+
{
129+
platform: "linux",
130+
arch: "arm64",
131+
tarSupportsZstd: true,
132+
expectedBundleName: "codeql-bundle-linux-arm64.tar.zst",
133+
expectedCompressionMethod: "zstd",
134+
},
135+
{
136+
platform: "darwin",
137+
arch: "arm64",
138+
tarSupportsZstd: true,
139+
expectedBundleName: "codeql-bundle-osx64.tar.zst",
140+
expectedCompressionMethod: "zstd",
141+
},
127142
{
128143
platform: "darwin",
144+
arch: "x64",
129145
tarSupportsZstd: true,
130146
expectedBundleName: "codeql-bundle-osx64.tar.zst",
131147
expectedCompressionMethod: "zstd",
132148
},
133149
{
134150
platform: "win32",
151+
arch: "x64",
135152
tarSupportsZstd: true,
136153
expectedBundleName: "codeql-bundle-win64.tar.gz",
137154
expectedCompressionMethod: "gzip",
138155
},
139156
{
140157
platform: "linux",
158+
arch: "x64",
141159
tarSupportsZstd: false,
142160
expectedBundleName: "codeql-bundle-linux64.tar.gz",
143161
expectedCompressionMethod: "gzip",
@@ -146,15 +164,17 @@ const LINKED_BUNDLE_TEST_CASES = [
146164

147165
for (const {
148166
platform,
167+
arch,
149168
tarSupportsZstd,
150169
expectedBundleName,
151170
expectedCompressionMethod,
152171
} of LINKED_BUNDLE_TEST_CASES) {
153172
test.serial(
154-
`getCodeQLSource selects ${expectedBundleName} for linked tools`,
173+
`getCodeQLSource selects ${expectedBundleName} for linked tools on ${platform}/${arch}`,
155174
async (t) => {
156175
const features = createFeatures([]);
157176
sinon.stub(process, "platform").value(platform);
177+
sinon.stub(process, "arch").value(arch);
158178

159179
await withTmpDir(async (tmpDir) => {
160180
setupActionsVars(tmpDir, tmpDir);

src/setup-codeql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function getCodeQLBundleName(
7575
if (process.platform === "win32") {
7676
platform = "win64";
7777
} else if (process.platform === "linux") {
78-
platform = "linux64";
78+
platform = process.arch === "arm64" ? "linux-arm64" : "linux64";
7979
} else if (process.platform === "darwin") {
8080
platform = "osx64";
8181
} else {

src/testing-utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,9 @@ export function mockBundleDownloadApi({
937937
process.platform === "win32"
938938
? "win64"
939939
: process.platform === "linux"
940-
? "linux64"
940+
? process.arch === "arm64"
941+
? "linux-arm64"
942+
: "linux64"
941943
: "osx64";
942944

943945
const baseUrl = apiDetails?.url ?? "https://example.com";

0 commit comments

Comments
 (0)