-
-
Notifications
You must be signed in to change notification settings - Fork 268
179 lines (156 loc) · 5.55 KB
/
Copy pathdeb-package.yml
File metadata and controls
179 lines (156 loc) · 5.55 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
name: Build .deb Packages
on:
push:
tags:
- "v*"
pull_request:
branches:
- main
paths:
- ".github/workflows/deb-package.yml"
- "CMakeLists.txt"
- "cmake/**"
workflow_dispatch:
inputs:
tag:
description: "Release tag (e.g. v1.2.3) — leave blank to build a test package"
required: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-deb:
name: Build .deb (${{ matrix.distro.label }})
runs-on: ubuntu-latest
container:
image: ${{ matrix.distro.image }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
distro:
- label: ubuntu-22.04
image: ubuntu:22.04
codename: jammy
qt_svg_pkg: libqt6svg6-dev
- label: ubuntu-24.04
image: ubuntu:24.04
codename: noble
qt_svg_pkg: qt6-svg-dev
- label: debian-12
image: debian:bookworm
codename: bookworm
qt_svg_pkg: qt6-svg-dev
steps:
- name: Resolve tag
id: meta
shell: bash
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
INPUT_TAG: ${{ inputs.tag }}
GITHUB_REF_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
TAG=""
IS_RELEASE="false"
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" && -n "${INPUT_TAG:-}" ]]; then
TAG="$INPUT_TAG"
elif [[ "$GITHUB_EVENT_NAME" == "push" && "$GITHUB_REF_NAME" =~ ^v[0-9]+(\.[0-9]+)*$ ]]; then
TAG="$GITHUB_REF_NAME"
fi
if [[ -n "$TAG" ]]; then
if ! [[ "$TAG" =~ ^v[0-9]+(\.[0-9]+)*$ ]]; then
echo "Tag '$TAG' does not match expected format (e.g. v1.2.3)." >&2
exit 1
fi
VERSION="${TAG#v}"
IS_RELEASE="true"
else
VERSION="0.0.0~test"
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "version_tag=v${VERSION}" >> "$GITHUB_OUTPUT"
echo "is_release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
echo "package=vicinae_${VERSION}_${{ matrix.distro.codename }}_amd64.deb" >> "$GITHUB_OUTPUT"
- name: Install git
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get update -y
apt-get install -y --no-install-recommends git ca-certificates
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.meta.outputs.tag || github.sha }}
- name: Install build dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
apt-get install -y --no-install-recommends \
build-essential cmake ninja-build pkg-config curl \
libssl-dev libxml2-dev libminizip-dev libwayland-dev \
qt6-base-dev qt6-base-private-dev qt6-declarative-dev \
${{ matrix.distro.qt_svg_pkg }} qt6-wayland-dev \
libqalculate-dev \
dpkg-dev
- name: Install Node.js
env:
DEBIAN_FRONTEND: noninteractive
run: |
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
- name: Configure CMake
run: |
cmake -S . -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DVICINAE_PROVENANCE=deb_package \
-DVICINAE_GIT_TAG=${{ steps.meta.outputs.version_tag }} \
-DUSE_SYSTEM_PROTOBUF=OFF \
-DUSE_SYSTEM_ABSEIL=OFF \
-DUSE_SYSTEM_CMARK_GFM=OFF \
-DUSE_SYSTEM_LAYER_SHELL=OFF \
-DUSE_SYSTEM_KF6=OFF \
-DUSE_SYSTEM_QT_KEYCHAIN=OFF \
-DCMAKE_INSTALL_PREFIX=/usr
- name: Build
run: cmake --build build --parallel $(nproc)
- name: Package with CPack
run: |
cd build
cpack -G DEB -D CPACK_PACKAGE_FILE_NAME="${{ steps.meta.outputs.package }}"
- name: Verify .deb package
shell: bash
run: |
set -euo pipefail
DEB="build/${{ steps.meta.outputs.package }}"
echo "=== Checking package file ==="
test -s "$DEB" || { echo "ERROR: .deb file not found or empty: $DEB" >&2; exit 1; }
ls -lh "$DEB"
echo "=== Package metadata ==="
dpkg-deb --info "$DEB"
echo "=== Package contents ==="
dpkg-deb --contents "$DEB"
echo "=== Installing package ==="
apt-get install -y --no-install-recommends "./$DEB"
echo "=== Verifying installed files ==="
test -x /usr/bin/vicinae \
|| { echo "ERROR: /usr/bin/vicinae not found after install" >&2; exit 1; }
echo "OK: /usr/bin/vicinae is present"
test -x /usr/libexec/vicinae/vicinae-server \
|| { echo "ERROR: /usr/libexec/vicinae/vicinae-server not found after install" >&2; exit 1; }
echo "OK: /usr/libexec/vicinae/vicinae-server is present"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.package }}
path: build/${{ steps.meta.outputs.package }}
- name: Upload to GitHub Release
if: steps.meta.outputs.is_release == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.tag }}
files: build/${{ steps.meta.outputs.package }}