Skip to content

Commit 12261ee

Browse files
authored
feat: Support snapshot installs on Windows ARM64 (#635)
This PR adds support for installing Chrome and ChromeDriver from snapshots on Windows ARM64. It allows to install chrome browsers with snapshot numbers such as `1485971`. ```yaml test-windows-arm: runs-on: windows-11-arm steps: - name: Install Google Chrome uses: browser-actions/setup-chrome@v2 with: chrome-version: 1485971 install-chromedriver: true id: setup-chrome - run: | (Get-Item (Get-Command "${{ steps.setup-chrome.outputs.chrome-path }}").Source).VersionInfo.ProductVersion (Get-Item (Get-Command "${{ steps.setup-chrome.outputs.chromedriver-path }}").Source).VersionInfo.ProductVersion ```
1 parent 3289928 commit 12261ee

File tree

4 files changed

+42
-9
lines changed

4 files changed

+42
-9
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ jobs:
5252
(Get-Item (Get-Command "${{ steps.setup-chrome.outputs.chrome-path }}").Source).VersionInfo.ProductVersion
5353
(Get-Item (Get-Command "${{ steps.setup-chrome.outputs.chromedriver-path }}").Source).VersionInfo.ProductVersion
5454
55+
test-windows-arm:
56+
needs: [build]
57+
runs-on: windows-11-arm
58+
steps:
59+
- uses: actions/download-artifact@v4
60+
with:
61+
name: dist
62+
63+
- name: Install Google Chrome
64+
uses: ./
65+
with:
66+
chrome-version: 1485971
67+
install-chromedriver: true
68+
id: setup-chrome
69+
- run: |
70+
(Get-Item (Get-Command "${{ steps.setup-chrome.outputs.chrome-path }}").Source).VersionInfo.ProductVersion
71+
(Get-Item (Get-Command "${{ steps.setup-chrome.outputs.chromedriver-path }}").Source).VersionInfo.ProductVersion
72+
5573
test-install-dependencies:
5674
needs: [build]
5775
strategy:

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ The action installs the stable version of Chrome for Testing by default.
1818

1919
```yaml
2020
steps:
21-
- uses: browser-actions/setup-chrome@v1
21+
- uses: browser-actions/setup-chrome@v2
2222
- run: chrome --version
2323
```
2424
2525
To install a specific channel, use `chrome-version` input.
2626

2727
```yaml
2828
steps:
29-
- uses: browser-actions/setup-chrome@v1
29+
- uses: browser-actions/setup-chrome@v2
3030
with:
3131
chrome-version: 120
3232
```
@@ -36,7 +36,7 @@ You can use the `install-chromedriver` to install the ChromeDriver.
3636

3737
```yaml
3838
steps:
39-
- uses: browser-actions/setup-chrome@v1
39+
- uses: browser-actions/setup-chrome@v2
4040
with:
4141
chrome-version: 120
4242
install-chromedriver: true
@@ -48,7 +48,7 @@ It installs the required dependencies for the Google Chrome/Chromium to run auto
4848

4949
```yaml
5050
steps:
51-
- uses: browser-actions/setup-chrome@v1
51+
- uses: browser-actions/setup-chrome@v2
5252
with:
5353
chrome-version: 120
5454
install-dependencies: true
@@ -74,7 +74,7 @@ To get the installed binary path, use `chrome-path` output of the action:
7474

7575
```yaml
7676
steps:
77-
- uses: browser-actions/setup-chrome@v1
77+
- uses: browser-actions/setup-chrome@v2
7878
id: setup-chrome
7979
- run: |
8080
${{ steps.setup-chrome.outputs.chrome-path }} --version
@@ -102,6 +102,15 @@ steps:
102102

103103
[snapshots]: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html
104104

105+
## Supported platforms
106+
107+
| | Linux x64 | Mac x64 | Mac Arm64 | Windows | Windows Arm64 |
108+
| --- | --- | --- | --- | --- | --- |
109+
| Channel name (e.g. `stable`) | ✅ | ✅ | ✅ | ✅ | ❌ |
110+
| Commit position (e.g. `1295939`) | ✅ | ✅ | ✅ | ✅ | ✅ |
111+
| Specific version (e.g. `120.0.6099`) | ✅ | ✅ | ✅ | ✅ | ❌ |
112+
| Latest snapshot | ✅ | ✅ | ✅ | ✅ | ✅ |
113+
105114
## License
106115

107116
[MIT](LICENSE)

src/snapshot_bucket.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,16 @@ const browserFileName = ({ os }: Platform): string => {
4747
}
4848
};
4949

50-
const driverFileName = ({ os }: Platform): string => {
50+
const driverFileName = ({ os, arch }: Platform): string => {
5151
switch (os) {
5252
case OS.DARWIN:
5353
return "chromedriver_mac64.zip";
5454
case OS.LINUX:
5555
return "chromedriver_linux64.zip";
5656
case OS.WINDOWS:
57-
return "chromedriver_win32.zip";
57+
return arch === Arch.ARM64
58+
? "chromedriver_win64.zip"
59+
: "chromedriver_win32.zip";
5860
}
5961
};
6062

@@ -71,6 +73,8 @@ const makePlatformPart = ({ os, arch }: Platform): string => {
7173
return "Win";
7274
} else if (os === OS.WINDOWS && arch === Arch.AMD64) {
7375
return "Win_x64";
76+
} else if (os === OS.WINDOWS && arch === Arch.ARM64) {
77+
return "Win_Arm64";
7478
}
7579
throw new Error(`Unsupported platform "${os}" "${arch}"`);
7680
};

src/snapshot_installer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as core from "@actions/core";
33
import * as tc from "@actions/tool-cache";
44
import * as cache from "./cache";
55
import type { DownloadResult, InstallResult, Installer } from "./installer";
6-
import { OS, type Platform } from "./platform";
6+
import { Arch, OS, type Platform } from "./platform";
77
import { browserDownloadURL, driverDownloadURL } from "./snapshot_bucket";
88

99
export class SnapshotInstaller implements Installer {
@@ -85,7 +85,9 @@ export class SnapshotInstaller implements Installer {
8585
case OS.LINUX:
8686
return path.join(extPath, "chromedriver_linux64");
8787
case OS.WINDOWS:
88-
return path.join(extPath, "chromedriver_win32");
88+
return this.platform.arch === Arch.ARM64
89+
? path.join(extPath, "chromedriver_win64")
90+
: path.join(extPath, "chromedriver_win32");
8991
}
9092
})();
9193
const bin = (() => {

0 commit comments

Comments
 (0)