Skip to content

Commit 08424a0

Browse files
authored
fix github CI, part 1 (#728)
* run ci on main branch as well * reuse matrix in check action * run dummy job * check msrv with min deps * extract msrv from toml * fix msrv rendering in gh-action * fix wasm check * shell check * edit check action * fix pip install toml-cli * add echo log to vars action * set msrv properly * fix toml-cli cmd name * fix toml-cli cmd options * add checkout for vars job * try to replace deprecated doc_auto_cfg * fix warning * lock nightly version * add comment for rust release history * use stable clippy * use msrv clippy * update sdl2 * use nightly clippy despite errors * lock nightly version * fix typo in toolchain * fix typo in needs vars * install cmake for non linux targets * downgrade nightly version for tests * update nightly channel for tests * install cmake for macos only * use 1 nightly across all workflows * redut doc_auto_cfg back * comment doc_auto_cfg
1 parent 3cbf9a9 commit 08424a0

File tree

8 files changed

+127
-59
lines changed

8 files changed

+127
-59
lines changed

.github/workflows/check.yml

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
# - doc: checks that the code can be documented without errors
66
# - hack: check combinations of feature flags
77
# - msrv: check that the msrv specified in the crate is correct
8-
# - semver: check API changes for semver violations.
8+
# - wasm: check wasm target
9+
# - semver: check API changes for semver violations
910
permissions:
1011
contents: read
1112
# This configuration allows maintainers of this repo to create a branch and pull request based on
1213
# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
1314
# built once.
1415
on:
1516
push:
16-
branches: [master]
17+
branches: [master, main]
1718
pull_request:
1819
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
1920
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
@@ -22,20 +23,41 @@ concurrency:
2223
cancel-in-progress: true
2324
name: check
2425
jobs:
26+
vars:
27+
runs-on: ubuntu-latest
28+
# https://rust-lang.github.io/rustup-components-history/
29+
outputs:
30+
nightly: nightly-2025-10-21
31+
stable: 1.90.0
32+
msrv: ${{ steps.variables.outputs.msrv }}
33+
steps:
34+
- uses: actions/checkout@v4
35+
- id: variables
36+
run: |
37+
pip install toml-cli==0.8.2
38+
msrv=$(toml get --toml-path=Cargo.toml package.rust-version)
39+
echo "msrv=${msrv}"
40+
echo "msrv=${msrv}" >> "$GITHUB_OUTPUT"
2541
fmt:
42+
needs: vars
2643
runs-on: ubuntu-latest
27-
name: stable / fmt
44+
strategy:
45+
matrix:
46+
toolchain: ["${{ needs.vars.outputs.stable }}"]
47+
name: ${{ matrix.toolchain }} / fmt
2848
steps:
2949
- uses: actions/checkout@v4
3050
with:
3151
submodules: true
32-
- name: Install stable
33-
uses: dtolnay/rust-toolchain@stable
52+
- name: Install ${{ matrix.toolchain }}
53+
uses: dtolnay/rust-toolchain@master
3454
with:
55+
toolchain: ${{ matrix.toolchain }}
3556
components: rustfmt
3657
- name: cargo fmt --check
3758
run: cargo fmt --check
3859
clippy:
60+
needs: vars
3961
runs-on: ubuntu-latest
4062
name: ${{ matrix.toolchain }} / clippy
4163
permissions:
@@ -44,7 +66,7 @@ jobs:
4466
strategy:
4567
fail-fast: false
4668
matrix:
47-
toolchain: [nightly-2024-11-15]
69+
toolchain: ["${{ needs.vars.outputs.nightly }}"]
4870
steps:
4971
- uses: actions/checkout@v4
5072
with:
@@ -62,54 +84,83 @@ jobs:
6284
# run docs generation on nightly rather than stable. This enables features like
6385
# https://doc.rust-lang.org/beta/unstable-book/language-features/doc-cfg.html which allows an
6486
# API be documented as only available in some specific platforms.
87+
needs: vars
6588
runs-on: ubuntu-latest
66-
name: nightly / doc
89+
strategy:
90+
matrix:
91+
toolchain: ["${{ needs.vars.outputs.nightly }}"]
92+
name: ${{ matrix.toolchain }} / doc
6793
steps:
6894
- uses: actions/checkout@v4
6995
with:
7096
submodules: true
71-
- name: Install nightly
72-
uses: dtolnay/rust-toolchain@nightly
97+
- name: Install ${{ matrix.toolchain }}
98+
uses: dtolnay/rust-toolchain@master
99+
with:
100+
toolchain: ${{ matrix.toolchain }}
73101
- name: cargo doc
74102
run: cargo doc --no-deps --all-features
75103
env:
76104
RUSTDOCFLAGS: -D warnings --cfg docsrs
77105
hack:
78106
# cargo-hack checks combinations of feature flags to ensure that features are all additive
79107
# which is required for feature unification
108+
needs: vars
80109
runs-on: ubuntu-latest
81-
name: ubuntu / stable / features
110+
strategy:
111+
matrix:
112+
toolchain: ["${{ needs.vars.outputs.stable }}"]
113+
name: ubuntu / ${{ matrix.toolchain }} / features
82114
steps:
83115
- uses: actions/checkout@v4
84116
with:
85117
submodules: true
86-
- name: Install stable
87-
uses: dtolnay/rust-toolchain@stable
118+
- name: Install ${{ matrix.toolchain }}
119+
uses: dtolnay/rust-toolchain@master
120+
with:
121+
toolchain: ${{ matrix.toolchain }}
88122
- name: cargo install cargo-hack
89123
uses: taiki-e/install-action@cargo-hack
90124
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
91125
# --feature-powerset runs for every combination of features
92126
- name: cargo hack
93127
run: cargo hack --feature-powerset check
94128
msrv:
95-
# check that we can build using the minimal rust version that is specified by this crate
129+
needs: vars
96130
runs-on: ubuntu-latest
97-
# we use a matrix here just because env can't be used in job names
98-
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
99131
strategy:
100132
matrix:
101-
msrv: ["1.80.1"] # Don't forget to update the `rust-version` in Cargo.toml as well
133+
msrv: ["${{ needs.vars.outputs.msrv }}"]
102134
name: ubuntu / ${{ matrix.msrv }}
103135
steps:
104136
- uses: actions/checkout@v4
105137
with:
106138
submodules: true
139+
- name: Install ${{ needs.vars.outputs.nightly }}
140+
uses: dtolnay/rust-toolchain@master
141+
with:
142+
toolchain: ${{ needs.vars.outputs.nightly }}
143+
# Generate Cargo.lock with minimal versions
144+
- name: Update dependencies to minimal versions
145+
run: cargo +nightly update -Zdirect-minimal-versions
107146
- name: Install ${{ matrix.msrv }}
108147
uses: dtolnay/rust-toolchain@master
109148
with:
110149
toolchain: ${{ matrix.msrv }}
111-
- name: cargo +${{ matrix.msrv }} check
112-
run: cargo check
150+
- run: cargo +${{ matrix.msrv }} check --locked
151+
env:
152+
RUSTFLAGS: -D warnings
153+
wasm:
154+
needs: vars
155+
runs-on: ubuntu-latest
156+
steps:
157+
- uses: actions/checkout@v4
158+
- uses: dtolnay/rust-toolchain@master
159+
with:
160+
toolchain: ${{ needs.vars.outputs.stable }}
161+
targets: wasm32-unknown-unknown
162+
- name: cargo check
163+
run: cargo check --target wasm32-unknown-unknown
113164
env:
114165
RUSTFLAGS: -D warnings
115166
semver:

.github/workflows/safety.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ permissions:
88
contents: read
99
on:
1010
push:
11-
branches: [master]
11+
branches: [master, main]
1212
pull_request:
1313
concurrency:
1414
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}

