Skip to content

Commit ca8adee

Browse files
authored
Merge pull request diesel-rs#3923 from weiznich/ci/m1_runners
Try out M1 Runners
2 parents d3f7099 + 98fe07c commit ca8adee

File tree

18 files changed

+156
-87
lines changed

18 files changed

+156
-87
lines changed

.github/workflows/audit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
security_audit:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v3
14-
- uses: actions-rs/audit-check@v1
13+
- uses: actions/checkout@v4
14+
- uses: actions-rust-lang/audit@v1
1515
with:
1616
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/benches.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
backend: ["postgres", "sqlite", "mysql"]
1616
steps:
1717
- name: Checkout sources
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919

2020
- name: Install postgres (Linux)
2121
if: matrix.backend == 'postgres'

.github/workflows/ci.yml

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,15 @@ jobs:
2727
matrix:
2828
rust: ["stable", "beta", "nightly"]
2929
backend: ["postgres", "sqlite", "mysql"]
30-
os: [ubuntu-latest, macos-latest, windows-2019]
30+
os: [ubuntu-latest, macos-latest, macos-14, windows-2019]
3131
runs-on: ${{ matrix.os }}
3232
steps:
3333
- name: Checkout sources
34-
uses: actions/checkout@v3
34+
uses: actions/checkout@v4
3535

3636
- name: Cache cargo registry
37-
uses: actions/cache@v3
37+
uses: Swatinem/rust-cache@v2
3838
with:
39-
path: |
40-
~/.cargo/registry
41-
~/.cargo/git
4239
key: ${{ runner.os }}-${{ matrix.backend }}-cargo-${{ hashFiles('**/Cargo.toml') }}
4340

4441
- name: Set environment variables
@@ -121,14 +118,23 @@ jobs:
121118
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://root:root@localhost/diesel_unit_test" >> $GITHUB_ENV
122119
123120
- name: Install postgres (MacOS)
124-
if: runner.os == 'macOS' && matrix.backend == 'postgres'
121+
if: matrix.os == 'macos-latest' && matrix.backend == 'postgres'
125122
run: |
126123
initdb -D /usr/local/var/postgres
127124
pg_ctl -D /usr/local/var/postgres start
128125
sleep 3
129126
createuser -s postgres
130127
echo "PG_DATABASE_URL=postgres://postgres@localhost/" >> $GITHUB_ENV
131128
echo "PG_EXAMPLE_DATABASE_URL=postgres://postgres@localhost/diesel_example" >> $GITHUB_ENV
129+
- name: Install postgres (MacOS M1)
130+
if: matrix.os == 'macos-14' && matrix.backend == 'postgres'
131+
run: |
132+
brew install postgresql
133+
brew services start postgresql@14
134+
sleep 3
135+
createuser -s postgres
136+
echo "PG_DATABASE_URL=postgres://postgres@localhost/" >> $GITHUB_ENV
137+
echo "PG_EXAMPLE_DATABASE_URL=postgres://postgres@localhost/diesel_example" >> $GITHUB_ENV
132138
133139
- name: Install sqlite (MacOS)
134140
if: runner.os == 'macOS' && matrix.backend == 'sqlite'
@@ -137,7 +143,7 @@ jobs:
137143
echo "SQLITE_DATABASE_URL=/tmp/test.db" >> $GITHUB_ENV
138144
139145
- name: Install mysql (MacOS)
140-
if: runner.os == 'macOS' && matrix.backend == 'mysql'
146+
if: matrix.os == 'macos-latest' && matrix.backend == 'mysql'
141147
run: |
142148
brew install [email protected]
143149
/usr/local/opt/[email protected]/bin/mysql_install_db
@@ -149,6 +155,20 @@ jobs:
149155
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://runner@localhost/diesel_unit_test" >> $GITHUB_ENV
150156
echo "MYSQLCLIENT_LIB_DIR=/usr/local/opt/[email protected]/lib" >> $GITHUB_ENV
151157
158+
- name: Install mysql (MacOS M1)
159+
if: matrix.os == 'macos-14' && matrix.backend == 'mysql'
160+
run: |
161+
brew install [email protected]
162+
ls /opt/homebrew/opt/[email protected]
163+
/opt/homebrew/opt/[email protected]/bin/mysql_install_db
164+
/opt/homebrew/opt/[email protected]/bin/mysql.server start
165+
sleep 3
166+
/opt/homebrew/opt/[email protected]/bin/mysql -e "create database diesel_test; create database diesel_unit_test; grant all on \`diesel_%\`.* to 'runner'@'localhost';" -urunner
167+
echo "MYSQL_DATABASE_URL=mysql://runner@localhost/diesel_test" >> $GITHUB_ENV
168+
echo "MYSQL_EXAMPLE_DATABASE_URL=mysql://runner@localhost/diesel_example" >> $GITHUB_ENV
169+
echo "MYSQL_UNIT_TEST_DATABASE_URL=mysql://runner@localhost/diesel_unit_test" >> $GITHUB_ENV
170+
echo "MYSQLCLIENT_LIB_DIR=/opt/homebrew/opt/[email protected]/lib" >> $GITHUB_ENV
171+
152172
- name: Install sqlite (Windows)
153173
if: runner.os == 'Windows' && matrix.backend == 'sqlite'
154174
shell: cmd
@@ -300,16 +320,13 @@ jobs:
300320
name: Compiletests
301321
runs-on: ubuntu-latest
302322
steps:
303-
- uses: actions/checkout@v3
323+
- uses: actions/checkout@v4
304324
- uses: dtolnay/rust-toolchain@master
305325
with:
306326
toolchain: nightly-2023-09-21
307327
- name: Cache cargo registry
308-
uses: actions/cache@v3
328+
uses: Swatinem/rust-cache@v2
309329
with:
310-
path: |
311-
~/.cargo/registry
312-
~/.cargo/git
313330
key: compile_test-cargo-${{ hashFiles('**/Cargo.toml') }}
314331

