2023-03-07 21:55:09 +08:00
|
|
|
name: Test suite
|
2021-02-24 17:31:28 +08:00
|
|
|
|
2021-03-16 17:26:08 +08:00
|
|
|
on:
|
2021-05-11 18:18:10 +08:00
|
|
|
workflow_dispatch:
|
2023-02-14 23:23:02 +08:00
|
|
|
schedule:
|
|
|
|
# Everyday at 5:00am
|
2023-03-03 20:08:30 +08:00
|
|
|
- cron: '0 5 * * *'
|
2021-03-16 17:26:08 +08:00
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
# trying and staging branches are for Bors config
|
|
|
|
branches:
|
|
|
|
- trying
|
|
|
|
- staging
|
2021-02-24 17:31:28 +08:00
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
2021-12-22 19:26:29 +08:00
|
|
|
RUST_BACKTRACE: 1
|
2022-05-04 21:20:45 +08:00
|
|
|
RUSTFLAGS: "-D warnings"
|
2021-02-24 17:31:28 +08:00
|
|
|
|
|
|
|
jobs:
|
2022-12-19 17:46:29 +08:00
|
|
|
test-linux:
|
|
|
|
name: Tests on ubuntu-18.04
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2022-12-20 01:46:27 +08:00
|
|
|
# Use ubuntu-18.04 to compile with glibc 2.27, which are the production expectations
|
2022-12-19 17:46:29 +08:00
|
|
|
image: ubuntu:18.04
|
|
|
|
steps:
|
2023-02-18 22:30:44 +08:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install needed dependencies
|
|
|
|
run: |
|
|
|
|
apt-get update && apt-get install -y curl
|
|
|
|
apt-get install build-essential -y
|
|
|
|
- name: Run test with Rust stable
|
|
|
|
if: github.event_name != 'schedule'
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
|
|
|
- name: Run test with Rust nightly
|
|
|
|
if: github.event_name == 'schedule'
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: nightly
|
|
|
|
override: true
|
2023-03-13 21:24:15 +08:00
|
|
|
- name: Cache dependencies
|
2023-04-02 01:58:46 +08:00
|
|
|
uses: Swatinem/rust-cache@v2.2.1
|
2023-02-18 22:30:44 +08:00
|
|
|
- name: Run cargo check without any default features
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --locked --release --no-default-features --all
|
|
|
|
- name: Run cargo test
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --locked --release --all
|
2022-12-19 17:46:29 +08:00
|
|
|
|
|
|
|
test-others:
|
2021-03-23 02:17:18 +08:00
|
|
|
name: Tests on ${{ matrix.os }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-12-20 18:10:09 +08:00
|
|
|
os: [macos-12, windows-2022]
|
2021-03-23 02:17:18 +08:00
|
|
|
steps:
|
2023-02-18 22:30:44 +08:00
|
|
|
- uses: actions/checkout@v3
|
2023-03-13 21:24:15 +08:00
|
|
|
- name: Cache dependencies
|
2023-04-02 01:58:46 +08:00
|
|
|
uses: Swatinem/rust-cache@v2.2.1
|
2023-02-18 22:30:44 +08:00
|
|
|
- name: Run cargo check without any default features
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --locked --release --no-default-features --all
|
|
|
|
- name: Run cargo test
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --locked --release --all
|
|
|
|
|
|
|
|
test-all-features:
|
2023-03-03 20:07:42 +08:00
|
|
|
name: Tests all features on cron schedule only
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
# Use ubuntu-18.04 to compile with glibc 2.27, which are the production expectations
|
|
|
|
image: ubuntu:18.04
|
2023-02-18 22:30:44 +08:00
|
|
|
if: github.event_name == 'schedule'
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2023-03-06 20:08:32 +08:00
|
|
|
- name: Install needed dependencies
|
|
|
|
run: |
|
|
|
|
apt-get update
|
|
|
|
apt-get install --assume-yes build-essential curl
|
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
2023-02-18 22:30:44 +08:00
|
|
|
- name: Run cargo build with all features
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --workspace --locked --release --all-features
|
|
|
|
- name: Run cargo test with all features
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --workspace --locked --release --all-features
|
2021-02-24 17:31:28 +08:00
|
|
|
|
2022-03-17 00:13:49 +08:00
|
|
|
# We run tests in debug also, to make sure that the debug_assertions are hit
|
|
|
|
test-debug:
|
|
|
|
name: Run tests in debug
|
2022-12-19 17:46:29 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2022-12-20 01:46:27 +08:00
|
|
|
# Use ubuntu-18.04 to compile with glibc 2.27, which are the production expectations
|
2022-12-19 17:46:29 +08:00
|
|
|
image: ubuntu:18.04
|
2022-03-17 00:13:49 +08:00
|
|
|
steps:
|
2022-06-29 04:21:41 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-12-20 01:35:33 +08:00
|
|
|
- name: Install needed dependencies
|
2022-12-19 17:46:29 +08:00
|
|
|
run: |
|
|
|
|
apt-get update && apt-get install -y curl
|
|
|
|
apt-get install build-essential -y
|
2022-03-17 00:13:49 +08:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
2023-03-13 21:24:15 +08:00
|
|
|
- name: Cache dependencies
|
2023-04-02 01:58:46 +08:00
|
|
|
uses: Swatinem/rust-cache@v2.2.1
|
2022-03-17 00:13:49 +08:00
|
|
|
- name: Run tests in debug
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
2023-01-20 00:25:21 +08:00
|
|
|
args: --locked --all
|
2022-03-17 00:13:49 +08:00
|
|
|
|
2021-03-23 02:17:18 +08:00
|
|
|
clippy:
|
|
|
|
name: Run Clippy
|
2022-12-19 17:46:29 +08:00
|
|
|
runs-on: ubuntu-latest
|
2021-03-23 02:17:18 +08:00
|
|
|
steps:
|
2022-06-29 04:21:41 +08:00
|
|
|
- uses: actions/checkout@v3
|
2021-03-23 02:17:18 +08:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2023-04-25 22:05:28 +08:00
|
|
|
toolchain: 1.69.0
|
2021-03-23 02:17:18 +08:00
|
|
|
override: true
|
|
|
|
components: clippy
|
2023-03-13 21:24:15 +08:00
|
|
|
- name: Cache dependencies
|
2023-04-02 01:58:46 +08:00
|
|
|
uses: Swatinem/rust-cache@v2.2.1
|
2021-03-23 02:17:18 +08:00
|
|
|
- name: Run cargo clippy
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: clippy
|
2023-02-07 16:28:58 +08:00
|
|
|
args: --all-targets -- --deny warnings
|
2021-06-29 21:25:18 +08:00
|
|
|
|
|
|
|
fmt:
|
|
|
|
name: Run Rustfmt
|
2022-12-19 17:46:29 +08:00
|
|
|
runs-on: ubuntu-latest
|
2021-06-29 21:25:18 +08:00
|
|
|
steps:
|
2022-06-29 04:21:41 +08:00
|
|
|
- uses: actions/checkout@v3
|
2021-06-29 21:25:18 +08:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2022-12-08 18:51:13 +08:00
|
|
|
toolchain: nightly
|
2021-06-29 21:25:18 +08:00
|
|
|
override: true
|
|
|
|
components: rustfmt
|
2023-03-13 21:24:15 +08:00
|
|
|
- name: Cache dependencies
|
2023-04-02 01:58:46 +08:00
|
|
|
uses: Swatinem/rust-cache@v2.2.1
|
2021-06-29 21:25:18 +08:00
|
|
|
- name: Run cargo fmt
|
2023-01-17 23:26:03 +08:00
|
|
|
# Since we never ran the `build.rs` script in the benchmark directory we are missing one auto-generated import file.
|
|
|
|
# Since we want to trigger (and fail) this action as fast as possible, instead of building the benchmark crate
|
|
|
|
# we are going to create an empty file where rustfmt expects it.
|
|
|
|
run: |
|
|
|
|
echo -ne "\n" > benchmarks/benches/datasets_paths.rs
|
|
|
|
cargo fmt --all -- --check
|