-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
211 lines (182 loc) · 6.9 KB
/
Copy pathbuild-linux.yml
File metadata and controls
211 lines (182 loc) · 6.9 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Build Linux App
on:
workflow_call:
inputs:
version:
required: true
type: string
build_type:
required: true
type: string
installer_base_name:
required: true
type: string
jobs:
build-linux:
env:
BUILD_TYPE: ${{ inputs.build_type }}
VERSION: ${{ inputs.version }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download pubspec.yaml
uses: actions/download-artifact@v4
with:
name: pubspec
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- name: Cache Flutter dependencies
uses: actions/cache@v4
timeout-minutes: 5
continue-on-error: true
with:
path: |
~/.pub-cache
.dart_tool
key: ${{ runner.os }}-flutter-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-flutter-
- name: Cache APT archives
uses: actions/cache@v4
timeout-minutes: 5
continue-on-error: true
with:
path: ~/.cache/apt/archives
key: ${{ runner.os }}-apt-archives-v1-${{ hashFiles('.github/workflows/build-linux.yml') }}
restore-keys: |
${{ runner.os }}-apt-archives-v1-
- name: Install Linux dependencies
run: |
set -euxo pipefail
APT_ARCHIVE_DIR="$HOME/.cache/apt/archives"
mkdir -p "$APT_ARCHIVE_DIR/partial"
required_packages=(
clang
cmake
pkg-config
libgtk-3-dev
liblzma-dev
libgl1-mesa-dev
libegl1-mesa-dev
libayatana-appindicator3-dev
libcurl4-openssl-dev
libwebkit2gtk-4.1-dev
patchelf
xvfb
)
missing_packages=()
for pkg in "${required_packages[@]}"; do
if ! dpkg -s "$pkg" >/dev/null 2>&1; then
missing_packages+=("$pkg")
fi
done
if [ "${#missing_packages[@]}" -gt 0 ]; then
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
-o dir::cache::archives="$APT_ARCHIVE_DIR" \
"${missing_packages[@]}"
else
echo "All Linux build dependencies are already installed"
fi
- name: Install the ninja build tool
uses: seanmiddleditch/gha-setup-ninja@master
- name: Install Flutter
uses: subosito/flutter-action@v2.19.0
with:
channel: stable
flutter-version-file: pubspec.yaml
cache: true
- name: Install dependencies
run: make install-linux-deps
- name: Enable Flutter Desktop Support
run: |
flutter config --enable-linux-desktop
- name: Decode APP_ENV
uses: timheuer/base64-to-file@v1.2
with:
fileName: "app.env"
fileDir: ${{ github.workspace }}
encodedString: ${{ secrets.APP_ENV }}
- name: Build Linux release
run: make linux-release-ci
env:
BUILD_TYPE: ${{ inputs.build_type }}
VERSION: ${{ inputs.version }}
INSTALLER_NAME: ${{ inputs.installer_base_name }}
- name: Verify Linux package contents
run: |
./scripts/ci/verify_linux_package.sh "${{ inputs.installer_base_name }}${{ inputs.build_type != 'production' && format('-{0}', inputs.build_type) || '' }}.deb"
- name: Install .deb and verify postinst started daemon
shell: bash
run: |
set -euxo pipefail
deb="./${{ inputs.installer_base_name }}${{ inputs.build_type != 'production' && format('-{0}', inputs.build_type) || '' }}.deb"
test -f "$deb"
sudo apt-get install -y "$deb"
for i in $(seq 1 30); do
if systemctl is-active --quiet lanternd.service; then
break
fi
sleep 1
done
if ! systemctl is-active --quiet lanternd.service; then
sudo systemctl status lanternd.service --no-pager || true
sudo journalctl -u lanternd.service -n 200 --no-pager || true
echo "lanternd.service is not active after package install"
exit 1
fi
if ! systemctl is-enabled --quiet lanternd.service; then
echo "lanternd.service is not enabled after package install"
exit 1
fi
sudo usermod -aG lantern "$USER" || true
systemctl is-active --quiet lanternd.service
test -S /run/lantern/lanternd.sock
sudo stat -c "%a %U %G %n" /run/lantern/lanternd.sock
- name: Installed binary launch smoke
shell: bash
run: |
set -euxo pipefail
code=0
sg lantern -c "env HOME=$HOME PATH=$PATH xvfb-run -a timeout 15s /usr/bin/lantern >/tmp/lantern-installed-smoke.log 2>&1" || code=$?
if [[ "$code" -ne 124 ]]; then
cat /tmp/lantern-installed-smoke.log || true
echo "Installed /usr/bin/lantern did not stay up under xvfb"
exit 1
fi
- name: Linux UI connect/disconnect integration
shell: bash
env:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
run: |
set -euxo pipefail
TEST_START_UTC="$(date -u '+%Y-%m-%d %H:%M:%S')"
sg lantern -c "env PATH=$PATH HOME=$HOME xvfb-run -a flutter test integration_test/vpn/linux_connect_smoke_test.dart -d linux --dart-define=DISABLE_SYSTEM_TRAY=true --dart-define=ENABLE_IP_CHECK=true"
sudo journalctl -u lanternd.service --since "$TEST_START_UTC" --no-pager > /tmp/lanternd-journal-ui-smoke.log
if ! grep -Eq 'IPC request.*path=/service/start' /tmp/lanternd-journal-ui-smoke.log; then
echo "Missing /service/start IPC request in lanternd journal"
tail -n 200 /tmp/lanternd-journal-ui-smoke.log || true
exit 1
fi
if ! grep -Eq 'IPC request.*path=/service/stop' /tmp/lanternd-journal-ui-smoke.log; then
echo "Missing /service/stop IPC request in lanternd journal"
tail -n 200 /tmp/lanternd-journal-ui-smoke.log || true
exit 1
fi
- name: Upload Linux build
uses: actions/upload-artifact@v4
with:
name: lantern-installer-rpm
path: ${{ inputs.installer_base_name }}${{ inputs.build_type != 'production' && format('-{0}', inputs.build_type) || '' }}.rpm
retention-days: 2
- name: Upload Linux build
uses: actions/upload-artifact@v4
with:
name: lantern-installer-deb
path: ${{ inputs.installer_base_name }}${{ inputs.build_type != 'production' && format('-{0}', inputs.build_type) || '' }}.deb
retention-days: 2