Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ jobs:
(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

test-windows-arm:
needs: [build]
runs-on: windows-11-arm
steps:
- uses: actions/download-artifact@v4
with:
name: dist

- name: Install Google Chrome
uses: ./
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

test-install-dependencies:
needs: [build]
strategy:
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ The action installs the stable version of Chrome for Testing by default.

```yaml
steps:
- uses: browser-actions/setup-chrome@v1
- uses: browser-actions/setup-chrome@v2
- run: chrome --version
```

To install a specific channel, use `chrome-version` input.

```yaml
steps:
- uses: browser-actions/setup-chrome@v1
- uses: browser-actions/setup-chrome@v2
with:
chrome-version: 120
```
Expand All @@ -36,7 +36,7 @@ You can use the `install-chromedriver` to install the ChromeDriver.

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

```yaml
steps:
- uses: browser-actions/setup-chrome@v1
- uses: browser-actions/setup-chrome@v2
with:
chrome-version: 120
install-dependencies: true
Expand All @@ -74,7 +74,7 @@ To get the installed binary path, use `chrome-path` output of the action:

```yaml
steps:
- uses: browser-actions/setup-chrome@v1
- uses: browser-actions/setup-chrome@v2
id: setup-chrome
- run: |
${{ steps.setup-chrome.outputs.chrome-path }} --version
Expand Down Expand Up @@ -102,6 +102,15 @@ steps:

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

## Supported platforms

| | Linux x64 | Mac x64 | Mac Arm64 | Windows | Windows Arm64 |
| --- | --- | --- | --- | --- | --- |
| Channel name (e.g. `stable`) | ✅ | ✅ | ✅ | ✅ | ❌ |
| Commit position (e.g. `1295939`) | ✅ | ✅ | ✅ | ✅ | ✅ |
| Specific version (e.g. `120.0.6099`) | ✅ | ✅ | ✅ | ✅ | ❌ |
| Latest snapshot | ✅ | ✅ | ✅ | ✅ | ✅ |

## License

[MIT](LICENSE)
8 changes: 6 additions & 2 deletions src/snapshot_bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ const browserFileName = ({ os }: Platform): string => {
}
};

const driverFileName = ({ os }: Platform): string => {
const driverFileName = ({ os, arch }: Platform): string => {
switch (os) {
case OS.DARWIN:
return "chromedriver_mac64.zip";
case OS.LINUX:
return "chromedriver_linux64.zip";
case OS.WINDOWS:
return "chromedriver_win32.zip";
return arch === Arch.ARM64
? "chromedriver_win64.zip"
: "chromedriver_win32.zip";
}
};

Expand All @@ -71,6 +73,8 @@ const makePlatformPart = ({ os, arch }: Platform): string => {
return "Win";
} else if (os === OS.WINDOWS && arch === Arch.AMD64) {
return "Win_x64";
} else if (os === OS.WINDOWS && arch === Arch.ARM64) {
return "Win_Arm64";
}
throw new Error(`Unsupported platform "${os}" "${arch}"`);
};
6 changes: 4 additions & 2 deletions src/snapshot_installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as core from "@actions/core";
import * as tc from "@actions/tool-cache";
import * as cache from "./cache";
import type { DownloadResult, InstallResult, Installer } from "./installer";
import { OS, type Platform } from "./platform";
import { Arch, OS, type Platform } from "./platform";
import { browserDownloadURL, driverDownloadURL } from "./snapshot_bucket";

export class SnapshotInstaller implements Installer {
Expand Down Expand Up @@ -85,7 +85,9 @@ export class SnapshotInstaller implements Installer {
case OS.LINUX:
return path.join(extPath, "chromedriver_linux64");
case OS.WINDOWS:
return path.join(extPath, "chromedriver_win32");
return this.platform.arch === Arch.ARM64
? path.join(extPath, "chromedriver_win64")
: path.join(extPath, "chromedriver_win32");
}
})();
const bin = (() => {
Expand Down
Loading