-
-
Notifications
You must be signed in to change notification settings - Fork 8
201 lines (196 loc) · 8.9 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
on:
push:
branches:
- master
pull_request:
branches:
- master
name: Continuous Integration
jobs:
test:
name: Test Suite ${{ matrix.job.target }} (${{ matrix.job.libcec }})
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
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-latest
target: aarch64-unknown-linux-gnu
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-latest
target: i686-unknown-linux-gnu
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-latest
target: arm-unknown-linux-gnueabi
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-latest
target: mips-unknown-linux-gnu
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-latest
target: mips64-unknown-linux-gnuabi64
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-latest
target: mips64el-unknown-linux-gnuabi64
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-latest
target: mipsel-unknown-linux-gnu
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
use-cross: true
libcec: vendored-libcec
expected_libcec_abi: 6
#
# libcec discovery with pkg config
#
- os: ubuntu-latest
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-latest
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
steps:
- name: Checkout repository
uses: actions/checkout@v2
- if: runner.os == 'Linux'
name: Apt-get update
run: sudo apt-get update -yq
- name: Installing Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: ${{ matrix.job.target }}
override: true
- uses: Swatinem/rust-cache@v2
# 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 -ex
# 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 # re-loads apt sources
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
# NOTE:
- if: runner.os == 'Windows'
name: Install python 3.11.4 with debug binaries
run: |
$arch = '${{ runner.arch }}' -eq 'X86' ? "" : "-amd64"
curl -o python-3.11.4$arch.exe https://www.python.org/ftp/python/3.11.4/python-3.11.4$arch.exe
Start-Process -FilePath "python-3.11.4$arch.exe" -ArgumentList "/quiet Include_debug=1 PrependPath=1 InstallAllUsers=0" -Verb runas -Wait
- name: Cargo test
uses: actions-rs/cargo@v1
env:
EXPECTED_LIBCEC_VERSION_MAJOR: ${{ matrix.job.expected_libcec_abi }}
with:
command: test
use-cross: ${{ matrix.job.use-cross }}
args: --target ${{ matrix.job.target }} -vv
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Rustfmt check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
# need to use cross to setup dependencies
- name: Clippy Check
uses: actions-rs/cargo@v1
with:
use-cross: true
command: clippy
args: -- --target x86_64-unknown-linux-gnu -D warnings
coverage:
name: Code coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Update apt
run: sudo apt-get update -yq
- name: Install dependencies for build and coverage
run: sudo apt-get install libudev-dev libcec6 libcec-dev pkg-config libp8-platform-dev
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
# - name: Run cargo-tarpaulin
# uses: actions-rs/[email protected]
# with:
# args: "--ignore-tests --out Lcov"
# env:
# EXPECTED_LIBCEC_VERSION_MAJOR: 6
# - name: Upload to Coveralls
# # upload only if push
# if: ${{ github.event_name == 'push' }}
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# path-to-lcov: "./lcov.info"