Bump edition to 2021, along with min rust version
This commit is contained in:
parent
ece9787822
commit
faf10c64a9
6 changed files with 117 additions and 125 deletions
144
.github/workflows/oxipng.yml
vendored
144
.github/workflows/oxipng.yml
vendored
|
|
@ -13,80 +13,80 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
target:
|
||||
- x86_64-unknown-linux-gnu
|
||||
- x86_64-unknown-linux-musl
|
||||
- x86_64-pc-windows-msvc
|
||||
- x86_64-apple-darwin
|
||||
- x86_64-unknown-linux-gnu
|
||||
- x86_64-unknown-linux-musl
|
||||
- x86_64-pc-windows-msvc
|
||||
- x86_64-apple-darwin
|
||||
toolchain:
|
||||
# Minimum stable
|
||||
- "1.46.0"
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
# Minimum stable
|
||||
- "1.56.0"
|
||||
- stable
|
||||
- beta
|
||||
- nightly
|
||||
include:
|
||||
- target: x86_64-unknown-linux-gnu
|
||||
os: ubuntu-latest
|
||||
- target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
- target: x86_64-pc-windows-msvc
|
||||
os: windows-latest
|
||||
- target: x86_64-apple-darwin
|
||||
os: macOS-latest
|
||||
- target: x86_64-unknown-linux-gnu
|
||||
os: ubuntu-latest
|
||||
- target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
- target: x86_64-pc-windows-msvc
|
||||
os: windows-latest
|
||||
- target: x86_64-apple-darwin
|
||||
os: macOS-latest
|
||||
exclude:
|
||||
- target: x86_64-pc-windows-msvc
|
||||
toolchain: beta
|
||||
- target: x86_64-pc-windows-msvc
|
||||
toolchain: nightly
|
||||
- target: x86_64-apple-darwin
|
||||
toolchain: beta
|
||||
- target: x86_64-apple-darwin
|
||||
toolchain: nightly
|
||||
- target: x86_64-unknown-linux-musl
|
||||
toolchain: beta
|
||||
- target: x86_64-unknown-linux-musl
|
||||
toolchain: nightly
|
||||
- target: x86_64-pc-windows-msvc
|
||||
toolchain: beta
|
||||
- target: x86_64-pc-windows-msvc
|
||||
toolchain: nightly
|
||||
- target: x86_64-apple-darwin
|
||||
toolchain: beta
|
||||
- target: x86_64-apple-darwin
|
||||
toolchain: nightly
|
||||
- target: x86_64-unknown-linux-musl
|
||||
toolchain: beta
|
||||
- target: x86_64-unknown-linux-musl
|
||||
toolchain: nightly
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install musl tools
|
||||
run: sudo apt-get install musl-tools
|
||||
if: "contains(matrix.target, 'musl')"
|
||||
- name: Install ${{ matrix.toolchain }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
override: true
|
||||
components: clippy, rustfmt
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/registry/cache
|
||||
key: ${{ matrix.target }}-${{ matrix.toolchain }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ matrix.target }}-${{ matrix.toolchain }}-cargo-registry-
|
||||
- name: Run rustfmt
|
||||
if: matrix.toolchain == 'stable'
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: -- --check
|
||||
- name: Run clippy
|
||||
if: matrix.toolchain == 'stable'
|
||||
uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: -- -D warnings
|
||||
- name: Run tests
|
||||
run: cargo test
|
||||
- name: Build benchmarks
|
||||
if: matrix.toolchain == 'nightly'
|
||||
run: cargo bench --no-run
|
||||
- name: Build docs
|
||||
run: cargo doc --no-deps
|
||||
- name: Check no default features
|
||||
if: matrix.toolchain == 'stable'
|
||||
uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --no-default-features -- -D warnings
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install musl tools
|
||||
run: sudo apt-get install musl-tools
|
||||
if: "contains(matrix.target, 'musl')"
|
||||
- name: Install ${{ matrix.toolchain }}
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: ${{ matrix.toolchain }}
|
||||
override: true
|
||||
components: clippy, rustfmt
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/registry/cache
|
||||
key: ${{ matrix.target }}-${{ matrix.toolchain }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ matrix.target }}-${{ matrix.toolchain }}-cargo-registry-
|
||||
- name: Run rustfmt
|
||||
if: matrix.toolchain == 'stable'
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: -- --check
|
||||
- name: Run clippy
|
||||
if: matrix.toolchain == 'stable'
|
||||
uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: -- -D warnings
|
||||
- name: Run tests
|
||||
run: cargo test
|
||||
- name: Build benchmarks
|
||||
if: matrix.toolchain == 'nightly'
|
||||
run: cargo bench --no-run
|
||||
- name: Build docs
|
||||
run: cargo doc --no-deps
|
||||
- name: Check no default features
|
||||
if: matrix.toolchain == 'stable'
|
||||
uses: actions-rs/clippy-check@v1
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
args: --no-default-features -- -D warnings
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
### Next
|
||||
|
||||
- [Breaking] Bump minimum Rust version to 1.56.0
|
||||
- [Misc] Bump `clap` to 3.0.0
|
||||
- [Misc] Bump `zopfli` to 0.5.0
|
||||
|
||||
|
|
|
|||
|
|
@ -3,15 +3,14 @@ authors = ["Joshua Holmer <jholmer.in@gmail.com>"]
|
|||
categories = ["command-line-utilities", "compression"]
|
||||
description = "A lossless PNG compression optimizer"
|
||||
documentation = "https://docs.rs/oxipng"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
exclude = ["tests/*", "bench/*"]
|
||||
homepage = "https://github.com/shssoichiro/oxipng"
|
||||
license = "MIT"
|
||||
name = "oxipng"
|
||||
repository = "https://github.com/shssoichiro/oxipng"
|
||||
build = "build.rs"
|
||||
version = "5.0.1"
|
||||
rust-version = "1.46.0"
|
||||
rust-version = "1.56.0"
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "shssoichiro/oxipng", branch = "master" }
|
||||
|
|
|
|||
45
README.md
45
README.md
|
|
@ -17,12 +17,14 @@ Oxipng for Windows can be downloaded from the [Releases](https://github.com/shss
|
|||
For MacOS or Linux, it is recommended to install from your distro's package repository, if possible.
|
||||
|
||||
Alternatively, oxipng can be installed from Cargo, via the following command:
|
||||
|
||||
```
|
||||
cargo install oxipng
|
||||
```
|
||||
|
||||
Oxipng can be built from source using the latest stable or nightly Rust.
|
||||
This is primarily useful for developing on oxipng.
|
||||
|
||||
```
|
||||
git clone https://github.com/shssoichiro/oxipng.git
|
||||
cd oxipng
|
||||
|
|
@ -30,7 +32,7 @@ cargo build --release
|
|||
cp target/release/oxipng /usr/local/bin
|
||||
```
|
||||
|
||||
The current minimum supported Rust version is **1.46.0**.
|
||||
The current minimum supported Rust version is **1.56.0**.
|
||||
|
||||
Oxipng follows Semantic Versioning.
|
||||
|
||||
|
|
@ -43,21 +45,22 @@ oxipng -o 4 -i 1 --strip safe *.png
|
|||
```
|
||||
|
||||
The most commonly used options are as follows:
|
||||
* Optimization: `-o 1` through `-o 6`, lower is faster, higher is better compression.
|
||||
The default (`-o 2`) is sufficiently fast on a modern CPU and provides 30-50% compression
|
||||
gains over an unoptimized PNG. `-o 4` is 6 times slower than `-o 2` but can provide 5-10%
|
||||
extra compression over `-o 2`. Using any setting higher than `-o 4` is unlikely
|
||||
to give any extra compression gains and is not recommended.
|
||||
* Interlacing: `-i 1` will enable [Adam7](https://en.wikipedia.org/wiki/Adam7_algorithm)
|
||||
PNG interlacing on any images that are processed. `-i 0` will remove interlacing from all
|
||||
processed images. Not specifying either will keep the same interlacing state as the
|
||||
input image. Note: Interlacing can add 25-50% to the size of an optimized image. Only use
|
||||
it if you believe the benefits outweigh the costs for your use case.
|
||||
* Strip: Used to remove metadata info from processed images. Used via `--strip [safe,all]`.
|
||||
Can save a few kilobytes if you don't need the metadata. "Safe" removes only metadata that
|
||||
will never affect rendering of the image. "All" removes all metadata that is not critical
|
||||
to the image. You can also pass a comma-separated list of specific metadata chunks to remove.
|
||||
`-s` can be used as a shorthand for `--strip safe`.
|
||||
|
||||
- Optimization: `-o 1` through `-o 6`, lower is faster, higher is better compression.
|
||||
The default (`-o 2`) is sufficiently fast on a modern CPU and provides 30-50% compression
|
||||
gains over an unoptimized PNG. `-o 4` is 6 times slower than `-o 2` but can provide 5-10%
|
||||
extra compression over `-o 2`. Using any setting higher than `-o 4` is unlikely
|
||||
to give any extra compression gains and is not recommended.
|
||||
- Interlacing: `-i 1` will enable [Adam7](https://en.wikipedia.org/wiki/Adam7_algorithm)
|
||||
PNG interlacing on any images that are processed. `-i 0` will remove interlacing from all
|
||||
processed images. Not specifying either will keep the same interlacing state as the
|
||||
input image. Note: Interlacing can add 25-50% to the size of an optimized image. Only use
|
||||
it if you believe the benefits outweigh the costs for your use case.
|
||||
- Strip: Used to remove metadata info from processed images. Used via `--strip [safe,all]`.
|
||||
Can save a few kilobytes if you don't need the metadata. "Safe" removes only metadata that
|
||||
will never affect rendering of the image. "All" removes all metadata that is not critical
|
||||
to the image. You can also pass a comma-separated list of specific metadata chunks to remove.
|
||||
`-s` can be used as a shorthand for `--strip safe`.
|
||||
|
||||
More advanced options can be found by running `oxipng -h`.
|
||||
|
||||
|
|
@ -99,17 +102,16 @@ Oxipng is open-source software, distributed under the MIT license.
|
|||
|
||||
Tested oxipng 5.0.0 (compiled on rustc 1.55.0-nightly (7a16cfcff 2021-07-11)) against OptiPNG version 0.7.7 on AMD Ryzen 7 4800H with Radeon Graphics with 16 logical cores
|
||||
|
||||
|
||||
```
|
||||
|
||||
Benchmark #1: ./target/release/oxipng -P ./tests/files/rgb_16_should_be_grayscale_8.png
|
||||
Time (mean ± σ): 128.8 ms ± 14.2 ms [User: 296.0 ms, System: 14.3 ms]
|
||||
Range (min … max): 98.8 ms … 152.3 ms 21 runs
|
||||
|
||||
|
||||
Benchmark #2: optipng -simulate ./tests/files/rgb_16_should_be_grayscale_8.png
|
||||
Time (mean ± σ): 254.2 ms ± 16.0 ms [User: 252.8 ms, System: 1.2 ms]
|
||||
Range (min … max): 208.4 ms … 263.8 ms 14 runs
|
||||
|
||||
|
||||
Summary
|
||||
'./target/release/oxipng -P ./tests/files/rgb_16_should_be_grayscale_8.png' ran
|
||||
1.97 ± 0.25 times faster than 'optipng -simulate ./tests/files/rgb_16_should_be_grayscale_8.png'
|
||||
|
|
@ -119,14 +121,13 @@ Summary
|
|||
Benchmark #1: ./target/release/oxipng -o4 -P ./tests/files/rgb_16_should_be_grayscale_8.png
|
||||
Time (mean ± σ): 141.4 ms ± 14.9 ms [User: 611.7 ms, System: 21.1 ms]
|
||||
Range (min … max): 100.2 ms … 160.4 ms 23 runs
|
||||
|
||||
|
||||
Benchmark #2: optipng -o 4 -simulate ./tests/files/rgb_16_should_be_grayscale_8.png
|
||||
Time (mean ± σ): 730.0 ms ± 25.9 ms [User: 728.0 ms, System: 1.2 ms]
|
||||
Range (min … max): 713.3 ms … 768.2 ms 10 runs
|
||||
|
||||
|
||||
Summary
|
||||
'./target/release/oxipng -o4 -P ./tests/files/rgb_16_should_be_grayscale_8.png' ran
|
||||
5.16 ± 0.58 times faster than 'optipng -o 4 -simulate ./tests/files/rgb_16_should_be_grayscale_8.png'
|
||||
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -17,12 +17,14 @@ Oxipng for Windows can be downloaded from the [Releases](https://github.com/shss
|
|||
For MacOS or Linux, it is recommended to install from your distro's package repository, if possible.
|
||||
|
||||
Alternatively, oxipng can be installed from Cargo, via the following command:
|
||||
|
||||
```
|
||||
cargo install oxipng
|
||||
```
|
||||
|
||||
Oxipng can be built from source using the latest stable or nightly Rust.
|
||||
This is primarily useful for developing on oxipng.
|
||||
|
||||
```
|
||||
git clone https://github.com/shssoichiro/oxipng.git
|
||||
cd oxipng
|
||||
|
|
@ -30,7 +32,7 @@ cargo build --release
|
|||
cp target/release/oxipng /usr/local/bin
|
||||
```
|
||||
|
||||
The current minimum supported Rust version is **1.46.0**.
|
||||
The current minimum supported Rust version is **1.56.0**.
|
||||
|
||||
Oxipng follows Semantic Versioning.
|
||||
|
||||
|
|
@ -43,21 +45,22 @@ oxipng -o 4 -i 1 --strip safe *.png
|
|||
```
|
||||
|
||||
The most commonly used options are as follows:
|
||||
* Optimization: `-o 1` through `-o 6`, lower is faster, higher is better compression.
|
||||
The default (`-o 2`) is sufficiently fast on a modern CPU and provides 30-50% compression
|
||||
gains over an unoptimized PNG. `-o 4` is 6 times slower than `-o 2` but can provide 5-10%
|
||||
extra compression over `-o 2`. Using any setting higher than `-o 4` is unlikely
|
||||
to give any extra compression gains and is not recommended.
|
||||
* Interlacing: `-i 1` will enable [Adam7](https://en.wikipedia.org/wiki/Adam7_algorithm)
|
||||
PNG interlacing on any images that are processed. `-i 0` will remove interlacing from all
|
||||
processed images. Not specifying either will keep the same interlacing state as the
|
||||
input image. Note: Interlacing can add 25-50% to the size of an optimized image. Only use
|
||||
it if you believe the benefits outweigh the costs for your use case.
|
||||
* Strip: Used to remove metadata info from processed images. Used via `--strip [safe,all]`.
|
||||
Can save a few kilobytes if you don't need the metadata. "Safe" removes only metadata that
|
||||
will never affect rendering of the image. "All" removes all metadata that is not critical
|
||||
to the image. You can also pass a comma-separated list of specific metadata chunks to remove.
|
||||
`-s` can be used as a shorthand for `--strip safe`.
|
||||
|
||||
- Optimization: `-o 1` through `-o 6`, lower is faster, higher is better compression.
|
||||
The default (`-o 2`) is sufficiently fast on a modern CPU and provides 30-50% compression
|
||||
gains over an unoptimized PNG. `-o 4` is 6 times slower than `-o 2` but can provide 5-10%
|
||||
extra compression over `-o 2`. Using any setting higher than `-o 4` is unlikely
|
||||
to give any extra compression gains and is not recommended.
|
||||
- Interlacing: `-i 1` will enable [Adam7](https://en.wikipedia.org/wiki/Adam7_algorithm)
|
||||
PNG interlacing on any images that are processed. `-i 0` will remove interlacing from all
|
||||
processed images. Not specifying either will keep the same interlacing state as the
|
||||
input image. Note: Interlacing can add 25-50% to the size of an optimized image. Only use
|
||||
it if you believe the benefits outweigh the costs for your use case.
|
||||
- Strip: Used to remove metadata info from processed images. Used via `--strip [safe,all]`.
|
||||
Can save a few kilobytes if you don't need the metadata. "Safe" removes only metadata that
|
||||
will never affect rendering of the image. "All" removes all metadata that is not critical
|
||||
to the image. You can also pass a comma-separated list of specific metadata chunks to remove.
|
||||
`-s` can be used as a shorthand for `--strip safe`.
|
||||
|
||||
More advanced options can be found by running `oxipng -h`.
|
||||
|
||||
|
|
@ -96,4 +99,3 @@ Other contributions (such as improving documentation or translations) are also w
|
|||
Oxipng is open-source software, distributed under the MIT license.
|
||||
|
||||
## Benchmarks
|
||||
|
||||
|
|
|
|||
11
build.rs
11
build.rs
|
|
@ -1,11 +0,0 @@
|
|||
use rustc_version::{version, Version};
|
||||
use std::process::exit;
|
||||
|
||||
fn main() {
|
||||
// This should match the version in Github Actions scripts and the Readme
|
||||
const REQUIRED_VERSION: &str = "1.46.0";
|
||||
if version().unwrap() < Version::parse(REQUIRED_VERSION).unwrap() {
|
||||
eprintln!("oxipng requires rustc >= {}.", REQUIRED_VERSION);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue