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

Fix CI and update Ruby #200

Merged
merged 6 commits into from
Jul 10, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/audit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.7

- name: Install Ruby toolchain
uses: ruby/setup-ruby@1198b074305f9356bd56dd4b311757cc0dab2f1c # v1.175.1
uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: ".ruby-version"
bundler-cache: true
Expand All @@ -41,7 +41,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.7

- name: Install Rust toolchain
uses: artichoke/setup-rust/audit@v1.11.0
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
RUST_BACKTRACE: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.7

- name: Install Rust toolchain
uses: artichoke/setup-rust/build-and-test@v1.11.0
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
RUST_BACKTRACE: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.7

- name: Install Rust toolchain
uses: artichoke/setup-rust/build-and-test@v1.11.0
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
RUST_BACKTRACE: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.7

- name: Install Rust toolchain
uses: artichoke/setup-rust/lint-and-format@v1.11.0
Expand All @@ -114,10 +114,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.7

- name: Install Ruby toolchain
uses: ruby/setup-ruby@1198b074305f9356bd56dd4b311757cc0dab2f1c # v1.175.1
uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0
with:
ruby-version: ".ruby-version"
bundler-cache: true
Expand All @@ -130,7 +130,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.7

- name: Setup Node.js runtime
uses: actions/setup-node@v4.0.2
Expand All @@ -148,7 +148,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.7

- name: Setup Node.js runtime
uses: actions/setup-node@v4.0.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/markdown-link-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.7

- name: Check for broken links in markdown files
uses: gaurav-nelson/github-action-markdown-link-check@d53a906aa6b22b8979d33bc86170567e619495ec # v1.0.15
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/repo-labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: Synchronize repository labels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- uses: actions/checkout@v4.1.7

- name: Sync GitHub Issue Labels
uses: crazy-max/ghaction-github-labeler@de749cf181958193cb7debf1a9c5bb28922f3e1b # v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rustdoc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4.1.4
uses: actions/checkout@v4.1.7

- name: Install Rust toolchain
uses: artichoke/setup-rust/rustdoc@v1.11.0
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.0
3.3.3
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "strudel"
version = "1.0.0"
version = "1.1.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2018"
edition = "2021"
rust-version = "1.65.0"
description = "Rust port of the st_hash C library"
repository = "https://github.com/artichoke/strudel"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ DEPENDENCIES
rubocop-rake (~> 0.6)

BUNDLED WITH
2.5.3
2.5.15
7 changes: 4 additions & 3 deletions strudel-ffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "strudel-ffi"
version = "0.1.0"
version = "0.2.0"
authors = ["Ryan Lopopolo <rjl@hyperbo.la>"]
edition = "2018"
edition = "2021"
rust-version = "1.65.0"
description = "Rust port of the st_hash C library"
repository = "https://github.com/artichoke/strudel"
readme = "README.md"
Expand All @@ -18,7 +19,7 @@ name = "strudel_st"
[dependencies]
fnv = "1.0.7"
libc = "0.2.118"
strudel = { version = "=1.0.0", path = ".." }
strudel = { version = "=1.1.0", path = ".." }

[dev-dependencies]
memoffset = "0.9.0"
Expand Down
2 changes: 1 addition & 1 deletion strudel-ffi/src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::os::raw::c_int;
use core::ffi::c_int;

use crate::primitives::{st_data_t, st_index_t};

Expand Down
3 changes: 1 addition & 2 deletions strudel-ffi/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
//!
//! [`StHashMap`]: strudel::StHashMap

use core::ffi::c_void;
use std::os::raw::c_int;
use core::ffi::{c_int, c_void};

use crate::bindings::{st_foreach_callback_func, st_hash_type, st_update_callback_func};
use crate::primitives::{st_data_t, st_hash_t, st_index_t};
Expand Down
3 changes: 1 addition & 2 deletions strudel-ffi/src/ffi/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
//!
//! [`StHashMap`]: strudel::StHashMap

use core::ffi::c_void;
use core::ffi::{c_int, c_void};
use core::hash::Hasher;
use core::mem;
use core::ptr;
use core::slice;
use std::os::raw::c_int;

use fnv::FnvHasher;

Expand Down
17 changes: 10 additions & 7 deletions strudel-ffi/src/ffi/init.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use core::ffi::{c_char, c_int, CStr};
use core::hash::Hasher;
use core::iter;
use core::mem::transmute;
use core::slice;
use std::ffi::CStr;
use std::os::raw::{c_char, c_int};

use fnv::FnvHasher;

Expand Down Expand Up @@ -50,7 +50,10 @@ unsafe extern "C" fn strhash(arg: st_data_t) -> st_index_t {

static type_strhash: st_hash_type = st_hash_type {
compare: unsafe {
transmute(libc::strcmp as unsafe extern "C" fn(*const c_char, *const c_char) -> c_int)
transmute::<
unsafe extern "C" fn(*const c_char, *const c_char) -> c_int,
unsafe extern "C" fn(st_data_t, st_data_t) -> c_int,
>(libc::strcmp as _)
},
hash: strhash,
};
Expand Down Expand Up @@ -168,11 +171,11 @@ unsafe extern "C" fn st_locale_insensitive_strncasecmp(
s2: st_data_t,
n: libc::size_t,
) -> libc::c_int {
let s1 = slice::from_raw_parts(s1.as_const_c_char(), n);
let s2 = slice::from_raw_parts(s2.as_const_c_char(), n);
let s1 = slice::from_raw_parts(s1.as_const_c_char().cast::<u8>(), n);
let s2 = slice::from_raw_parts(s2.as_const_c_char().cast::<u8>(), n);

for (&left, &right) in s1.iter().zip(s2.iter()) {
match (transmute(left), transmute(right)) {
for (&left, &right) in iter::zip(s1, s2) {
match (left, right) {
(b'\0', b'\0') => return 0,
(_, b'\0') => return 1,
(b'\0', _) => return -1,
Expand Down
2 changes: 1 addition & 1 deletion strudel-ffi/src/primitives.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::ffi::c_char;
use core::mem::size_of;
use std::os::raw::c_char;

/// A type-safe typedef for data stored in the hashmap.
///
Expand Down
2 changes: 1 addition & 1 deletion strudel-ffi/src/st_table/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ impl From<StTable> for st_table {

#[cfg(test)]
mod tests {
use core::ffi::{c_uchar, c_uint};
use core::mem::size_of;
use std::os::raw::{c_uchar, c_uint};

use crate::bindings::st_hash_type;
use crate::primitives::{st_data_t, st_hash_t, st_index_t};
Expand Down