Skip to content

Commit 7d741f3

Browse files
committed
Switch from Travis CI to CircleCI
1 parent a05c5ad commit 7d741f3

File tree

4 files changed

+103
-53
lines changed

4 files changed

+103
-53
lines changed

.circleci/config.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
version: 2.1
2+
3+
4+
commands:
5+
build_and_test_steps:
6+
description: "Build the library and test it"
7+
steps:
8+
- checkout
9+
- run:
10+
name: Install system dependencies
11+
command: |
12+
case "$(uname -s)" in
13+
Linux*)
14+
apt --quiet update
15+
apt --yes install libgexiv2-dev
16+
;;
17+
Darwin*)
18+
brew install gexiv2 pkg-config
19+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
20+
;;
21+
esac
22+
- run:
23+
name: Show environment info
24+
command: |
25+
rustc --version --verbose && echo ""
26+
cargo --version --verbose && echo ""
27+
case "$(uname -s)" in
28+
Linux*)
29+
dpkg --list libgexiv2-dev libexiv2-dev ;;
30+
Darwin*)
31+
brew list --versions gexiv2 exiv2 ;;
32+
esac
33+
- run:
34+
name: Build
35+
command: cargo build --verbose --all-features
36+
- run:
37+
name: Test
38+
command: cargo test --verbose --all-features
39+
- run:
40+
name: Run Examples
41+
command: |
42+
cargo run --example gps
43+
cargo run --example timestamp
44+
45+
46+
linux_job_config: &linux_job_config
47+
resource_class: small
48+
steps:
49+
- build_and_test_steps
50+
51+
52+
jobs:
53+
linux-msrv:
54+
docker:
55+
- image: rust:1.56-slim
56+
<<: *linux_job_config
57+
linux-stable:
58+
docker:
59+
- image: rust:slim
60+
<<: *linux_job_config
61+
linux-nightly:
62+
docker:
63+
- image: rustlang/rust:nightly-slim
64+
<<: *linux_job_config
65+
osx-stable:
66+
macos:
67+
xcode: "14.0.0"
68+
steps:
69+
- build_and_test_steps
70+
71+
72+
workflows:
73+
build-and-test:
74+
jobs:
75+
- linux-msrv
76+
- linux-stable
77+
- linux-nightly
78+
- osx-stable

.travis.yml

-33
This file was deleted.

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
rexiv2
22
======
33

4-
[![build-badge][]][build] &nbsp;
5-
[![downloads-badge][]][crates-io] &nbsp;
6-
[![version-badge][]][crates-io] &nbsp;
7-
[![license-badge][]][license] &nbsp;
4+
[![build-badge][]][build]&nbsp;
5+
[![downloads-badge][]][crates-io]&nbsp;
6+
[![version-badge][]][crates-io]&nbsp;
7+
[![license-badge][]][license]&nbsp;
88

9-
[build]: https://travis-ci.org/felixc/rexiv2
10-
[build-badge]: https://img.shields.io/travis/felixc/rexiv2.svg
9+
[build]: https://dl.circleci.com/status-badge/redirect/gh/felixc/rexiv2/tree/main
10+
[build-badge]: https://dl.circleci.com/status-badge/img/gh/felixc/rexiv2/tree/main.svg?style=shield
1111
[crates-io]: https://crates.io/crates/rexiv2
1212
[downloads-badge]: https://img.shields.io/crates/d/rexiv2.svg
1313
[version-badge]: https://img.shields.io/crates/v/rexiv2.svg

tst/main.rs

+19-14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// You should have received a copy of the GNU General Public License
1414
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1515

16+
extern crate gexiv2_sys as gexiv2;
1617
extern crate rexiv2;
1718

1819
use std::path::Path;
@@ -22,36 +23,36 @@ use std::sync::Once;
2223
static INIT: Once = Once::new();
2324

