-
-
Notifications
You must be signed in to change notification settings - Fork 18
189 lines (162 loc) · 5.46 KB
/
CI.yml
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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [published]
jobs:
commits:
name: commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: webiny/[email protected]
linter:
name: linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt update && sudo apt install -y libgtk-4-dev libglib2.0-dev
- name: Clippy
run: cargo clippy --all --all-features -- -D warnings
- name: Format
run: cargo fmt --all -- --check
build:
strategy:
fail-fast: false
matrix:
arch: [x86_64, aarch64]
include:
- arch: x86_64
platform: amd64
image: amd64_builder
- arch: aarch64
platform: arm64
image: arm64_builder
name: build ${{ matrix.arch }}
runs-on: ubuntu-latest
needs: linter
permissions: write-all
steps:
- uses: actions/checkout@v4
- name: Set up qemu
uses: docker/setup-qemu-action@v3
- name: Create builder image
run: >
docker build .
--platform linux/${{ matrix.platform }}
-t ${{ matrix.image }}
-f docker/${{ matrix.image }}.Dockerfile
- name: Build project
run: >
docker run --rm
--platform linux/${{ matrix.platform }}
-v ${{ github.workspace }}:/workspace
-w /workspace
${{ matrix.image }}
cargo build --release
- name: Install packaging dependencies
run: >
sudo apt update && sudo apt install -y
build-essential
ruby
ruby-dev
rubygems
rpm
libarchive-tools
- name: Install fpm
run: sudo gem install fpm
- name: Build debian package
run: >
fpm -t deb -p airgorah_${{ matrix.arch }}.deb --architecture ${{ matrix.arch }}
--depends policykit-1
--depends "libgtk-4-1 (>= 4.6.0)"
--depends dbus-x11
--depends wireshark-common
--depends iproute2
--depends mdk4
--depends crunch
- name: Test debian package
run: >
docker run --rm
--platform linux/${{ matrix.platform }}
-v ${{ github.workspace }}:/workspace
-w /workspace
debian:bookworm-slim
sh -c "apt update && apt install -y ./airgorah_${{ matrix.arch }}.deb"
- name: Save debian artifact
uses: actions/upload-artifact@v3
with:
name: airgorah_${{ matrix.arch }}.deb
path: ./airgorah_${{ matrix.arch }}.deb
if-no-files-found: error
- name: Build redhat package
run: >
fpm -t rpm -p airgorah_${{ matrix.arch }}.rpm --architecture ${{ matrix.arch }}
--depends polkit
--depends "gtk4-devel >= 4.6.0"
--depends dbus-x11
--depends wireshark-cli
--depends iproute
- name: Test redhat package
run: >
docker run --rm
--platform linux/${{ matrix.platform }}
-v ${{ github.workspace }}:/workspace
-w /workspace
fedora:38
sh -c "dnf update -y && dnf install -y ./airgorah_${{ matrix.arch }}.rpm"
- name: Save redhat artifact
uses: actions/upload-artifact@v3
with:
name: airgorah_${{ matrix.arch }}.rpm
path: ./airgorah_${{ matrix.arch }}.rpm
if-no-files-found: error
- name: Build archlinux package
run: >
fpm -t pacman -p airgorah_${{ matrix.arch }}.pkg.tar.zst --architecture ${{ matrix.arch }}
--depends polkit
--depends gtk4
--depends dbus
--depends wireshark-cli
--depends iproute2
--depends mdk4
- name: Test archlinux package
run: >
docker run --rm
--platform linux/${{ matrix.platform }}
-v ${{ github.workspace }}:/workspace
-w /workspace
manjarolinux/base:latest
sh -c "pacman -Syu --noconfirm && pacman -U --noconfirm ./airgorah_${{ matrix.arch }}.pkg.tar.zst"
- name: Save archlinux artifact
uses: actions/upload-artifact@v3
with:
name: airgorah_${{ matrix.arch }}.pkg.tar.zst
path: ./airgorah_${{ matrix.arch }}.pkg.tar.zst
if-no-files-found: error
- name: Get release version
id: 'tag'
if: github.event_name == 'release'
run: echo "tag=${{ github.ref_name }}" | sed 's/v//' >> $GITHUB_OUTPUT
- name: Rename packages
if: github.event_name == 'release'
run: |
cp ./airgorah_${{ matrix.arch }}.deb ./airgorah_${{ steps.tag.outputs.tag }}_${{ matrix.arch }}.deb
cp ./airgorah_${{ matrix.arch }}.rpm ./airgorah_${{ steps.tag.outputs.tag }}_${{ matrix.arch }}.rpm
cp ./airgorah_${{ matrix.arch }}.pkg.tar.zst ./airgorah_${{ steps.tag.outputs.tag }}_${{ matrix.arch }}.pkg.tar.zst
- name: Upload packages
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
files: |
./airgorah_${{ steps.tag.outputs.tag }}_${{ matrix.arch }}.deb
./airgorah_${{ steps.tag.outputs.tag }}_${{ matrix.arch }}.rpm
./airgorah_${{ steps.tag.outputs.tag }}_${{ matrix.arch }}.pkg.tar.zst
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}