.github/workflows/scheduled.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ permissions:
55
contents: read
66
on:
77
push:
8-
branches: [master]
8+
branches: [master, main]
99
pull_request:
1010
schedule:
1111
- cron: '7 7 * * *'
@@ -14,10 +14,21 @@ concurrency:
1414
cancel-in-progress: true
1515
name: rolling
1616
jobs:
17+
vars:
18+
runs-on: ubuntu-latest
19+
# https://rust-lang.github.io/rustup-components-history/
20+
outputs:
21+
nightly: nightly-2025-10-21
22+
steps:
23+
- run: echo "dummy job"
1724
# https://twitter.com/mycoliza/status/1571295690063753218
1825
nightly:
26+
needs: vars
1927
runs-on: ubuntu-latest
20-
name: ubuntu / nightly
28+
name: ubuntu / ${{ matrix.toolchain }}
29+
strategy:
30+
matrix:
31+
toolchain: ["${{ needs.vars.outputs.nightly }}"]
2132
steps:
2233
- uses: actions/checkout@v4
2334
with:
@@ -36,8 +47,12 @@ jobs:
3647
# of this crate will generally use the latest available crates. This is subject to the standard
3748
# Cargo semver rules (i.e cargo does not update to a new major version unless explicitly told
3849
# to).
50+
needs: vars
3951
runs-on: ubuntu-latest
40-
name: ubuntu / nightly / updated
52+
name: ubuntu / ${{ matrix.toolchain }} / updated
53+
strategy:
54+
matrix:
55+
toolchain: ["${{ needs.vars.outputs.nightly }}"]
4156
# There's no point running this if no Cargo.lock was checked in in the first place, since we'd
4257
# just redo what happened in the regular test job. Unfortunately, hashFiles only works in if on
4358
# steps, so we repeat it.
@@ -47,7 +62,9 @@ jobs:
4762
submodules: true
4863
- name: Install nightly
4964
if: hashFiles('Cargo.lock') != ''
50-
uses: dtolnay/rust-toolchain@nightly
65+
uses: dtolnay/rust-toolchain@master
66+
with:
67+
toolchain: ${{ matrix.toolchain }}
5168
- name: cargo update
5269
if: hashFiles('Cargo.lock') != ''
5370
run: cargo update