2425
/// Should be called before any test runs. Will ensure that the library is initialized at most once.
25-
fn setup_test() {
26+
fn test_setup() {
2627
INIT.call_once(|| rexiv2::initialize().expect("Unable to initialize rexiv2"));
2728
}
2829

2930
#[test]
3031
fn new_from_str_path() {
31-
setup_test();
32+
test_setup();
3233
let sample_path = concat!(env!("CARGO_MANIFEST_DIR"), "/tst/sample.png");
3334
let meta = rexiv2::Metadata::new_from_path(sample_path).unwrap();
3435
assert_eq!(meta.get_media_type().unwrap(), rexiv2::MediaType::Png);
3536
}
3637

3738
#[test]
3839
fn new_from_path() {
39-
setup_test();
40+
test_setup();
4041
let sample_path = Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/tst/sample.png"));
4142
let meta = rexiv2::Metadata::new_from_path(sample_path).unwrap();
4243
assert_eq!(meta.get_media_type().unwrap(), rexiv2::MediaType::Png);
4344
}
4445

4546
#[test]
4647
fn new_from_buffer() {
47-
setup_test();
48+
test_setup();
4849
let meta = rexiv2::Metadata::new_from_buffer(include_bytes!("sample.png")).unwrap();
4950
assert_eq!(meta.get_media_type().unwrap(), rexiv2::MediaType::Png);
5051
}
5152

5253
#[test]
5354
fn new_from_buffer_error() {
54-
setup_test();
55+
test_setup();
5556
let mut bytes = include_bytes!("sample.png").to_vec();
5657
bytes.swap(0, 1);
5758
let meta_result = rexiv2::Metadata::new_from_buffer(&bytes);
@@ -65,31 +66,35 @@ fn new_from_buffer_error() {
6566

6667
#[test]
6768
fn supports_exif() {
68-
setup_test();
69+
test_setup();
6970
let meta = rexiv2::Metadata::new_from_buffer(include_bytes!("sample.png")).unwrap();
7071
assert_eq!(meta.supports_exif(), true);
7172
}
7273

7374
#[test]
7475
fn supports_iptc() {
75-
setup_test();
76+
test_setup();
7677
let meta = rexiv2::Metadata::new_from_buffer(include_bytes!("sample.png")).unwrap();
7778
assert_eq!(meta.supports_iptc(), true);
7879
}
7980

8081
#[test]
8182
fn supports_xmp() {
82-
setup_test();
83+
test_setup();
8384
let meta = rexiv2::Metadata::new_from_buffer(include_bytes!("sample.png")).unwrap();
8485
assert_eq!(meta.supports_xmp(), true);
8586
}
8687

8788
#[test]
8889
fn supports_bmff() {
89-
setup_test();
90-
// iPhone devices use the HEIC (BMFF) file format which only works properly after gexiv2 has been initialized
91-
// (and the underlying libraries are the right version gexiv2 v0.13.0/Exiv2 v0.27.4)
92-
// I copied a photo off an iPhone and shrunk it down to ensure that reading tags works
90+
test_setup();
91+
92+
// iPhone devices use the HEIC (BMFF) file format which only works properly
93+
// after gexiv2 has been initialized (and the underlying libraries are the
94+
// right version gexiv2 v0.13.0/Exiv2 v0.27.4)
95+
if unsafe { gexiv2::gexiv2_get_version() } < 1300 {
96+
return;
97+
}
9398

9499
let meta = rexiv2::Metadata::new_from_buffer(include_bytes!("sample.HEIC")).unwrap();
95100
let gps = meta.get_gps_info().unwrap();
@@ -107,7 +112,7 @@ fn supports_bmff() {
107112

108113
#[test]
109114
fn log_levels() {
110-
setup_test();
115+
test_setup();
111116
assert_eq!(rexiv2::get_log_level(), rexiv2::LogLevel::WARN);
112117
rexiv2::set_log_level(rexiv2::LogLevel::INFO);
113118
assert_eq!(rexiv2::get_log_level(), rexiv2::LogLevel::INFO);
@@ -116,7 +121,7 @@ fn log_levels() {
116121
#[test]
117122
#[cfg(feature = "raw-tag-access")]
118123
fn get_tag_raw() {
119-
setup_test();
124+
test_setup();
120125
let meta = rexiv2::Metadata::new_from_buffer(include_bytes!("sample.png")).unwrap();
121126
meta.set_tag_string("Exif.Image.DateTime", "2020:07:12 11:16:35")
122127
.unwrap();

0 commit comments

Comments
 (0)