Skip to content

Commit

Permalink
Add CI (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
fintelia authored Feb 9, 2025
1 parent 773f807 commit 3a3f425
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 3 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Rust CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: build
run: cargo build
- name: test
run: cargo test

test_other_archs:
# github actions does not support 32-bit or big endian systems directly, but
# it does support QEMU. so we install qemu, then build and run the tests in
# an emulated system. NOTE: you can also use this approach to test for big
# endian locally.
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [powerpc-unknown-linux-gnu, i686-unknown-linux-gnu]
steps:
- uses: actions/checkout@v4
- name: Install or use cached cross-rs/cross
uses: baptiste0928/cargo-install@v2
with:
crate: cross
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
key: ${{ matrix.arch }}
- name: Start Docker (required for cross-rs)
run: sudo systemctl start docker
- name: Cross-Run Tests using QEMU
run: cross test --target ${{ matrix.arch }}

rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run rustfmt check
run: cargo fmt -- --check

cargo-deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "image-extras"
version = "0.1.0"
edition = "2024"
edition = "2021"
license = "MIT OR Apache-2.0"
publish = false

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

[features]
default = ["pcx"]
pcx = []
pcx = ["dep:pcx"]

[dependencies]
image = { version = "0.25.5", default-features = false }
pcx = "0.2.4"
pcx = { version = "0.2.4", optional = true }

[dev-dependencies]
image = { version = "0.25.5", default-features = false, features = ["png"] }
Expand Down
37 changes: 37 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# https://embarkstudios.github.io/cargo-deny/

[graph]
targets = [
{ triple = "aarch64-apple-darwin" },
{ triple = "aarch64-linux-android" },
{ triple = "x86_64-apple-darwin" },
{ triple = "x86_64-pc-windows-msvc" },
{ triple = "x86_64-unknown-linux-gnu" },
{ triple = "x86_64-unknown-linux-musl" },
]


[licenses]
confidence-threshold = 0.93
allow = [
"Apache-2.0 WITH LLVM-exception",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"MIT",
"MIT-0",
"MPL-2.0",
"Unicode-DFS-2016",
]


[advisories]
yanked = "deny"
ignore = []


[bans]
multiple-versions = "allow"
wildcards = "allow" # at least until https://github.com/EmbarkStudios/cargo-deny/issues/241 is fixed
deny = []

0 comments on commit 3a3f425

Please sign in to comment.