-
Notifications
You must be signed in to change notification settings - Fork 4
152 lines (147 loc) · 4.72 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
on: [push, pull_request]
name: CI
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Install linux dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-check-stable-${{ hashFiles('**/Cargo.toml', './Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: check
args: --all-features
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Install linux dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-test-stable-${{ hashFiles('**/Cargo.toml', './Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
clippy:
name: Clippy
if: ${{ false }} # Always skip job (for now)
runs-on: ubuntu-latest
steps:
- name: Install linux dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/
target/
key: ${{ runner.os }}-cargo-clippy-stable-${{ hashFiles('**/Cargo.toml', './Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
build:
name: Build (${{ matrix.osname }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
osname: "osx-x64"
- os: ubuntu-latest
osname: "linux-x64"
- os: windows-latest
osname: "win-x64"
- os: windows-latest
osname: "win-x86"
toolchain: "stable-i686-pc-windows-msvc"
env:
ZIP_NAME: ${{ github.event.repository.name }}-ci-${{ github.sha }}-${{ matrix.osname }}
BIN_PATH: ./target/release
OUTPUT_PATH: ./build
steps:
- name: Install linux dependencies
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt-get update
sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev
sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/
target/
key: ${{ matrix.osname }}-cargo-build-stable-${{ hashFiles('**/Cargo.toml', './Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain || 'stable' }}
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --bins --all-features
- name: Create output directory and copy licenses
shell: bash
run: |
mkdir -p $OUTPUT_PATH
cp -f ./LICENSE $OUTPUT_PATH/LICENSE
cp -f ./README.md $OUTPUT_PATH/README.md
- name: Copy executables to output directory
shell: bash
run: |
for exe in $(find $BIN_PATH -maxdepth 1 -type f ${{ matrix.os == 'macos-latest' && '-perm +0111' || '-executable' }} -print); do
cp -f $exe $OUTPUT_PATH/$(basename $exe)
done
- uses: actions/upload-artifact@v3
with:
name: ${{ env.ZIP_NAME }}
path: ${{ env.OUTPUT_PATH }}/*