Skip to content

Commit cb110cc

Browse files
author
admin
committed
CI
1 parent c7008eb commit cb110cc

File tree

2 files changed

+64
-67
lines changed

2 files changed

+64
-67
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -13,46 +13,61 @@ on:
1313
env:
1414
CARGO_TERM_COLOR: always
1515
CARGO_INCREMENTAL: 0
16-
RUSTFLAGS: "-D warnings"
17-
RUST_BACKTRACE: 1
16+
RUST_LOG: info
17+
RUST_FLAGS: "-D warnings"
18+
RUST_BACKTRACE: "full"
1819

1920
jobs:
2021

2122
build-linux:
22-
name: build / linux / ffmpeg ${{ matrix.ffmpeg_version }}
23+
name: build / linux / ffmpeg+opencv+pytorch
2324
runs-on: ubuntu-latest
24-
container: jrottenberg/ffmpeg:${{ matrix.ffmpeg_version }}-ubuntu
25-
2625
strategy:
2726
matrix:
2827
include:
29-
- ffmpeg_version: "7.1"
30-
feature: "rsmpeg"
31-
fail-fast: false
28+
- feature: "full,test-tch"
3229

3330
steps:
3431
- name: Checkout
3532
uses: actions/checkout@v4
3633

3734
- name: Install dependencies
3835
run: |
39-
DEBIAN_FRONTEND=noninteractive apt-get update
40-
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential ca-certificates clang curl pkg-config
36+
sudo apt-get update
37+
sudo apt-get install -y \
38+
build-essential \
39+
ca-certificates \
40+
clang \
41+
curl \
42+
pkg-config \
43+
software-properties-common \
44+
wget \
45+
cmake \
46+
python3 \
47+
python3-pip \
48+
python3-dev \
49+
ffmpeg \
50+
libavcodec-dev \
51+
libavdevice-dev \
52+
libavfilter-dev \
53+
libavformat-dev \
54+
libavutil-dev \
55+
libswresample-dev \
56+
libswscale-dev \
57+
libopencv-dev \
58+
python3-opencv
4159
4260
- name: Setup Rust
4361
uses: dtolnay/rust-toolchain@stable
4462

4563
- name: Build
4664
run: cargo build --features ${{ matrix.feature }} --verbose
4765

48-
## TODO: Failed test on linux
49-
# undefined reference to symbol '__tls_get_addr@@GLIBC_2.3'
50-
# collect2: error: ld returned 1 exit status
51-
#- name: Run Test
52-
# run: cargo test --features ${{ matrix.feature }} --verbose -- --nocapture
66+
- name: Run Test
67+
run: cargo test --features ${{ matrix.feature }} --verbose -- --nocapture
5368

5469
build-macos:
55-
name: build / macos / latest ffmpeg
70+
name: build / macos / ffmpeg+opencv+pytorch
5671
runs-on: macos-latest
5772

5873
steps:
@@ -67,7 +82,7 @@ jobs:
6782
uses: dtolnay/rust-toolchain@stable
6883

6984
- name: Build
70-
run: cargo build --verbose
85+
run: cargo build --all-features --verbose
7186

7287
- name: Run Test
7388
run: cargo test --verbose -- --nocapture
@@ -110,51 +125,34 @@ jobs:
110125
#- name: Run Test
111126
# run: cargo test --features ${{ matrix.feature }} --verbose -- --nocapture
112127

113-
test:
128+
fmt:
129+
name: Rustfmt
114130
runs-on: ubuntu-latest
115-
container: jrottenberg/ffmpeg:7.1-ubuntu
116-
strategy:
117-
matrix:
118-
include:
119-
- feature: "rsmpeg"
120-
121131
steps:
122-
- name: Checkout
123-
uses: actions/checkout@v4
124-
125-
- name: Install dependencies
126-
run: |
127-
DEBIAN_FRONTEND=noninteractive apt-get update
128-
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential ca-certificates clang curl pkg-config
129-
130-
# - name: Setup Rust
131-
# uses: dtolnay/rust-toolchain@stable
132-
- name: Setup Rust
133-
uses: dtolnay/rust-toolchain@nightly
134-
135-
- name: Test
136-
run: cargo +nightly test --features ${{ matrix.feature }} --verbose
132+
- uses: actions/checkout@v2
133+
- uses: actions-rs/toolchain@v1
134+
with:
135+
profile: minimal
136+
toolchain: stable
137+
override: true
138+
- run: rustup component add rustfmt
139+
- uses: actions-rs/cargo@v1
140+
with:
141+
command: fmt
142+
args: --all -- --check
137143

138-
lints:
144+
clippy:
145+
name: Clippy
139146
runs-on: ubuntu-latest
140-
container: jrottenberg/ffmpeg:7.1-ubuntu
141-
142147
steps:
143-
- name: Checkout
144-
uses: actions/checkout@v4
145-
146-
- name: Install dependencies
147-
run: |
148-
DEBIAN_FRONTEND=noninteractive apt-get update
149-
DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential ca-certificates clang curl pkg-config
150-
151-
- name: Setup Rust
152-
uses: dtolnay/rust-toolchain@stable
148+
- uses: actions/checkout@v2
149+
- uses: actions-rs/toolchain@v1
153150
with:
154-
components: rustfmt, clippy
155-
156-
- name: Rustfmt
157-
run: cargo fmt --all -- --check
158-
159-
- name: Clippy
160-
run: cargo clippy --all-features -- -D warnings
151+
profile: minimal
152+
toolchain: stable
153+
override: true
154+
- run: rustup component add clippy
155+
- uses: actions-rs/cargo@v1
156+
with:
157+
command: clippy
158+
args: --examples --tests --all-features --all -- -D warnings

Cargo.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
name = 'cv-convert'
33
description = 'Type conversions among famous Rust computer vision libraries'
44
version = '0.25.0'
5-
authors = ['jerry73204 <jerry73204@gmail.com>']
5+
authors = ['jerry73204 <jerry73204@gmail.com>', 'phial3']
66
edition = '2021'
7-
documentation = 'https://docs.rs/cv-convert/'
8-
repository = 'https://github.com/jerry73204/rust-cv-convert.git'
9-
homepage = 'https://github.com/jerry73204/rust-cv-convert/'
7+
documentation = 'https://github.com/phial3/cv-convert'
8+
repository = 'https://github.com/phial3/cv-convert'
9+
homepage = 'https://github.com/phial3/cv-convert'
1010
readme = 'README.md'
1111
license = 'MIT'
1212

13-
[package.metadata.docs.rs]
14-
features = ['docs-only']
15-
1613
[features]
1714
default = [
1815
"image",
@@ -24,11 +21,13 @@ image = ["dep:image"]
2421
ndarray = ["dep:ndarray"]
2522
nalgebra = ["dep:nalgebra"]
2623
imageproc = ["dep:imageproc"]
27-
# 系统依赖库
24+
# sys
2825
tch = ["dep:tch"]
2926
rsmpeg = ["dep:rsmpeg"]
3027
opencv = ["dep:opencv"]
3128
full = ["tch", "rsmpeg", "opencv"]
29+
# test
30+
test-tch = ["tch/download-libtorch"]
3231

3332
[dev-dependencies]
3433
rand = '0.9'

0 commit comments

Comments
 (0)