315332
- name: Install dependencies
@@ -325,16 +342,13 @@ jobs:
325342
name: Check rustfmt style && run clippy
326343
runs-on: ubuntu-latest
327344
steps:
328-
- uses: actions/checkout@v3
345+
- uses: actions/checkout@v4
329346
- uses: dtolnay/rust-toolchain@stable
330347
with:
331348
components: clippy, rustfmt
332349
- name: Cache cargo registry
333-
uses: actions/cache@v3
350+
uses: Swatinem/rust-cache@v2
334351
with:
335-
path: |
336-
~/.cargo/registry
337-
~/.cargo/git
338352
key: clippy-cargo-${{ hashFiles('**/Cargo.toml') }}
339353

340354
- name: Install dependencies
@@ -405,16 +419,13 @@ jobs:
405419
name: Check sqlite bundled + Sqlite with asan
406420
runs-on: ubuntu-latest
407421
steps:
408-
- uses: actions/checkout@v3
422+
- uses: actions/checkout@v4
409423
- uses: dtolnay/rust-toolchain@nightly
410424
with:
411425
components: "rust-src"
412426
- name: Cache cargo registry
413-
uses: actions/cache@v3
427+
uses: Swatinem/rust-cache@v2
414428
with:
415-
path: |
416-
~/.cargo/registry
417-
~/.cargo/git
418429
key: sqlite_bundled-cargo-${{ hashFiles('**/Cargo.toml') }}
419430

