Skip to content

Commit 3a3f425

Browse files
authored
Add CI (#3)
1 parent 773f807 commit 3a3f425

File tree

3 files changed

+104
-3
lines changed

3 files changed

+104
-3
lines changed

.github/workflows/rust.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Rust CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: dtolnay/rust-toolchain@stable
15+
- name: Cache Cargo Dependencies
16+
uses: Swatinem/rust-cache@v2
17+
with:
18+
cache-on-failure: true
19+
- name: build
20+
run: cargo build
21+
- name: test
22+
run: cargo test
23+
24+
test_other_archs:
25+
# github actions does not support 32-bit or big endian systems directly, but
26+
# it does support QEMU. so we install qemu, then build and run the tests in
27+
# an emulated system. NOTE: you can also use this approach to test for big
28+
# endian locally.
29+
runs-on: ubuntu-latest
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
arch: [powerpc-unknown-linux-gnu, i686-unknown-linux-gnu]
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: Install or use cached cross-rs/cross
37+
uses: baptiste0928/cargo-install@v2
38+
with:
39+
crate: cross
40+
- name: Cache Cargo Dependencies
41+
uses: Swatinem/rust-cache@v2
42+
with:
43+
cache-on-failure: true
44+
key: ${{ matrix.arch }}
45+
- name: Start Docker (required for cross-rs)
46+
run: sudo systemctl start docker
47+
- name: Cross-Run Tests using QEMU
48+
run: cross test --target ${{ matrix.arch }}
49+
50+
rustfmt:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
- uses: dtolnay/rust-toolchain@stable
55+
with:
56+
components: rustfmt
57+
- name: Run rustfmt check
58+
run: cargo fmt -- --check
59+
60+
cargo-deny:
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v4
64+
- uses: EmbarkStudios/cargo-deny-action@v1

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
[package]
22
name = "image-extras"
33
version = "0.1.0"
4-
edition = "2024"
4+
edition = "2021"
55
license = "MIT OR Apache-2.0"
66
publish = false
77

88
include = ["src", "tests/reference.rs"]
99

1010
[features]
1111
default = ["pcx"]
12-
pcx = []
12+
pcx = ["dep:pcx"]
1313

1414
[dependencies]
1515
image = { version = "0.25.5", default-features = false }
16-
pcx = "0.2.4"
16+
pcx = { version = "0.2.4", optional = true }
1717

1818
[dev-dependencies]
1919
image = { version = "0.25.5", default-features = false, features = ["png"] }

deny.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# https://embarkstudios.github.io/cargo-deny/
2+
3+
[graph]
4+
targets = [
5+
{ triple = "aarch64-apple-darwin" },
6+
{ triple = "aarch64-linux-android" },
7+
{ triple = "x86_64-apple-darwin" },
8+
{ triple = "x86_64-pc-windows-msvc" },
9+
{ triple = "x86_64-unknown-linux-gnu" },
10+
{ triple = "x86_64-unknown-linux-musl" },
11+
]
12+
13+
14+
[licenses]
15+
confidence-threshold = 0.93
16+
allow = [
17+
"Apache-2.0 WITH LLVM-exception",
18+
"Apache-2.0",
19+
"BSD-2-Clause",
20+
"BSD-3-Clause",
21+
"MIT",
22+
"MIT-0",
23+
"MPL-2.0",
24+
"Unicode-DFS-2016",
25+
]
26+
27+
28+
[advisories]
29+
yanked = "deny"
30+
ignore = []
31+
32+
33+
[bans]
34+
multiple-versions = "allow"
35+
wildcards = "allow" # at least until https://github.com/EmbarkStudios/cargo-deny/issues/241 is fixed
36+
deny = []
37+

0 commit comments

Comments
 (0)