.github/workflows/test.yml

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,27 @@ permissions:
99
contents: read
1010
on:
1111
push:
12-
branches: [master]
12+
branches: [master, main]
1313
pull_request:
1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1616
cancel-in-progress: true
1717
name: test
1818
jobs:
19+
vars:
20+
runs-on: ubuntu-latest
21+
# https://rust-lang.github.io/rustup-components-history/
22+
outputs:
23+
nightly: nightly-2025-10-21
24+
steps:
25+
- run: echo "dummy job"
1926
required:
27+
needs: vars
2028
runs-on: ubuntu-latest
2129
name: ubuntu / ${{ matrix.toolchain }}
2230
strategy:
2331
matrix:
24-
toolchain: [nightly]
32+
toolchain: ["${{ needs.vars.outputs.nightly }}"]
2533
steps:
2634
- uses: actions/checkout@v4
2735
with:
@@ -41,26 +49,34 @@ jobs:
4149
- name: cargo test --doc
4250
run: cargo test --locked --all-features --doc
4351
direct-minimal:
52+
needs: vars
53+
strategy:
54+
matrix:
55+
toolchain: ["${{ needs.vars.outputs.nightly }}"]
4456
runs-on: ubuntu-latest
45-
name: ubuntu / nightly / direct-minimal-versions
57+
name: ubuntu / ${{ matrix.toolchain }} / direct-minimal-versions
4658
steps:
4759
- uses: actions/checkout@v4
4860
with:
4961
submodules: true
50-
- name: Install nightly
51-
uses: dtolnay/rust-toolchain@nightly
62+
- name: Install ${{ matrix.toolchain }}
63+
uses: dtolnay/rust-toolchain@master
64+
with:
65+
toolchain: ${{ matrix.toolchain }}
5266
- name: cargo update -Zdirect-minimal-versions
5367
run: cargo update -Zdirect-minimal-versions
5468
- name: cargo test
5569
run: cargo test --locked --all-features --all-targets
5670
os-check:
5771
# run cargo test on mac and windows
72+
needs: vars
5873
runs-on: ${{ matrix.os }}
59-
name: ${{ matrix.os }} / nightly
74+
name: ${{ matrix.os }} / ${{ matrix.toolchain }}
6075
strategy:
6176
fail-fast: false
6277
matrix:
6378
os: [macos-latest, windows-latest]
79+
toolchain: ["${{ needs.vars.outputs.nightly }}"]
6480
steps:
6581
# if your project needs OpenSSL, uncomment this to fix Windows builds.
6682
# it's commented out by default as the install command takes 5-10m.
@@ -71,8 +87,15 @@ jobs:
7187
- uses: actions/checkout@v4
7288
with:
7389
submodules: true
74-
- name: Install nightly
75-
uses: dtolnay/rust-toolchain@nightly
90+
- name: Setup cmake
91+
if: matrix.os == 'macos-latest'
92+
uses: jwlawson/actions-setup-cmake@v2
93+
with:
94+
cmake-version: '3.6.0'
95+
- name: Install ${{ matrix.toolchain }}
96+
uses: dtolnay/rust-toolchain@master
97+
with:
98+
toolchain: ${{ matrix.toolchain }}
7699
- name: cargo generate-lockfile
77100
if: hashFiles('Cargo.lock') == ''
78101
run: cargo generate-lockfile

