-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (72 loc) · 2.77 KB
/
rust_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
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
name: Rust Cross-Compilation
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu # Linux x86_64
- i686-unknown-linux-gnu # Linux x86
- aarch64-unknown-linux-gnu # Linux ARM64
- arm-unknown-linux-gnueabihf # Linux ARMv7
# - x86_64-apple-darwin # macOS x86_64
# - aarch64-apple-darwin # macOS ARM64 (Apple Silicon)
# Add other targets as needed
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Install ARM cross-compilation tools for aarch64
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get install -y binutils-aarch64-linux-gnu
- name: Install ARM cross-compilation tools for armv7
if: matrix.target == 'arm-unknown-linux-gnueabihf'
run: sudo apt-get install -y binutils-arm-linux-gnueabihf
- name: Install cross
run: cargo install cross
- name: Build with cross
run: cross build --target ${{ matrix.target }} --release
- name: Check executable format
run: file target/${{ matrix.target }}/release/cbor
- name: Copy License
run: cp LICENSE target/${{ matrix.target }}/release/
- name: Compress Binary and License
run: tar -czvf cbor-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release cbor LICENSE
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cbor-${{ matrix.target }}
path: cbor-${{ matrix.target }}.tar.gz
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Create Debian Package
run: cargo deb --target ${{ matrix.target }} --no-build
- name: Install GPG and dpkg-sig
run: |
sudo apt-get update
sudo apt-get install -y gnupg dpkg-sig
- name: Import GPG Key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --import --no-tty --batch --yes
- name: Sign Debian packages
run: dpkg-sig --sign builder target/${{ matrix.target }}/debian/*.deb
- name: Install lintian
run: sudo apt-get install -y lintian
- name: Lint .deb package
run: lintian target/${{ matrix.target }}/debian/*.deb
- name: List contents of .deb package
run: dpkg -c target/${{ matrix.target }}/debian/*.deb
- name: Upload Debian Package
uses: actions/upload-artifact@v4
with:
name: cbor-${{ matrix.target }}.deb
path: target/${{ matrix.target }}/debian/*.deb