-
Notifications
You must be signed in to change notification settings - Fork 82
148 lines (134 loc) · 4.44 KB
/
rust.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
name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build-linux:
runs-on: ubuntu-latest
env:
DEBIAN_FRONTEND: noninteractive
strategy:
fail-fast: false # don't give up on the whole matrix if one variant fails
matrix:
linkage: ["static", "shared"]
library: ["hidraw", "libusb"]
steps:
- name: checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y cmake libudev-dev libumockdev-dev umockdev
- name: Build libusb
run: |
git clone https://github.com/libusb/libusb.git ./etc/libusb/
cd ./etc/libusb/
./autogen.sh
make
sudo make install
- name: Build hidapi
run: |
cd ./etc/hidapi/
mkdir ./build/
cd ./build/
cmake ..
make
sudo make install
- name: List pkgconfig definitions
run: grep -RHn ^ /usr/local/lib/pkgconfig
- name: Build
run: cargo build --no-default-features --features linux-${{ matrix.linkage }}-${{ matrix.library }} --verbose
- name: Run tests
run: cargo test --no-default-features --features linux-${{ matrix.linkage }}-${{ matrix.library }} --verbose
- name: Verify package
# TODO: Fix integration of libusb to avoid manual removal of README.md.
run: |
rm -f ./etc/libusb/README.md
cargo package --no-default-features --features linux-${{ matrix.linkage }}-${{ matrix.library }} --verbose
build-linux-native:
runs-on: ubuntu-latest
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y libudev-dev
- name: Build
run: cargo build --no-default-features --features linux-native --verbose
- name: Run tests
run: cargo test --no-default-features --features linux-native --verbose
- name: Verify package
run: cargo package --no-default-features --features linux-native --verbose
build-windows:
runs-on: windows-latest
steps:
- name: checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install rust environment
run: |
curl.exe --proto "=https" --tlsv1.2 -L -o rustup-init.exe https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
.\rustup-init.exe -y
- name: Build
run: cargo build --no-default-features --verbose
- name: Run tests
run: cargo test --no-default-features --verbose
- name: Verify package
run: cargo package --no-default-features --verbose
build-windows-native:
runs-on: windows-latest
steps:
- name: checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install rust environment
run: |
curl.exe --proto "=https" --tlsv1.2 -L -o rustup-init.exe https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe
.\rustup-init.exe -y
- name: Build
run: cargo build --no-default-features --features windows-native --verbose
- name: Run tests
run: cargo test --no-default-features --features windows-native --verbose
- name: Verify package
run: cargo package --no-default-features --features windows-native --verbose
build-macos:
runs-on: macos-latest
steps:
- name: checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install rust environment
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
- name: Build
run: cargo build --no-default-features --verbose
- name: Run tests
run: cargo test --no-default-features --verbose
- name: Verify package
run: cargo package --no-default-features --verbose
fmt-check:
runs-on: ubuntu-latest
env:
DEBIAN_FRONTEND: noninteractive
steps:
- name: checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: fmt check
run: cargo fmt --check