.github/workflows/wasm.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
name = "imageproc"
33
version = "0.26.0"
44
authors = ["theotherphil"]
5-
# note: when changed, also update `msrv` in `.github/workflows/check.yml`
6-
rust-version = "1.80.1"
5+
rust-version = "1.81.0"
76
edition = "2021"
87
license = "MIT"
98
description = "Image processing operations"
@@ -32,7 +31,7 @@ rand = { version = "0.8.5", default-features = false, features = [
3231
] }
3332
rand_distr = { version = "0.4.3", default-features = false }
3433
rayon = { version = "1.8.0", optional = true, default-features = false }
35-
sdl2 = { version = "0.36", optional = true, default-features = false, features = [
34+
sdl2 = { version = "0.38.0", optional = true, default-features = false, features = [
3635
"bundled",
3736
] }
3837
katexit = { version = "0.1.4", optional = true, default-features = false }
@@ -49,7 +48,7 @@ wasm-bindgen-test = "0.3.38"
4948
[package.metadata.docs.rs]
5049
# See https://github.com/image-rs/imageproc/issues/358
5150
# all-features = true
52-
features = ["property-testing", "katexit"]
51+
features = ["katexit"]
5352

5453
[profile.release]
5554
opt-level = 3

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![doc = include_str!("../README.md")]
22
#![deny(missing_docs)]
33
#![cfg_attr(test, feature(test))]
4-
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
4+
// #![cfg_attr(docsrs, feature(doc_auto_cfg))]
55
#![allow(
66
clippy::too_long_first_doc_paragraph,
77
clippy::zero_prefixed_literal,

src/template_matching.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ mod methods {
392392
}
393393

394394
fn square_sum(input: &GrayImage) -> f32 {
395-
input.iter().map(|&x| (x as f32 * x as f32)).sum()
395+
input.iter().map(|&x| x as f32 * x as f32).sum()
396396
}
397397
fn mult_square_sum(a: &GrayImage, b: &GrayImage) -> f32 {
398398
a.iter()

0 commit comments

Comments
 (0)