Skip to content

Commit

Permalink
Add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsteele committed Nov 8, 2022
1 parent 1f81be1 commit d0348eb
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 4 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/tests.yml
@@ -0,0 +1,62 @@
name: tests

on:
push:
paths-ignore:
- 'LICENSE'
- '**.md'
pull_request:
paths-ignore:
- 'LICENSE'
- '**.md'

jobs:
linters:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install rustfmt and clippy
run: rustup component add rustfmt clippy
- name: Cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

tests:
strategy:
matrix:
os: [ ubuntu-20.04, windows-2019, macos-10.15]
rust: [ stable ]

needs: [linters]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
toolchain: ${{ matrix.rust }}
args: --verbose
6 changes: 4 additions & 2 deletions README.md
@@ -1,10 +1,12 @@
# rust-ico

[![Build Status](https://github.com/mdsteele/rust-ico/actions/workflows/tests.yml/badge.svg)](https://github.com/mdsteele/rust-ico/actions/workflows/tests.yml)
[![Crates.io](https://img.shields.io/crates/v/ico.svg)](https://crates.io/crates/ico)
[![Documentation](https://docs.rs/ico/badge.svg)](https://docs.rs/ico)

A pure Rust library for encoding/decoding
[ICO image files](https://en.wikipedia.org/wiki/ICO_%28file_format%29).

Documentation: https://docs.rs/ico/

## Overview

An ICO file (.ico) stores a collection of small images of different sizes and
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Expand Up @@ -451,13 +451,13 @@ impl IconImage {
height: u32,
rgba_data: Vec<u8>,
) -> IconImage {
if width < MIN_WIDTH || width > MAX_WIDTH {
if !(MIN_WIDTH..=MAX_WIDTH).contains(&width) {
panic!(
"Invalid width (was {}, but range is {}-{})",
width, MIN_WIDTH, MAX_WIDTH
);
}
if height < MIN_HEIGHT || height > MAX_HEIGHT {
if !(MIN_HEIGHT..=MAX_HEIGHT).contains(&height) {
panic!(
"Invalid height (was {}, but range is {}-{})",
height, MIN_HEIGHT, MAX_HEIGHT
Expand Down

0 comments on commit d0348eb

Please sign in to comment.