forked from VOICEVOX/voicevox_core
-
Notifications
You must be signed in to change notification settings - Fork 2
166 lines (160 loc) · 5.92 KB
/
test.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
name: test workflow
on:
push:
branches:
- "*"
- "**/*"
pull_request:
jobs:
rust-lint:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
components: clippy,rustfmt
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-features --features onnxruntime/disable-sys-build-script --tests -- -D clippy::all -D warnings --no-deps
- run: cargo clippy --all-features --features onnxruntime/disable-sys-build-script -- -D clippy::all -D warnings --no-deps
- run: cargo fmt -- --check
rust-test:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
features: ""
- os: windows-2022
features: ""
- os: windows-2019
features: directml
- os: windows-2022
features: directml
- os: macos-11
features: ""
- os: macos-12
features: ""
- os: ubuntu-20.04
features: ""
- os: ubuntu-22.04
features: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
- uses: actions-rs/toolchain@v1
- uses: Swatinem/rust-cache@v2
with:
# cargoのキャッシュが原因でテストが失敗する場合はバージョン部分をカウントアップすること
key: "v2-cargo-test-cache-${{ matrix.features }}-${{ matrix.os }}"
- name: Run cargo test
shell: bash
run: cargo test --features ,${{ matrix.features }}
xtask-generate-c-header:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install cbindgen
uses: ./.github/actions/cargo-binstall-cbindgen
- name: Generate voicevox_core_1.h
run: cbindgen --crate voicevox_core_c_api -o ./voicevox_core_1.h
- name: Generate voicevox_core_2.h
run: cargo xtask generate-c-header -o ./voicevox_core_2.h
- name: Assert these header files are same
run: diff -u --color=always ./voicevox_core_{1,2}.h
build-unix-cpp-example:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
artifact_name: osx-x64-cpu-cpp-shared
- os: ubuntu-latest
artifact_name: linux-x64-cpu-cpp-shared
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- name: Install cargo-binstall
uses: taiki-e/install-action@cargo-binstall
- name: Install cbindgen
uses: ./.github/actions/cargo-binstall-cbindgen
- name: build voicevox_core_c_api
run: cargo build -p voicevox_core_c_api
- name: voicevox_core.hを生成
run: cbindgen --crate voicevox_core_c_api -o ./example/cpp/unix/voicevox_core/voicevox_core.h
- name: 必要なfileをunix用exampleのディレクトリに移動させる
run: |
mkdir -p example/cpp/unix/voicevox_core/
cp -v target/debug/libvoicevox_core.{so,dylib} example/cpp/unix/voicevox_core/ || true
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.so.* example/cpp/unix/voicevox_core/ || true
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.*.dylib example/cpp/unix/voicevox_core/ || true
- if: startsWith(matrix.os, 'mac')
uses: jwlawson/[email protected]
- name: Install build dependencies
if: startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y cmake
- name: Build
shell: bash
run: |
cd example/cpp/unix
cmake -S . -B build
cmake --build build
build-python-api:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
- os: macos-latest
- os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
- uses: actions-rs/toolchain@v1
- name: venv作成
shell: bash
run: |
virtual_env="$RUNNER_TEMP"/.venv
python -m venv "$virtual_env"
if [ "$RUNNER_OS" = Windows ]; then
echo "$virtual_env"/Scripts >>"$GITHUB_PATH"
else
echo "$virtual_env"/bin >>"$GITHUB_PATH"
fi
echo "VIRTUAL_ENV=$virtual_env" >>"$GITHUB_ENV"
- shell: bash
run: pip install -r ./crates/voicevox_core_python_api/requirements.txt
- shell: bash
run: cargo build -p voicevox_core_c_api
- shell: bash
run: maturin build --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --locked
- shell: bash
run: maturin develop --manifest-path ./crates/voicevox_core_python_api/Cargo.toml --locked
- name: 必要なDLLをカレントディレクトリにコピー
run: |
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/onnxruntime.dll . || true
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.so.* . || true
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.*.dylib . || true
- name: '`maturin develop`でインストールした`voicevox_core_python_api`を実行'
shell: python
run: import voicevox_core
env:
CARGO_TERM_COLOR: always