-
-
Notifications
You must be signed in to change notification settings - Fork 3
247 lines (242 loc) · 11.3 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master
name: Continuous Integration
jobs:
test:
name: Test Suite ${{ matrix.job.target }} (${{ matrix.job.libcec }} pkg-config=${{ matrix.job.pkg-config || false }})
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
rust: [stable]
job:
- os: windows-latest
target: x86_64-pc-windows-msvc
use-cross: false
libcec: vendored-libcec
expected_libcec_abi: 6
- os: windows-latest
target: i686-pc-windows-msvc
use-cross: false
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-22.04
target: i686-unknown-linux-gnu
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-22.04
target: arm-unknown-linux-gnueabi
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-22.04
target: armv7-unknown-linux-gnueabihf
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-22.04
target: mips-unknown-linux-gnu
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-22.04
target: mips64-unknown-linux-gnuabi64
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-22.04
target: mips64el-unknown-linux-gnuabi64
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-22.04
target: mipsel-unknown-linux-gnu
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
use-cross: false # Not run in cross so that EXPECTED_LIBCEC_VERSION_MAJOR shows inside the test
libcec: vendored-libcec
expected_libcec_abi: 6
#
# libcec discovery with pkg config
#
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
use-cross: false # Important that we do not run cross so package install shows up
libcec: "libcec4"
libcec-dev: "libcec-dev=4*"
pkg-config: true
expected_libcec_abi: 4
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
use-cross: false # Important that we do not run cross so package install shows up
libcec: "libcec6"
libcec-dev: "libcec-dev=6*"
pkg-config: true
expected_libcec_abi: 6
#
# libcec discovery without pkg config
# We set LD_LIBRARY_PATH and C_INCLUDE_PATH for compiler to find the preinstalled libcec
#
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
use-cross: false # Important that we do not run cross so package install shows up
libcec: "libcec4"
libcec-dev: "libcec-dev=4*"
pkg-config: false
expected_libcec_abi: 4
additional_env:
LD_LIBRARY_PATH: "/usr/lib/x86_64-linux-gnu/"
C_INCLUDE_PATH: "/usr/include/libcec/"
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
use-cross: false # Important that we do not run cross so package install shows up
libcec: "libcec6"
libcec-dev: "libcec-dev=6*"
pkg-config: false
expected_libcec_abi: 6
additional_env:
LD_LIBRARY_PATH: "/usr/lib/x86_64-linux-gnu/"
C_INCLUDE_PATH: "/usr/include/libcec/"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout libcec-sys submodules
run: git -c "url.https://github.com/.insteadOf=git@github.com:" submodule update --init --recursive
- name: Apt-get update
if: runner.os == 'Linux'
run: sudo apt-get update -yq
- name: Installing Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
target: ${{ matrix.job.target }}
override: true
# libcec and p8-platform from apt repo
- if: ${{ !startsWith(matrix.job.libcec, 'vendored') && runner.os == 'Linux' }}
name: Install libcec(-dev) and build dependencies
run: |
set -e
# introduce Ubuntu 20.04 (Focal Fossa) repos as well for easy libcec4 installation
sudo sh -c 'echo "deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse" >> /etc/apt/sources.list'
sudo apt-get update
sudo apt-get install -yq libudev-dev libp8-platform2 libp8-platform-dev
apt show '${{ matrix.job.libcec }}'
sudo apt install -yq '${{ matrix.job.libcec }}'
apt show '${{ matrix.job.libcec-dev }}'
sudo apt install -yq '${{ matrix.job.libcec-dev }}'
# additional build dependencies for non-cross builds with vendored libcec sources
- if: ${{ startsWith(matrix.job.libcec, 'vendored') && !matrix.job.use-cross && runner.os == 'Linux' }}
name: Install libudev-dev for non-cross vendored builds as libcec build dependency
run: sudo apt-get install -yq libudev-dev
# setup developer command prompt for Windows
- if: ${{ startsWith(matrix.job.libcec, 'vendored') && !matrix.job.use-cross && runner.os == 'Windows' }}
name: Setup developer command prompt
uses: ilammy/msvc-dev-cmd@v1
# pkg-config install
- if: ${{ !startsWith(matrix.job.libcec, 'vendored') && matrix.job.pkg-config && runner.os == 'Linux' }}
name: Install pkg-config for utilizing libcec from apt build dependency
run: sudo apt-get install -yq pkg-config
# pkg-config remove
- if: ${{ !startsWith(matrix.job.libcec, 'vendored') && !matrix.job.pkg-config && runner.os == 'Linux' }}
name: Remove pkg-config
run: sudo apt-get remove -yq pkg-config
# install Python with debug binaries for Windows (needed for debug build of vendored libcec)
# Github Workflow runners do not package debug binaries by default
- if: runner.os == 'Windows'
name: Install python 3.10.5 with debug binaries
run: |
$arch = '${{ runner.arch }}' -eq 'X86' ? "" : "-amd64"
curl -o python-3.10.5$arch.exe https://www.python.org/ftp/python/3.10.5/python-3.10.5$arch.exe
Start-Process -FilePath "python-3.10.5$arch.exe" -ArgumentList "/quiet Include_debug=1 PrependPath=1 InstallAllUsers=0" -Verb runas -Wait
- name: Cargo test
env:
EXPECTED_LIBCEC_VERSION_MAJOR: ${{ matrix.job.expected_libcec_abi }}
LD_LIBRARY_PATH: ${{ matrix.job.additional_env.LD_LIBRARY_PATH }}
C_INCLUDE_PATH: ${{ matrix.job.additional_env.C_INCLUDE_PATH }}
uses: actions-rs/cargo@v1
with:
command: test
use-cross: ${{ matrix.job.use-cross }}
toolchain: ${{ matrix.rust }}
args: --target ${{ matrix.job.target }} -vv
rustfmt:
name: Rustfmt
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
# basically git submodule update --init --recursive but replacing git@github.com with https
# for anonymous checkout
run: |
git submodule update --init
git submodule foreach --recursive '
echo "pwd: $(pwd)" ; \
if [ -f .gitmodules ]; then \
( sed -i "s/git@github.com:/https:\/\/github.com\//" .gitmodules \
&& git submodule sync --recursive ) ; \
fi ; \
git submodule update --init \
;'
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
# basically git submodule update --init --recursive but replacing git@github.com with https
# for anonymous checkout
run: |
git submodule update --init
git submodule foreach --recursive '
echo "pwd: $(pwd)" ; \
if [ -f .gitmodules ]; then \
( sed -i "s/git@github.com:/https:\/\/github.com\//" .gitmodules \
&& git submodule sync --recursive ) ; \
fi ; \
git submodule update --init \
;'
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-unknown-linux-gnu
components: clippy
- name: Clippy Check
uses: actions-rs/cargo@v1
with:
use-cross: true
command: clippy
args: -- --target x86_64-unknown-linux-gnu -D warnings