forked from marktext/marktext
-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (125 loc) · 4.52 KB
/
build.yml
File metadata and controls
151 lines (125 loc) · 4.52 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Build
on:
push:
branches: [ main, master, develop ]
paths-ignore:
- 'docs/**'
pull_request:
branches: [ main, master, develop ]
paths-ignore:
- 'docs/**'
jobs:
unix:
runs-on: ${{ matrix.os }}
continue-on-error: false
timeout-minutes: 45
strategy:
matrix:
os: [macos-11, ubuntu-latest]
env:
DISPLAY: ":99.0"
# MARKTEXT_IS_STABLE: 1
MARKTEXT_EXIT_ON_ERROR: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out Git repository
uses: actions/checkout@v6
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 16
check-latest: true
cache: yarn
cache-dependency-path: yarn.lock
- name: Install build dependencies
if: runner.os == 'Linux'
# electron-builder | keyboard-layout | keytar | fontmanager
run: |
sudo apt-get -y update
sudo apt-get install -y icnsutils graphicsmagick xz-utils libx11-dev libxkbfile-dev gnome-keyring libsecret-1-dev libfontconfig-dev
- name: Cache node_modules
uses: actions/cache@v5
id: cacheNodeModules
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
restore-keys: |
${{ runner.os }}-node_modules-cache-v1-
- name: Cache Electron
uses: actions/cache@v5
with:
path: ${{ env.HOME }}/.cache/electron
key: ${{ runner.os }}-electron-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
- name: Cache Electron-Builder
uses: actions/cache@v5
with:
path: ${{ env.HOME }}/.cache//electron-builder
key: ${{ runner.os }}-electron-builder-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
- name: Install dependencies
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: yarn install --check-files --frozen-lockfile
- name: Lint
run: |
yarn run lint
yarn run validate-licenses
- name: Run unit and E2E tests
uses: GabrielBB/xvfb-action@v1
with:
run: yarn run test
- name: Build
run: yarn build:bin
windows:
runs-on: windows-latest
continue-on-error: false
timeout-minutes: 45
env:
# MARKTEXT_IS_STABLE: 1
MARKTEXT_EXIT_ON_ERROR: 1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out Git repository
uses: actions/checkout@v6
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 16
check-latest: true
cache: yarn
cache-dependency-path: yarn.lock
# Workaround: Fix native build failure due to outdated node-gyp version.
- name: Fix node-gyp
run: |
npm install --global node-gyp@latest
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
node-gyp install
shell: pwsh
- name: Cache node_modules
uses: actions/cache@v5
id: cacheNodeModules
with:
path: ${{ github.workspace }}\node_modules
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
restore-keys: |
${{ runner.os }}-node_modules-cache-v2-
- name: Cache Electron
uses: actions/cache@v5
with:
path: ${{ env.LOCALAPPDATA }}\electron\Cache
key: ${{ runner.os }}-electron-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
- name: Cache Electron-Builder
uses: actions/cache@v5
with:
path: ${{ env.LOCALAPPDATA }}\electron-builder\cache
key: ${{ runner.os }}-electron-builder-cache-v2-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
- name: Install dependencies
# Windows worker fail sometimes because a module cannot be found.
# if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: yarn install --check-files --frozen-lockfile
- name: Lint
run: |
yarn run lint
yarn run validate-licenses
- name: Run unit and E2E tests
run: yarn run test
- name: Build
run: yarn build:bin