Repository navigation
173 lines (169 loc) · 5.91 KB
/
Copy pathtests.yml
File metadata and controls
173 lines (169 loc) · 5.91 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# Copyright 2019 Marc Nuri San Felix
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Tests
on:
push:
branches:
- main
pull_request:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: Install
run: npm install
- name: Pretest
run: npm run pretest
- name: Setup Xvfb (Playwright requirements)
run: |
# Start virtual display for headless Electron
sudo apt-get update
sudo apt-get install -y xvfb
# Persist DISPLAY to subsequent steps via GITHUB_ENV
echo "DISPLAY=:99" >> "$GITHUB_ENV"
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
# Wait for display to be ready
sleep 3
- name: Test
run: npm test
- name: E2E Tests
run: npm run test:e2e
- name: SonarCloud
run: |
./node_modules/.bin/sonar-scanner-npm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_SCANNER_OPTS: "-server"
linux-build:
name: Linux Build
runs-on: ubuntu-latest
# Same build system as the Linux Artifact job of publish.yml, see why there
container: ubuntu:22.04
steps:
- name: Build requirements
run: |
apt-get update
apt-get install -y --no-install-recommends appstream binutils ca-certificates g++ git make python3
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: Install
run: npm install
- name: Build
# The snap is built by the snap-build job, as in the publish workflows
run: npm run build:linux -- AppImage tar.gz
- name: Extract AppImage
# Check what the AppImage ships, it adds the runtime libraries of the electron-builder toolset to
# the application directory
run: ./dist/electronim-linux-x86_64.AppImage --appimage-extract
- name: Check the spell checker is in the AppImage
# The whole point of the glibc check is the native module of the spell checker, it is only
# scanned while electron-builder keeps unpacking it from the asar
run: test -f squashfs-root/resources/app.asar.unpacked/node_modules/nodehun/build/Release/Nodehun.node
- name: Check glibc requirements
# squashfs-root is the application directory and the libraries the AppImage bundles, dist adds
# the runtime of the AppImage itself, which is the first binary that has to run
run: ./utils/check-glibc.sh squashfs-root dist
- name: Validate AppStream metainfo
# The tree validation also checks that the desktop file the metainfo launches is installed, as the
# appdir-lint.sh check of the AppImage catalog does
run: appstreamcli validate-tree --no-net squashfs-root
- name: CI Artifact for AppImage
uses: actions/upload-artifact@v5
with:
name: electronim-linux-x86_64.AppImage
path: dist/electronim-linux-x86_64.AppImage
snap-build:
name: Snap Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: Install Snap
# Not needed for this job just to verify it can be installed for use in the publishing workflow
run: |
sudo apt update && sudo apt-get install snapd
sudo chown root:root / # Snapcraft requires '/' to be root owned
sudo snap install snapcraft --classic
- name: Install
run: npm install
- name: Build
run: npm run build:linux -- snap
macos-build:
name: macOS Build
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: macOS requirements
run: |
brew install python-setuptools
- name: Install
run: npm install
- name: Install macOS only requirement (Electron Builder)
run: npm install dmg-license
- name: Build
run: npm run build:mac
windows-build:
name: Windows Build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22.x'
- name: Install
run: npm install
- name: Build
run: npm run build:win
- name: Prepare Chocolatey
run: node .\utils\prepare-chocolatey.js
- name: Choco Script tests
run: |
powershell
choco pack --version=$(node -p "require('./package').version") build-config/electronim.nuspec
choco install electronim -dvy -s .
- name: CI Artifact for exe
uses: actions/upload-artifact@v5
with:
name: electronim-win-x64.exe
path: dist/electronim-win-x64.exe
- name: CI Artifact for msi
uses: actions/upload-artifact@v5
with:
name: electronim-win-x64.msi
path: dist/electronim-win-x64.msi