-
Notifications
You must be signed in to change notification settings - Fork 23
262 lines (230 loc) · 8.98 KB
/
build-apps-aarch64.yml
File metadata and controls
262 lines (230 loc) · 8.98 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
name: Apps - Build aarch64
on:
workflow_dispatch:
push:
branches:
- main
- dev
- dev-arm64-build
- pre-release
paths:
- ".github/workflows/build-apps-aarch64.yml"
- "apps/**"
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
CARGO_NET_GIT_FETCH_WITH_CLI: true
MECHA_PULP_USERNAME: ${{ secrets.MECHA_PULP_USERNAME }}
MECHA_PULP_PASSWORD: ${{ secrets.MECHA_PULP_PASSWORD }}
MECHA_PULP_API_URL: ${{ vars.MECHA_PULP_API_URL }}
MECHA_PULP_DEBS_REPOSITORY_NAME: ${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}
MECHA_PULP_RPMS_REPOSITORY_NAME: ${{ vars.MECHA_PULP_RPMS_REPOSITORY_NAME }}
jobs:
# Detect which apps have changed
detect-changes:
runs-on: ubuntu-latest
outputs:
settings: ${{ steps.filter.outputs.settings }}
notes: ${{ steps.filter.outputs.notes }}
files: ${{ steps.filter.outputs.files }}
music: ${{ steps.filter.outputs.music }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for changes
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
settings:
- 'apps/settings/**'
notes:
- 'apps/notes/**'
files:
- 'apps/files/**'
music:
- 'apps/music/**'
camera:
- 'apps/camera/**'
build:
name: ${{ matrix.name }}
needs: detect-changes
strategy:
fail-fast: false
matrix:
include:
- name: mechanix-settings
app: settings
folder: settings
binary: mechanix_settings
- name: mechanix-notes
app: notes
folder: notes
binary: mechanix_notes
- name: mechanix-files
app: files
folder: files
binary: mechanix_files
- name: mechanix-music
app: music
folder: music
binary: mechanix_music
- name: mechanix-camera
app: camera
folder: camera
binary: mechanix_camera
runs-on: ubuntu-24.04-arm
environment: pre-release
continue-on-error: true
steps:
# Install dependencies
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y git tar unzip curl clang cmake pkg-config \
libwayland-dev libwayland-cursor0 libwayland-egl1 \
libwayland-egl-backend-dev libegl1-mesa-dev libgles2-mesa-dev libxkbcommon-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev
- name: Install PDFium (ARM64)
run: |
set -eux
URL="https://github.com/bblanchon/pdfium-binaries/releases/latest/download/pdfium-linux-arm64.tgz"
curl -L "$URL" -o pdfium.tgz
mkdir pdfium
tar -xzf pdfium.tgz -C pdfium --strip-components=1
echo "=== Extracted ==="
ls -la pdfium
# install library
sudo cp pdfium/libpdfium.so /usr/local/lib/
# install headers
sudo mkdir -p /usr/local/include/pdfium
sudo cp pdfium/*.h /usr/local/include/pdfium/
sudo cp -r pdfium/cpp /usr/local/include/pdfium/
sudo ldconfig
# verify
ldconfig -p | grep pdfium || true
ls -l /usr/local/lib/libpdfium.so
# Install NuShell
- name: Install Nushell
run: |
curl -fsSL https://apt.fury.io/nushell/gpg.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/fury-nushell.gpg
echo "deb https://apt.fury.io/nushell/ /" | sudo tee /etc/apt/sources.list.d/fury.list
sudo apt update
sudo apt install nushell
# Add Comet repository
- name: Add Comet repository
run: |
curl -fsSL https://pub-a2f44c787cec4290833312e57fd59522.r2.dev/comet.asc | \
sudo gpg --dearmor -o /usr/share/keyrings/comet-deb.gpg
echo "deb [signed-by=/usr/share/keyrings/comet-deb.gpg] http://pkg.mecha.so/debian pulp upload" | \
sudo tee /etc/apt/sources.list.d/comet.list
sudo apt update
# Add RPM Packaging Tools
- name: Install RPM Packaging Tools
run: |
sudo apt install -y rpm build-essential \
rpm2cpio \
rpmlint \
dnf
# Checkout repository
- name: Setup | Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for git operations
# Install Flutter eLinux
- name: Install Flutter eLinux
run: |
if [ ! -d "/opt/flutter-elinux" ]; then
git clone https://github.com/sony/flutter-elinux.git
sudo mv flutter-elinux /opt/
fi
echo "PATH=$PATH:/opt/flutter-elinux/bin" >> $GITHUB_ENV
# Build the app (ALWAYS)
- name: Build ${{ matrix.name }}
working-directory: apps/${{ matrix.folder }}
run: |
flutter-elinux pub get
flutter-elinux build elinux --release
# Update NuShell script permissions
- name: Update NuShell script permissions
run: |
chmod +x apps/*.nu
chmod +x utils/*.nu
# Move entire bundle to ./build/<binary>
- name: Prepare build folder ${{ matrix.name }}
run: |
mkdir -p ./build/${{ matrix.binary }}
cp -r "apps/${{ matrix.folder }}/build/elinux/arm64/release/bundle/"* "./build/${{ matrix.binary }}/"
# Package Debian using Nushell script (ALWAYS)
- name: Package Debian ${{ matrix.name }}
working-directory: apps
run: |
nu package-deb.nu "${{ matrix.folder }}" "../build/deb"
# Package RPM using Nushell script
- name: Package RPM ${{ matrix.name }}
working-directory: apps
run: |
nu package-rpm.nu "${{ matrix.folder }}" "../build/rpm"
# List artifacts
- name: List artifacts ${{ matrix.name }}
run: ls -la ./build/deb/
# Setup Pulp CLI
- name: Setup | Pulp CLI
run: |
pipx install --force pulp-cli[pygments]
# Added pulp-cli-rpm here
pipx inject pulp-cli pulp-cli-deb pulp_rpm
- name: Configure Pulp CLI
run: |
set -euo pipefail
PULP_API_URL="${MECHA_PULP_API_URL}:8080"
pulp config create \
--username "$MECHA_PULP_USERNAME" \
--password "$MECHA_PULP_PASSWORD" \
--base-url "$PULP_API_URL" \
--overwrite
- name: Check Publish Condition
id: check_publish
run: |
SHOULD_PUBLISH="false"
if [[ "${{ matrix.app }}" == "settings" && "${{ needs.detect-changes.outputs.settings }}" == "true" ]]; then SHOULD_PUBLISH="true"; fi
if [[ "${{ matrix.app }}" == "notes" && "${{ needs.detect-changes.outputs.notes }}" == "true" ]]; then SHOULD_PUBLISH="true"; fi
if [[ "${{ matrix.app }}" == "files" && "${{ needs.detect-changes.outputs.files }}" == "true" ]]; then SHOULD_PUBLISH="true"; fi
if [[ "${{ matrix.app }}" == "music" && "${{ needs.detect-changes.outputs.music }}" == "true" ]]; then SHOULD_PUBLISH="true"; fi
echo "should_publish=$SHOULD_PUBLISH" >> $GITHUB_OUTPUT
- name: Publish DEB
if: steps.check_publish.outputs.should_publish == 'true'
run: |
DEB_FILE=$(find ./build/deb -name "mechanix-${{ matrix.app }}*.deb" -type f | head -n1)
echo "[INFO] 📦 Publishing DEB: $DEB_FILE"
pulp deb content upload --repository="${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}" --file="$DEB_FILE"
PUB_HREF=$(pulp deb publication create \
--repository="${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}" \
--signing-service=mecha-pkg-sign | jq -r '.pulp_href')
pulp deb distribution update \
--name="${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}" \
--base-path="${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}" \
--repository="${{ vars.MECHA_PULP_DEBS_REPOSITORY_NAME }}"
- name: Publish RPM
if: steps.check_publish.outputs.should_publish == 'true'
run: |
RPM_FILE=$(find ./build/rpm -name "mechanix-${{ matrix.app }}*.rpm" -type f | head -n1)
echo "[INFO] 📦 Publishing RPM: $RPM_FILE"
pulp rpm content upload --repository="${{ vars.MECHA_PULP_RPMS_REPOSITORY_NAME }}" --file="$RPM_FILE"
PUB_HREF=$(pulp rpm publication create \
--repository="${{ vars.MECHA_PULP_RPMS_REPOSITORY_NAME }}" | jq -r '.pulp_href')
pulp rpm distribution update \
--name="${{ vars.MECHA_PULP_RPMS_REPOSITORY_NAME }}" \
--base-path="${{ vars.MECHA_PULP_RPMS_REPOSITORY_NAME }}" \
--publication="$PUB_HREF"
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}
path: |
./build/${{ matrix.binary }}/
./build/deb/*.deb
./build/rpm/*.rpm