Skip to content

Commit 5d8516b

Browse files
authored
ci: Upgrade the CI base image to use ubuntu-24.04 instead of the deprecated ubuntu-20.04 (#359)
1 parent f1b75a6 commit 5d8516b

File tree

7 files changed

+38
-9
lines changed

7 files changed

+38
-9
lines changed

.github/workflows/rust.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
strategy:
2222
matrix:
2323
rust_version: [1.67, stable]
24-
runs-on: ubuntu-20.04
24+
runs-on: ubuntu-24.04
2525

2626
steps:
2727
- uses: actions/checkout@v4
@@ -36,16 +36,23 @@ jobs:
3636
run: rustup default ${{ matrix.rust_version }}
3737
- name: print rustc version
3838
run: rustc --version
39-
- name: downgrade `serde_bytes` crate to support older Rust toolchain
39+
- name: downgrade `serde_bytes`, `toml_edit`, and `toml_parser` crates to support older Rust toolchain
4040
if: matrix.rust_version == '1.67'
4141
run: |
4242
cargo update -p serde_bytes --precise 0.11.16
43+
cargo update -p toml_edit --precise 0.23.5
44+
cargo update -p toml_parser --precise 1.0.2
45+
cargo update -p toml_datetime --precise 0.7.1
46+
cargo update -p indexmap@2.12.0 --precise 2.11.4
47+
cargo update -p syn@2.0.110 --precise 2.0.106
48+
cargo update -p quote --precise 1.0.41
49+
cargo update -p time --precise 0.3.41
4350
- name: Run tests
4451
run: ./.github/test.sh
4552

4653
# remove this job when https://github.com/rust-lang/rust/issues/89554 stabilizes
4754
test_exhaustive_checks:
48-
runs-on: ubuntu-20.04
55+
runs-on: ubuntu-24.04
4956
steps:
5057
- uses: actions/checkout@v4
5158
- name: Install nightly for exhaustive check tests
@@ -58,15 +65,15 @@ jobs:
5865
run: RUSTFLAGS="-A unused_imports -D warnings" cargo check --workspace --features force_exhaustive_checks
5966

6067
clippy:
61-
runs-on: ubuntu-20.04
68+
runs-on: ubuntu-24.04
6269

6370
steps:
6471
- uses: actions/checkout@v4
6572
- name: Run clippy
6673
run: cargo clippy --features unstable__schema --benches -- -D clippy::all
6774

6875
cargo-fmt:
69-
runs-on: ubuntu-20.04
76+
runs-on: ubuntu-24.04
7077

7178
steps:
7279
- uses: actions/checkout@v4
@@ -77,7 +84,7 @@ jobs:
7784
# won't look as expected, when rendered, and sometimes errors, which will prevent doc from being
7885
# generated at release time altogether.
7986
cargo-doc:
80-
runs-on: ubuntu-20.04
87+
runs-on: ubuntu-24.04
8188

8289
steps:
8390
- uses: actions/checkout@v4

borsh/src/schema/container_ext/max_size.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn max_serialized_size_impl<'a>(
9494
mul(count, sum)
9595
}
9696

97-
if stack.iter().any(|dec| *dec == declaration) {
97+
if stack.contains(&declaration) {
9898
return Err(Error::Recursive);
9999
}
100100
stack.push(declaration);
@@ -205,7 +205,7 @@ fn is_zero_size_impl<'a>(
205205
Ok(true)
206206
}
207207

208-
if stack.iter().any(|dec| *dec == declaration) {
208+
if stack.contains(&declaration) {
209209
return Err(ZeroSizeError::Recursive);
210210
}
211211
stack.push(declaration);

borsh/src/schema/container_ext/validate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn validate_impl<'a>(
6565
return Err(Error::MissingDefinition(declaration.to_string()));
6666
}
6767
};
68-
if stack.iter().any(|dec| *dec == declaration) {
68+
if stack.contains(&declaration) {
6969
return Ok(());
7070
}
7171
stack.push(declaration);

borsh/tests/compile_derives/test_generic_enums.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ use std::collections::HashMap;
1515
use alloc::collections::BTreeMap;
1616

1717
/// `T: Ord` bound is required for `BorshDeserialize` derive to be successful
18+
#[allow(unused)]
1819
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Debug)]
1920
enum E<T: Ord, U, W> {
2021
X { f: BTreeMap<T, U> },
2122
Y(W),
2223
}
2324

2425
#[cfg(hash_collections)]
26+
#[allow(unused)]
2527
#[derive(BorshSerialize, BorshDeserialize, Debug)]
2628
enum I1<K, V, R> {
2729
B {
@@ -34,6 +36,7 @@ enum I1<K, V, R> {
3436
}
3537

3638
#[cfg(hash_collections)]
39+
#[allow(unused)]
3740
#[derive(BorshSerialize, BorshDeserialize, Debug)]
3841
enum I2<K: Ord + Eq + Hash, R, U> {
3942
B { x: HashMap<K, R>, y: String },

borsh/tests/compile_derives/test_macro_namespace_collisions.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
mod std {}
44
mod core {}
55

6+
#[allow(unused)]
67
#[derive(borsh::BorshSerialize, borsh::BorshDeserialize)]
78
struct A;
89

10+
#[allow(unused)]
911
#[derive(borsh::BorshSerialize, borsh::BorshDeserialize)]
1012
enum B {
1113
C,

borsh/tests/compile_derives/test_recursive_structs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use alloc::{boxed::Box, string::String};
1212

1313

1414
#[cfg(hash_collections)]
15+
#[allow(unused)]
1516
#[derive(BorshSerialize, BorshDeserialize)]
1617
struct CRec<U: Ord + Hash + Eq> {
1718
a: String,
@@ -20,6 +21,7 @@ struct CRec<U: Ord + Hash + Eq> {
2021

2122
// `impl<T, U> BorshDeserialize for Box<T>` pulls in => `ToOwned`
2223
// => pulls in at least `Clone`
24+
#[allow(unused)]
2325
#[derive(Clone, BorshSerialize, BorshDeserialize)]
2426
struct CRecA {
2527
a: String,
@@ -28,6 +30,7 @@ struct CRecA {
2830

2931

3032
#[cfg(hash_collections)]
33+
#[allow(unused)]
3134
#[derive(BorshSerialize, BorshDeserialize)]
3235
struct CRecC {
3336
a: String,

borsh/tests/roundtrip/requires_derive_category/test_enum_discriminants.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ enum C {
134134
C5(D),
135135
}
136136

137+
#[test]
138+
fn test_enum_tuples() {
139+
let values = vec![
140+
C::C1,
141+
C::C2(u64::MAX),
142+
C::C3(1, 2),
143+
C::C4 { x: 0, y: 100 },
144+
C::C5(D { x: u64::MAX }),
145+
];
146+
for value in values {
147+
assert_eq!(from_slice::<C>(&to_vec(&value).unwrap()).unwrap(), value);
148+
}
149+
}
150+
137151
#[derive(BorshSerialize, BorshDeserialize, PartialEq, Eq, Clone, Copy, Debug)]
138152
#[borsh(use_discriminant = true)]
139153
enum X {

0 commit comments

Comments
 (0)