-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (50 loc) · 1.64 KB
/
build.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
name: Build and Package
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- amd64
- arm64
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up QEMU for cross-compilation
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and package
run: |
docker run --rm --platform linux/${{ matrix.arch }} \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
gcc:11-bullseye \
bash -c "
apt-get update && apt-search libpaho && apt-get install -y \
cmake \
pkg-config \
build-essential \
libpaho-mqtt-dev \
libpaho-mqttpp-dev \
libboost-all-dev \
libjsoncpp-dev \
dpkg-dev
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
make install DESTDIR=package
cd package && dpkg-deb --build . ../homed_exporter_${{ github.sha }}_${{ matrix.arch }}.deb
"
- name: Upload Debian package
uses: actions/upload-artifact@v2
with:
name: homed_exporter_${{ github.sha }}_${{ matrix.arch }}.deb
path: homed_exporter_${{ github.sha }}_${{ matrix.arch }}.deb