420431
- name: Test diesel-cli
@@ -437,17 +448,14 @@ jobs:
437448
name: Check Minimal supported rust version (1.70.0)
438449
runs-on: ubuntu-latest
439450
steps:
440-
- uses: actions/checkout@v3
451+
- uses: actions/checkout@v4
441452
- uses: dtolnay/[email protected]
442453
- uses: dtolnay/rust-toolchain@nightly
443454
- uses: taiki-e/install-action@cargo-hack
444455
- uses: taiki-e/install-action@cargo-minimal-versions
445456
- name: Cache cargo registry
446-
uses: actions/cache@v3
457+
uses: Swatinem/rust-cache@v2
447458
with:
448-
path: |
449-
~/.cargo/registry
450-
~/.cargo/git
451459
key: minimal_rust_version-cargo-${{ hashFiles('**/Cargo.toml') }}
452460
- name: Install dependencies
453461
run: |
@@ -471,7 +479,7 @@ jobs:
471479

472480
steps:
473481
- name: Checkout Actions Repository
474-
uses: actions/checkout@v3
482+
uses: actions/checkout@v4
475483

476484
- name: Check the spelling of the files in our repo
477485
uses: crate-ci/typos@master

.github/workflows/doc.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout sources
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818
- name: Cache cargo registry
19-
uses: actions/cache@v3
19+
uses: Swatinem/rust-cache@v2
2020
with:
21-
path: |
22-
~/.cargo/registry
23-
~/.cargo/git
2421
key: cargo-doc-cargo-${{ hashFiles('**/Cargo.toml') }}
2522
- name: Get the branch name
2623
id: current_branch

.github/workflows/metrics.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,11 @@ jobs:
2121
backend: ["postgres", "sqlite", "mysql"]
2222
steps:
2323
- name: Checkout sources
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525

2626
- name: cache
27-
uses: actions/cache@v3
27+
uses: Swatinem/rust-cache@v2
2828
with:
29-
path: |
30-
~/.cargo/registry
31-
~/.cargo/git
32-
diesel_bench/target
3329
key: metrics-${{matrix.backend}}-cargo-${{ hashFiles('diesel_bench/Cargo.toml')}}
3430

3531
- name: Install postgres (Linux)

diesel_tests/tests/alias.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn selecting_basic_data() {
2020
user_alias.field(users::name),
2121
user_alias.field(users::hair_color),
2222
))
23+
.order(user_alias.field(users::name))
2324
.load(connection)
2425
.unwrap();
2526

diesel_tests/tests/boxed_queries.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn boxed_queries_can_differ_conditionally() {
3737
}
3838

