Skip to content

Commit

Permalink
Merge pull request unicode-rs#93 from Jules-Bertholet/more-ci-checks
Browse files Browse the repository at this point in the history
More CI checks
  • Loading branch information
Manishearth authored Feb 29, 2024
2 parents 95aab8d + 261ca20 commit a6a221a
Show file tree
Hide file tree
Showing 12 changed files with 638 additions and 39 deletions.
36 changes: 31 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ on:
branches: [ master ]

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings --cfg docsrs

jobs:
build:
Expand All @@ -20,28 +24,50 @@ jobs:
- nightly
steps:
- uses: actions/checkout@v2
- name: Install latest nightly
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run tests with all features
run: cargo test --all-features --verbose
- name: Run tests without features
run: cargo test --verbose --no-default-features
run: cargo test --no-default-features --verbose
- name: Package
run: cargo package
- name: Test package
run: cd $(find target/package/ -maxdepth 1 -mindepth 1 -type d) && cargo test
- name: Test package without features
run: cd $(find target/package/ -maxdepth 1 -mindepth 1 -type d) && cargo test --no-default-features
- name: Build docs
if: matrix.rust == 'nightly'
run: cargo doc --all-features --verbose
- name: Check formatting
if: matrix.rust == 'stable'
run: cargo fmt --all --check
- name: Check clippy
if: matrix.rust == 'stable'
run: cargo clippy --all-features --all --verbose
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install msrv toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.36
override: true
- name: Build
run: cargo build --verbose --all-features
regen:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Regen
run: cd scripts && python3 unicode.py
- name: Diff
- name: Diff tables
run: diff src/tables.rs scripts/tables.rs
- name: Diff tests
run: diff tests/data/normalization_tests.rs scripts/normalization_tests.rs
17 changes: 14 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@

name = "unicode-normalization"
version = "0.1.23"
authors = ["kwantam <[email protected]>", "Manish Goregaokar <[email protected]>"]
authors = [
"kwantam <[email protected]>",
"Manish Goregaokar <[email protected]>",
]

homepage = "https://github.com/unicode-rs/unicode-normalization"
repository = "https://github.com/unicode-rs/unicode-normalization"
documentation = "https://docs.rs/unicode-normalization/"

license = "MIT/Apache-2.0"
keywords = ["text", "unicode", "normalization", "decomposition", "recomposition"]
keywords = [
"text",
"unicode",
"normalization",
"decomposition",
"recomposition",
]
readme = "README.md"
description = """
This crate provides functions for normalization of
Expand All @@ -18,9 +27,11 @@ Decomposition and Recomposition, as described in
Unicode Standard Annex #15.
"""

rust-version = "1.36"

edition = "2018"

exclude = [ "target/*", "Cargo.lock", "scripts/tmp", "*.txt", "tests/*" ]
exclude = ["target/*", "Cargo.lock", "scripts/tmp", "*.txt", "tests/*"]

[dependencies.tinyvec]
version = "1"
Expand Down
1 change: 1 addition & 0 deletions scripts/unicode.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ def minimal_perfect_hash(d):
data = UnicodeData()
with open("tables.rs", "w", newline = "\n") as out:
out.write(PREAMBLE)
out.write("#![cfg_attr(rustfmt, rustfmt::skip)]\n")
out.write("use crate::quick_check::IsNormalized;\n")
out.write("use crate::quick_check::IsNormalized::*;\n")
out.write("\n")
Expand Down
2 changes: 1 addition & 1 deletion src/__test_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// If you're caught using this outside this crates tests/, you get to clean up the mess.

#[cfg(not(feature = "std"))]
use crate::no_std_prelude::*;
use alloc::string::String;

use crate::stream_safe::StreamSafe;

Expand Down
8 changes: 1 addition & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ pub use crate::recompose::Recompositions;
pub use crate::replace::Replacements;
pub use crate::stream_safe::StreamSafe;
pub use crate::tables::UNICODE_VERSION;
use core::{
str::Chars,
option,
};

mod no_std_prelude;
use core::{option, str::Chars};

mod decompose;
mod lookups;
Expand Down Expand Up @@ -169,7 +164,6 @@ impl<'a> UnicodeNormalization<Chars<'a>> for &'a str {
}
}


impl UnicodeNormalization<option::IntoIter<char>> for char {
#[inline]
fn nfd(self) -> Decompositions<option::IntoIter<char>> {
Expand Down
6 changes: 0 additions & 6 deletions src/no_std_prelude.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/normalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::lookups::{
compatibility_fully_decomposed, composition_table,
};

use core::{char, ops::FnMut};
use core::char;

/// Compute canonical Unicode decomposition for character.
/// See [Unicode Standard Annex #15](http://www.unicode.org/reports/tr15/)
Expand Down
2 changes: 1 addition & 1 deletion src/stream_safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ mod tests {
use crate::normalize::decompose_compatible;

#[cfg(not(feature = "std"))]
use crate::no_std_prelude::*;
use alloc::{string::String, vec::Vec};

use core::char;

Expand Down
1 change: 1 addition & 0 deletions src/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// NOTE: The following code was generated by "scripts/unicode.py", do not edit directly

#![allow(missing_docs)]
#![cfg_attr(rustfmt, rustfmt::skip)]
use crate::quick_check::IsNormalized;
use crate::quick_check::IsNormalized::*;

Expand Down
2 changes: 1 addition & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use super::UnicodeNormalization;
use core::char;

#[cfg(not(feature = "std"))]
use crate::no_std_prelude::*;
use alloc::string::{String, ToString};

#[test]
fn test_nfd() {
Expand Down
Loading

0 comments on commit a6a221a

Please sign in to comment.