forked from samuelmaddock/electron-browser-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (58 loc) · 2.32 KB
/
Copy pathtest.yml
File metadata and controls
71 lines (58 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Test electron-chrome-extensions
on:
push:
pull_request:
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v5
# Setup Node runs first and prepends its Node directory to PATH.
# package-manager-cache is disabled because setup-node@v5 enables it
# by default: it detects the packageManager field and invokes yarn
# internally, hitting the runner's preinstalled classic Yarn 1.x
# before Corepack is enabled.
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: '20.x'
package-manager-cache: false
# Running after setup-node, the shim lands next to the tool-cached
# node binary, which is now first in PATH on every OS. No custom
# install directory or elevated permissions needed.
- name: Enable Corepack
run: corepack enable
# Manual cache replaces setup-node's `cache: yarn` (see above).
- name: Get Yarn cache directory
id: yarn-cache
shell: bash
run: echo "dir=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
- name: Cache Yarn dependencies
uses: actions/cache@v5
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: yarn-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: yarn-${{ runner.os }}-
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build
# Ubuntu 23.10+ restricts unprivileged user namespaces, which Chromium's
# sandbox needs. The sandbox must stay enabled during tests: Electron
# skips service worker preload scripts under --no-sandbox, silently
# breaking the MV3 service worker specs.
- name: Enable unprivileged user namespaces (Linux)
if: runner.os == 'Linux'
run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
# xvfb-run replaces the unmaintained GabrielBB/xvfb-action, which
# still targets the deprecated Node 20 action runtime.
- name: Run tests (Linux)
if: runner.os == 'Linux'
run: xvfb-run --auto-servernum -- yarn test
- name: Run tests (Windows)
if: runner.os == 'Windows'
run: yarn test