3939
let source = |query| match query {
40-
Query::All => users::table.into_boxed(),
40+
Query::All => users::table.order(users::name.desc()).into_boxed(),
4141
Query::Ordered => users::table.order(users::name.desc()).into_boxed(),
4242
Query::One => users::table
4343
.filter(users::name.ne("jim"))
@@ -51,7 +51,7 @@ fn boxed_queries_can_differ_conditionally() {
5151
let jim = find_user_by_name("Jim", connection);
5252

5353
let all = source(Query::All).load(connection);
54-
let expected_data = vec![sean.clone(), tess.clone(), jim.clone()];
54+
let expected_data = vec![tess.clone(), sean.clone(), jim.clone()];
5555
assert_eq!(Ok(expected_data), all);
5656

5757
let ordered = source(Query::Ordered).load(connection);
@@ -69,6 +69,7 @@ fn boxed_queries_implement_select_dsl() {
6969
let data = users::table
7070
.into_boxed()
7171
.select(users::name)
72+
.order(users::name)
7273
.load::<String>(connection);
7374
assert_eq!(Ok(vec!["Sean".into(), "Tess".into()]), data);
7475
}
@@ -92,7 +93,11 @@ fn boxed_queries_implement_filter_dsl() {
9293
#[test]
9394
fn boxed_queries_implement_limit_dsl() {
9495
let connection = &mut connection_with_sean_and_tess_in_users_table();
95-
let data = users::table.into_boxed().limit(1).load(connection);
96+
let data = users::table
97+
.into_boxed()
98+
.limit(1)
99+
.order(users::id)
100+
.load(connection);
96101
let expected_data = vec![find_user_by_name("Sean", connection)];
97102
assert_eq!(Ok(expected_data), data);
98103
}
@@ -104,6 +109,7 @@ fn boxed_queries_implement_offset_dsl() {
104109
.into_boxed()
105110
.limit(1)
106111
.offset(1)
112+
.order(users::id)
107113
.load(connection);
108114
let expected_data = vec![find_user_by_name("Tess", connection)];
109115
assert_eq!(Ok(expected_data), data);
@@ -154,6 +160,7 @@ fn boxed_queries_implement_or_filter() {
154160
.into_boxed()
155161
.filter(users::name.eq("Sean"))
156162
.or_filter(users::name.eq("Tess"))
163+
.order(users::name)
157164
.load(connection);
158165
let expected = vec![
159166
find_user_by_name("Sean", connection),

diesel_tests/tests/combination.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn union() {
1313
NewUser::new("Jim", None),
1414
];
1515
insert_into(users).values(&data).execute(conn).unwrap();
16-
let data = users.load::<User>(conn).unwrap();
16+
let data = users.order(id).load::<User>(conn).unwrap();
1717
let sean = &data[0];
1818
let tess = &data[1];
1919
let jim = &data[2];
@@ -43,7 +43,7 @@ fn union_all() {
4343
NewUser::new("Jim", None),
4444
];
4545
insert_into(users).values(&data).execute(conn).unwrap();
46-
let data = users.load::<User>(conn).unwrap();
46+
let data = users.order(id).load::<User>(conn).unwrap();
4747
let sean = &data[0];
4848
let tess = &data[1];
4949
let jim = &data[2];
@@ -75,10 +75,10 @@ fn intersect() {
7575
NewUser::new("Jim", None),
7676
];
7777
insert_into(users).values(&data).execute(conn).unwrap();
78-
let data = users.load::<User>(conn).unwrap();
79-
let _sean = &data[0];
80-
let tess = &data[1];
81-
let _jim = &data[2];
78+
let data = users.order(name).load::<User>(conn).unwrap();
79+
let _sean = &data[1];
80+
let tess = &data[2];
81+
let _jim = &data[0];
8282

8383
let expected_data = vec![User::new(tess.id, "Tess")];
8484
let data: Vec<_> = users
@@ -171,6 +171,7 @@ fn as_subquery_for_eq_in() {
171171
let out = posts::table
172172
.filter(posts::user_id.eq_any(subquery))
173173
.select(posts::title)
174+
.order_by(posts::title)
174175
.load::<String>(conn)
175176
.unwrap();
176177

diesel_tests/tests/deserialization.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@ fn generated_queryable_allows_lifetimes() {
2222
};
2323
assert_eq!(
2424
Ok(expected_user),
25-
users.select((id, name)).first(connection)
25+
users.select((id, name)).order(id).first(connection)
2626
);
2727
assert_eq!(
28-
users.select((id, name)).first::<CowUser<'_>>(connection),
29-
users.select(CowUser::as_select()).first(connection)
28+
users
29+
.select((id, name))
30+
.order(id)
31+
.first::<CowUser<'_>>(connection),
32+
users
33+
.select(CowUser::as_select())
34+
.order(id)
35+
.first(connection)
3036
);
3137
}
3238

diesel_tests/tests/distinct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ fn distinct_of_multiple_columns() {
178178
.execute(&mut connection)
179179
.unwrap();
180180
let posts = posts::table
181-
.order(posts::id)
181+
.order(posts::title)
182182
.load::<Post>(&mut connection)
183183
.unwrap();
184184

diesel_tests/tests/expressions/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ fn function_with_multiple_arguments() {
238238
let expected_data = vec!["black".to_string(), "Tess".to_string()];
239239
let data = users
240240
.select(coalesce(hair_color, name))
241+
.order(id)
241242
.load::<String>(connection);
242243

243244
assert_eq!(Ok(expected_data), data);

0 commit comments

Comments
 (0)