Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/224-add-width-height-options
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikachu2333 committed Aug 20, 2024
2 parents 693ea46 + 911d173 commit b32704d
Show file tree
Hide file tree
Showing 10 changed files with 225 additions and 60 deletions.
40 changes: 33 additions & 7 deletions .github/workflows/rimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ jobs:

- uses: Swatinem/rust-cache@v2

- name: install rust toolchain
uses: actions-rs/toolchain@v1
- name: install rust toolchain (rust-toolchain-reborn)
uses: crusty-pie/toolchain@v1.0.8
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
targets: ${{ matrix.target }}

- uses: ilammy/setup-nasm@v1

Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:

- name: build
if: matrix.target != 'wasm32-unknown-emscripten'
run: cargo build --all-features --release
run: cargo build -r --all-features

- name: run tests
if: matrix.target != 'wasm32-unknown-emscripten'
Expand All @@ -157,13 +157,39 @@ jobs:
CXX: "emcc"

- name: upload cli binary as artifact
uses: actions/upload-artifact@v3
if: matrix.target != 'wasm32-unknown-emscripten'
uses: actions/upload-artifact@v4
with:
name: rimage binary (${{ matrix.target }})
path: |
target/${{ env.CARGO_BUILD_TARGET }}/release/rimage
target/${{ env.CARGO_BUILD_TARGET }}/release/rimage.exe
if-no-files-found: error
compression-level: 0

- name: add summary
if: success()
shell: pwsh
run: |
$NeedZone1 = [Int16]2
$NeedZone2 = [Int16]8
$OutputFormat = "%Y-%m-%d_%H:%M:%S"
$NowTime = [UInt32](Get-Date -UFormat "%s")
$Zone = [Int16](Get-Date -UFormat "%Z").ToString()
$NeedTime1 = ($NeedZone1 - $Zone) * 60 * 60
$NeedTime2 = ($NeedZone2 - $Zone) * 60 * 60
$Result1 = $NowTime + $NeedTime1
$Result2 = $NowTime + $NeedTime2
$Formated1 = (Get-Date -UnixTimeSeconds $Result1 -UFormat $OutputFormat).ToString()
$Formated2 = (Get-Date -UnixTimeSeconds $Result2 -UFormat $OutputFormat).ToString()
$summary = "
Completion time : $Formated1 (GMT+02:00)
文件编译完成时间: $Formated2 (GMT+08:00)
"
echo $summary >> $Env:GITHUB_STEP_SUMMARY
lint:
name: lint
runs-on: ubuntu-latest
Expand All @@ -178,8 +204,8 @@ jobs:
- uses: Swatinem/rust-cache@v2

- name: setup rust toolchain
uses: actions-rs/toolchain@v1
- name: install rust toolchain (rust-toolchain-reborn)
uses: crusty-pie/toolchain@v1.0.8
with:
profile: minimal
toolchain: stable
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@

# code coverage
lcov.info

# self build scrpits
*.ps1
*.log
46 changes: 33 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 68 additions & 28 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,64 @@
[package]
name = "rimage"
version = "0.11.0-next.2"
edition = "2021"
description = "Optimize images natively with best-in-class codecs"
license = "MIT OR Apache-2.0"
readme = "README.md"
authors = ["Vladyslav Vladinov <vladinov.dev@gmail.com>"]
keywords = ["image", "compression", "encoder"]
categories = ["compression", "multimedia::images"]
repository = "https://github.com/SalOne22/rimage"
name = "rimage"
version = "0.11.0-next.2"
edition = "2021"
description = "Optimize images natively with best-in-class codecs"
license = "MIT OR Apache-2.0"
readme = "README.md"
authors = ["Vladyslav Vladinov <vladinov.dev@gmail.com>"]
keywords = ["image", "compression", "encoder"]
categories = ["compression", "multimedia::images"]
repository = "https://github.com/SalOne22/rimage"
documentation = "https://docs.rs/rimage"
homepage = "https://lib.rs/rimage"
include = ["/README.md", "/Cargo.toml", "/src/**/*.rs"]
homepage = "https://lib.rs/rimage"
include = ["/README.md", "/Cargo.toml", "/src/**/*.rs"]
build = "build.rs"

