Skip to content

Commit 1503753

Browse files
authored
Merge pull request #1 from LowPolyCat1/dev
adding workflows
2 parents b4b23a2 + d309c5f commit 1503753

8 files changed

Lines changed: 114 additions & 24 deletions

File tree

.github/workflows/build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Compilation Check
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, windows-latest, macos-latest]
18+
toolchain: [stable, beta, nightly]
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
- name: Set up Rust
23+
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
24+
- name: Build
25+
run: cargo build --verbose
26+
- name: Run tests
27+
run: cargo test --verbose
28+
- name: Build release
29+
run: cargo build --verbose --release

.github/workflows/clippy.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
clippy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Install Rust
16+
uses: actions-rs/toolchain@v1
17+
with:
18+
toolchain: stable
19+
- name: Install Clippy
20+
run: rustup component add clippy
21+
- name: Run Clippy
22+
run: cargo clippy -- -D warnings

.github/workflows/licenses.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: License Compliance
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
license_check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Check Licenses
15+
uses: EmbarkStudios/cargo-deny-action@v2
16+
with:
17+
command: check licenses

.github/workflows/security.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Security Audit
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
schedule:
9+
- cron: "0 0 * * 0" # Runs every Sunday at midnight
10+
11+
jobs:
12+
security_audit:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Run Cargo Audit
17+
uses: rustsec/audit-check@v2
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}

deny.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[licenses]
2+
unlicensed = "deny"
3+
allow = ["MIT", "Apache-2.0", "Unicode-DFS-2016", "BSD-3-Clause", "ISC"]
4+
copyleft = "deny"
5+
confidence-threshold = 0.8
6+
7+
[advisories]
8+
vulnerability = "deny"
9+
unmaintained = "warn"
10+
11+
[bans]
12+
multiple-versions = "warn"

locale-dev/src/generate_datetime_formatting.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ pub fn run(
1717
let file = archive.by_index(i)?;
1818
if file.name().contains("/main/") && file.is_dir() {
1919
let parts: Vec<&str> = file.name().split('/').collect();
20-
if let Some(idx) = parts.iter().position(|&r| r == "main") {
21-
if let Some(name) = parts.get(idx + 1) {
22-
if !name.is_empty() && !locales.contains(&(*name).to_string()) {
20+
if let Some(idx) = parts.iter().position(|&r| r == "main")
21+
&& let Some(name) = parts.get(idx + 1)
22+
&& !name.is_empty() && !locales.contains(&(*name).to_string()) {
2323
locales.push((*name).to_string());
2424
}
25-
}
26-
}
2725
}
2826
}
2927
locales.sort();

locale-dev/src/generate_locales.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ pub fn run(
1717
let file = archive.by_index(i)?;
1818
if file.is_dir() && file.name().contains("/main/") {
1919
let parts: Vec<&str> = file.name().split('/').collect();
20-
if let Some(idx) = parts.iter().position(|&r| r == "main") {
21-
if let Some(name) = parts.get(idx + 1) {
22-
if !name.is_empty() && !locales.contains(&(*name).to_string()) {
20+
if let Some(idx) = parts.iter().position(|&r| r == "main")
21+
&& let Some(name) = parts.get(idx + 1)
22+
&& !name.is_empty() && !locales.contains(&(*name).to_string()) {
2323
locales.push((*name).to_string());
2424
}
25-
}
26-
}
2725
}
2826
}
2927
locales.sort();

locale-dev/src/generate_num_formats.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ fn detect_all_groupings(pattern: &str) -> Vec<usize> {
2222
if let Some(primary) = parts.last() {
2323
sizes.push(primary.len());
2424
}
25-
if parts.len() > 2 {
26-
if let Some(secondary) = parts.get(parts.len() - 2) {
25+
if parts.len() > 2
26+
&& let Some(secondary) = parts.get(parts.len() - 2) {
2727
sizes.push(secondary.len());
2828
}
29-
}
3029

3130
if sizes.len() > 1 && sizes[0] == sizes[1] {
3231
sizes.truncate(1);
@@ -47,16 +46,15 @@ pub fn run(
4746
let json: Value = serde_json::from_reader(&mut file)?;
4847
if let Some(systems) = json["supplemental"]["numberingSystems"].as_object() {
4948
for (name, data) in systems {
50-
if data["_type"].as_str() == Some("numeric") {
51-
if let Some(digits_str) = data["_digits"].as_str() {
49+
if data["_type"].as_str() == Some("numeric")
50+
&& let Some(digits_str) = data["_digits"].as_str() {
5251
let chars: Vec<char> = digits_str.chars().collect();
5352
if chars.len() == 10 {
5453
let mut arr = ['0'; 10];
5554
arr.copy_from_slice(&chars[..10]);
5655
system_digit_map.insert(name.to_string(), arr);
5756
}
5857
}
59-
}
6058
}
6159
}
6260
}
@@ -66,13 +64,11 @@ pub fn run(
6664
let file = archive.by_index(i)?;
6765
if file.name().contains("/main/") && file.is_dir() {
6866
let parts: Vec<&str> = file.name().split('/').collect();
69-
if let Some(idx) = parts.iter().position(|&r| r == "main") {
70-
if let Some(name) = parts.get(idx + 1) {
71-
if !name.is_empty() && !locales.contains(&(*name).to_string()) {
67+
if let Some(idx) = parts.iter().position(|&r| r == "main")
68+
&& let Some(name) = parts.get(idx + 1)
69+
&& !name.is_empty() && !locales.contains(&(*name).to_string()) {
7270
locales.push((*name).to_string());
7371
}
74-
}
75-
}
7672
}
7773
}
7874
locales.sort();
@@ -110,11 +106,10 @@ pub fn run(
110106
minus = m.to_string();
111107
}
112108

113-
if system != "latn" {
114-
if let Some(digits) = system_digit_map.get(system) {
109+
if system != "latn"
110+
&& let Some(digits) = system_digit_map.get(system) {
115111
digit_set_str = format!("Some({:?})", digits);
116112
}
117-
}
118113

119114
let format_key = format!("decimalFormats-numberSystem-{}", system);
120115
if let Some(pattern) = numbers[format_key]["standard"].as_str() {

0 commit comments

Comments
 (0)