Skip to content

Commit

Permalink
Merge pull request #7 from estie-inc/fix/github-ci
Browse files Browse the repository at this point in the history
Updated the CI to replace the outdated actions with the new ones
  • Loading branch information
kenkoooo authored Dec 2, 2023
2 parents aed6768 + 7e39c8d commit 95db309
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 60 deletions.
68 changes: 13 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,65 +7,23 @@ on:
- main
env:
RUSTFLAGS: -Dwarnings
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- run: rustup component add rustfmt

- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}

- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features

test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
version: [1.68, stable]
name: Test with Rust ${{ matrix.version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true

- uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-test

- uses: actions-rs/cargo@v1
with:
command: test
toolchain: ${{ matrix.version }}
components: rustfmt, clippy
- run: cargo fmt --all -- --check
- run: cargo clippy --all-targets --all-features
- run: cargo test
7 changes: 2 additions & 5 deletions tests/test_utils/mock_database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ use std::sync::{Arc, Mutex};

// async insertion is done in random order, so records has to be sorted before testing
pub fn sort_records_by_ids<T>(records: Vec<T>, ids: Vec<i64>) -> Vec<T> {
let mut indexed_records = ids
.iter()
.zip(records.into_iter())
.collect::<Vec<(&i64, T)>>();
let mut indexed_records = ids.iter().zip(records).collect::<Vec<(&i64, T)>>();
indexed_records.sort_unstable_by_key(|(i, _)| *i);
indexed_records
.into_iter()
Expand All @@ -34,7 +31,7 @@ where
T: Clone,
{
pub fn new(ids_by_name: Vec<(String, i64)>) -> Self {
let ids_by_name = HashMap::from_iter(ids_by_name.into_iter());
let ids_by_name = HashMap::from_iter(ids_by_name);

MockTable {
ids_by_name: Arc::new(Mutex::new(ids_by_name)),
Expand Down

0 comments on commit 95db309

Please sign in to comment.