@@ -2,24 +2,22 @@ name: Node CI
2
2
3
3
on : [push, pull_request, workflow_dispatch]
4
4
5
- env :
6
- FORCE_COLOR : 1
7
-
8
5
jobs :
9
6
build :
10
7
strategy :
11
8
fail-fast : false
12
9
matrix :
13
- os : [ubuntu-latest]
14
- node : [16]
10
+ os : [ubuntu-22.04]
15
11
electron_version : [29, 30, 31, 32]
12
+ node : [16]
16
13
include :
17
14
- os : windows-latest
18
- node : 16
19
15
command_prefix : ' '
20
16
electron_version : 32
21
- - os : ubuntu-latest
17
+ node : 16
18
+ - os : ubuntu-22.04
22
19
command_prefix : xvfb-run
20
+
23
21
runs-on : ${{ matrix.os }}
24
22
steps :
25
23
- uses : actions/checkout@v4
@@ -29,21 +27,21 @@ jobs:
29
27
node-version : ${{ matrix.node }}
30
28
- name : Get yarn cache dir
31
29
if : ${{ runner.os != 'Windows' }}
32
- id : yarn-cache
30
+ id : yarn-cache-dir
33
31
shell : bash
34
32
run : |
35
- echo "dir=~/$(realpath -s --relative-to=" ${HOME}" "$(yarn cache dir) ")" >> "${GITHUB_OUTPUT}"
36
- - name : Yarn cache
33
+ echo "dir=$(yarn cache dir | sed "s| ${HOME}|~| ")" >> "${GITHUB_OUTPUT}"
34
+ - name : Yarn cache restore
37
35
if : ${{ runner.os != 'Windows' }}
38
- uses : actions/cache@v4
36
+ id : yarn-cache-restore
37
+ uses : actions/cache/restore@v4
39
38
with :
40
- path : ${{ steps.yarn-cache.outputs.dir }}
39
+ path : ${{ steps.yarn-cache-dir .outputs.dir }}
41
40
key : ${{ matrix.os }}-yarn-node-${{ matrix.node }}-electron-${{ matrix.electron_version }}-${{ hashFiles('yarn.lock') }}
42
41
restore-keys : |
43
42
${{ matrix.os }}-yarn-node-${{ matrix.node }}-electron-${{ matrix.electron_version }}-
44
43
${{ matrix.os }}-yarn-node-${{ matrix.node }}-
45
44
${{ matrix.os }}-yarn-node-
46
- save-always : true
47
45
- name : Electron version
48
46
id : electron-version
49
47
shell : bash
@@ -58,17 +56,27 @@ jobs:
58
56
command : yarn install
59
57
- name : yarn lint
60
58
run : yarn lint
59
+ env :
60
+ FORCE_COLOR : 1
61
61
- name : yarn test
62
62
uses : nick-fields/retry@v3
63
63
env :
64
64
ELECTRON_VERSION : ${{ matrix.electron_version }}
65
+ FORCE_COLOR : 1
65
66
with :
66
67
timeout_minutes : 5
67
68
max_attempts : 3
68
69
command : ${{ matrix.command_prefix }} yarn run test:ci
69
70
- name : Upload coverage to Codecov
70
- if : ${{ matrix.os == 'ubuntu-latest ' && matrix.node == 16 && matrix.electron_version == 32 }}
71
+ if : ${{ matrix.os == 'ubuntu-22.04 ' && matrix.node == 16 && matrix.electron_version == 32 }}
71
72
uses : codecov/codecov-action@v5
72
73
with :
73
74
token : ${{ secrets.CODECOV_TOKEN }}
74
75
files : ./coverage/clover.xml
76
+ - name : Yarn cache save always
77
+ id : yarn-cache-save
78
+ if : ${{ always() && runner.os != 'Windows' && steps.yarn-cache-restore.outputs.cache-hit != 'true' }}
79
+ uses : actions/cache/save@v4
80
+ with :
81
+ path : ${{ steps.yarn-cache-dir.outputs.dir }}
82
+ key : ${{ steps.yarn-cache-restore.outputs.cache-primary-key }}
0 commit comments