Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: fix deprecations, MSRV tests. #30

Merged
merged 9 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[alias]
clippy-ci = "clippy --all-features --all-targets --all"
clippy-msrv-ci = "clippy --all-features --lib --all" # Only check --lib target w/ MSRV toolchain.
79 changes: 54 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
- main
- "*_dev"
pull_request:
merge_group:
schedule:
- cron: '0 18 * * *'

name: CI
permissions:
Expand All @@ -22,24 +25,17 @@ jobs:
- ubuntu-latest
- macos-latest
- windows-latest
rust:
- stable
# MSRV
- 1.56.0
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions-rs/toolchain@v1

- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: ${{ matrix.rust }}
components: clippy

- name: Clippy (${{ matrix.os }})
uses: actions-rs/cargo@v1
with:
command: clippy-ci
run: cargo clippy-ci

- name: Clippy (Android)
if: matrix.os == 'ubuntu-latest'
Expand All @@ -61,6 +57,46 @@ jobs:
# rustup target add wasm32-unknown-unknown
# cargo clippy-ci --target wasm32-unknown-unknown

clippy-msrv:
name: Clippy (MSRV)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.64.0" # MSRV
components: clippy

- name: Install cargo-ndk.
run: |
cargo install cargo-ndk --version 2.12.7
rustup target add aarch64-linux-android

- name: Clippy (${{ matrix.os }})
run: cargo clippy-msrv-ci

- name: Clippy (Android)
if: matrix.os == 'ubuntu-latest'
run: |
cargo ndk -t arm64-v8a clippy-msrv-ci

- name: Clippy (iOS)
if: matrix.os == 'macos-latest'
run: |
rustup target add x86_64-apple-ios
cargo clippy-msrv-ci --target x86_64-apple-ios

# TODO: Consider WASM. See note on "clippy" job.

test:
name: Test
runs-on: ${{ matrix.os }}
Expand All @@ -74,15 +110,11 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable


- uses: dtolnay/rust-toolchain@stable

- name: Test (${{ matrix.os }})
uses: actions-rs/cargo@v1
with:
command: test
run: cargo test

- name: Setup Android test environment
uses: actions/setup-java@v2
Expand Down Expand Up @@ -137,15 +169,12 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: actions-rs/toolchain@v1

- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
components: rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- run: cargo fmt --all -- --check

android_fmt:
name: Ktlint
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ keywords = ["tls", "certificate", "verification", "os", "native"]
repository = "https://github.com/1Password/rustls-platform-verifier"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.56"
rust-version = "1.64.0"

exclude = [
"android/.run",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![crates.io version](https://img.shields.io/crates/v/rustls-platform-verifier.svg)](https://crates.io/crates/rustls-platform-verifier)
[![crate documentation](https://docs.rs/rustls-platform-verifier/badge.svg)](https://docs.rs/rustls-platform-verifier)
![MSRV](https://img.shields.io/badge/rustc-1.56+-blue.svg)
![MSRV](https://img.shields.io/badge/rustc-1.64+-blue.svg)
[![crates.io downloads](https://img.shields.io/crates/d/rustls-platform-verifier.svg)](https://crates.io/crates/rustls-platform-verifier)
![CI](https://github.com/1Password/rustls-platform-verifier/workflows/CI/badge.svg)

Expand Down Expand Up @@ -159,4 +159,4 @@ Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.
</sub>
</sub>
2 changes: 1 addition & 1 deletion src/verification/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ fn extract_result_info(env: &JNIEnv<'_>, result: JObject<'_>) -> (VerifierStatus
let msg = env
.get_field(result, "message", "Ljava/lang/String;")
.and_then(|m| m.l())
.map(|o| (!o.is_null()).then(|| o))
.map(|o| (!o.is_null()).then_some(o))
.and_then(|s| s.map(|s| JavaStr::from_env(env, s.into())).transpose())
.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion src/verification/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl Certificate {
CERT_SET_PROPERTY_IGNORE_PERSIST_ERROR_FLAG,
prop_data,
) == TRUE)
.then(|| ())
.then_some(())
})
}
}
Expand Down
Loading