forked from VOICEVOX/voicevox_core
-
Notifications
You must be signed in to change notification settings - Fork 2
144 lines (139 loc) · 5.08 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
name: test workflow
on:
push:
pull_request:
release:
types:
- published
jobs:
rust-lint:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
components: clippy,rustfmt
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
- uses: Swatinem/rust-cache@v1
- 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
additional-features: ""
- os: windows-2022
additional-features: ""
- os: windows-2019
additional-features: directml
- os: windows-2022
additional-features: directml
- os: macos-11
additional-features: ""
- os: macos-12
additional-features: ""
- os: ubuntu-20.04
additional-features: ""
- os: ubuntu-22.04
additional-features: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
- uses: actions-rs/toolchain@v1
- uses: Swatinem/rust-cache@v1
with:
# cargoのキャッシュが原因でテストが失敗する場合はバージョン部分をカウントアップすること
key: "v2-cargo-test-cache-${{ matrix.additional-features }}-${{ matrix.os }}"
- name: Run cargo test
shell: bash
run: cargo test --features generate-c-header,${{ matrix.additional-features }}
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: build voicevox_core_c_api
run: cargo build -p voicevox_core_c_api --features generate-c-header
- name: 必要なfileをunix用exampleのディレクトリに移動させる
run: |
cp -v target/core.h example/cpp/unix/
cp -v target/debug/libcore.{so,dylib} example/cpp/unix/ || true
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.so.* example/cpp/unix/ || true
cp -v target/debug/build/onnxruntime-sys-*/out/onnxruntime_*/onnxruntime-*/lib/libonnxruntime.*.dylib example/cpp/unix/ || 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@v2
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