-
Notifications
You must be signed in to change notification settings - Fork 34
166 lines (146 loc) · 4.26 KB
/
build.yaml
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
name: Build
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
/usr/share/rust
~/.cargo
target
key: clippy-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Install required cargo
run: cargo install clippy-sarif sarif-fmt
- name: Run rust-clippy
run:
cargo clippy
--all-features
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
continue-on-error: true
- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: rust-clippy-results.sarif
wait-for-processing: true
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
/usr/share/rust
~/.cargo
target
key: test-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --features=mocks
build:
name: Build ${{ matrix.build }}
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: test
strategy:
matrix:
include:
- build: linux-amd64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- build: linux-arm64
os: ubuntu-latest
packages: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross
openssl: true
target: aarch64-unknown-linux-gnu
gcc: aarch64-linux-gnu-gcc
machine: aarch64
arch: aarch64
- build: linux-arm-v7
os: ubuntu-latest
packages: gcc-arm-linux-gnueabihf libc6-dev-armel-cross
openssl: true
target: armv7-unknown-linux-gnueabihf
gcc: arm-linux-gnueabihf-gcc
machine: arm
arch: arm
- build: darwin-amd64
os: macos-11
target: x86_64-apple-darwin
- build: darwin-arm64
os: macos-11
target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
/usr/share/rust
~/.cargo
~/openssl-1.1.1l
target
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install packages
if: matrix.packages
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.packages }}
- name: Build OpenSSL
if: matrix.openssl
run: |
cd ~
wget https://www.openssl.org/source/openssl-1.1.1l.tar.gz
tar xzf openssl-1.1.1l.tar.gz
export MACHINE=${{ matrix.machine }}
export ARCH=${{ matrix.arch }}
export CC=${{ matrix.gcc }}
cd openssl-1.1.1l && ./config shared && make
echo OPENSSL_LIB_DIR=~/openssl-1.1.1l >>$GITHUB_ENV
echo OPENSSL_INCLUDE_DIR=~/openssl-1.1.1l/include >>$GITHUB_ENV
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Build release binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Rename release binary
run: |
mv target/${{ matrix.target }}/release/lxp-bridge lxp-bridge.${{ matrix.build }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: lxp-bridge.${{ matrix.build }}
path: lxp-bridge.${{ matrix.build }}