[package.metadata.winres]
LegalCopyright = "Copyright Vladyslav Vladinov © 2024"
FileDescription = "Powerful img optimization CLI tool by Rust"

[build-dependencies]
winres = { version = "0.1.12", default-features = false }

[profile.release]
lto = true
lto = true
codegen-units = 1
strip = true
strip = true
panic = "abort"

[[bin]]
name = "rimage"
path = "./src/main.rs"
name = "rimage"
path = "./src/main.rs"
required-features = ["build-binary"]

[features]
default = ["resize", "quantization", "mozjpeg", "oxipng", "webp", "avif", "tiff", "threads", "metadata"]
default = [
"resize",
"quantization",
"mozjpeg",
"oxipng",
"webp",
"avif",
"tiff",
"threads",
"metadata",
]

# Used for binary
build-binary = ["dep:anyhow", "dep:clap", "dep:indoc", "dep:rayon", "dep:pretty_env_logger", "dep:zune-imageprocs", "dep:glob", "zune-image/default", "dep:indicatif", "dep:indicatif-log-bridge", "dep:console"]
build-binary = [
"dep:anyhow",
"dep:clap",
"dep:indoc",
"dep:rayon",
"dep:pretty_env_logger",
"dep:zune-imageprocs",
"dep:glob",
"zune-image/default",
"dep:indicatif",
"dep:indicatif-log-bridge",
"dep:console",
]

# Enables utilization of threads
threads = ["imagequant?/threads", "mozjpeg?/parallel", "oxipng?/parallel"]
Expand All @@ -48,22 +79,29 @@ webp = ["dep:webp"]
# Enables avif codec
avif = ["dep:ravif", "dep:libavif", "dep:rgb"]
# Enables tiff codec
tiff = ["dep:tiff"]
icc = ["dep:lcms2"]
tiff = ["dep:tiff"]
icc = ["dep:lcms2"]
console = ["dep:console"]

[dependencies]
zune-core = "0.5.0-rc1"
zune-core = "0.5.0-rc2"
log = "0.4.22"
zune-image = { version = "0.5.0-rc0", default-features = false }
fast_image_resize = { version = "3.0.4", optional = true }
imagequant = { version = "4.3.1", default-features = false, optional = true }
rgb = { version = "0.8.44", optional = true }
mozjpeg = { version = "0.10.7", default-features = false, features = ["with_simd"], optional = true }
oxipng = { version = "9.1", default-features = false, features = ["zopfli", "filetime"], optional = true }
rgb = { version = "0.8.45", optional = true }
mozjpeg = { version = "0.10.9", default-features = false, features = [
"with_simd",
], optional = true }
oxipng = { version = "9.1", default-features = false, features = [
"zopfli",
"filetime",
], optional = true }
webp = { version = "0.3.0", default-features = false, optional = true }
ravif = { version = "0.11.8", optional = true }
libavif = { version = "0.14.0", default-features = false, features = ["codec-aom"], optional = true }
libavif = { version = "0.14.0", default-features = false, features = [
"codec-aom",
], optional = true }
lcms2 = { version = "6.1.0", optional = true }
tiff = { version = "0.9.1", default-features = false, optional = true }

Expand All @@ -73,15 +111,17 @@ clap = { version = "4.5.9", features = ["cargo", "string"], optional = true }
indoc = { version = "2.0.5", optional = true }
pretty_env_logger = { version = "0.5.0", optional = true }
rayon = { version = "1.10.0", optional = true }
zune-imageprocs = { version = "0.5.0-rc0", features = ["exif"], optional = true }
zune-imageprocs = { version = "0.5.0-rc0", features = [
"exif",
], optional = true }
kamadak-exif = { version = "0.5.5", optional = true }
indicatif = { version = "0.17.8", features = ["rayon"], optional = true }
indicatif-log-bridge = { version = "0.2.2", optional = true}
indicatif-log-bridge = { version = "0.2.2", optional = true }
console = { version = "0.15.8", optional = true }

[target.'cfg(windows)'.dependencies]
glob = { version = "0.3.1", optional = true }

[dev-dependencies]
zune-core = { version = "0.5.0-rc1", features = ["std"] }
zune-core = { version = "0.5.0-rc2", features = ["std"] }
zune-image = "0.5.0-rc0"
Loading

0 comments on commit b32704d

Please sign in to comment.