2023-03-07 14:55:09 +01:00
|
|
|
name: Test suite
|
2021-02-24 10:31:28 +01:00
|
|
|
|
2021-03-16 10:26:08 +01:00
|
|
|
on:
|
2021-05-11 12:18:10 +02:00
|
|
|
workflow_dispatch:
|
2023-02-14 16:23:02 +01:00
|
|
|
schedule:
|
|
|
|
# Everyday at 5:00am
|
2023-03-03 13:08:30 +01:00
|
|
|
- cron: '0 5 * * *'
|
2021-03-16 10:26:08 +01:00
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
# trying and staging branches are for Bors config
|
|
|
|
branches:
|
|
|
|
- trying
|
|
|
|
- staging
|
2021-02-24 10:31:28 +01:00
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
2021-12-22 12:26:29 +01:00
|
|
|
RUST_BACKTRACE: 1
|
2022-05-04 15:20:45 +02:00
|
|
|
RUSTFLAGS: "-D warnings"
|
2021-02-24 10:31:28 +01:00
|
|
|
|
|
|
|
jobs:
|
2022-12-19 10:46:29 +01:00
|
|
|
test-linux:
|
|
|
|
name: Tests on ubuntu-18.04
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2022-12-19 18:46:27 +01:00
|
|
|
# Use ubuntu-18.04 to compile with glibc 2.27, which are the production expectations
|
2022-12-19 10:46:29 +01:00
|
|
|
image: ubuntu:18.04
|
|
|
|
steps:
|
2023-02-18 15:30:44 +01:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install needed dependencies
|
|
|
|
run: |
|
|
|
|
apt-get update && apt-get install -y curl
|
|
|
|
apt-get install build-essential -y
|
2023-07-12 11:16:01 +02:00
|
|
|
- name: Setup test with Rust stable
|
2023-02-18 15:30:44 +01:00
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
2023-03-13 14:24:15 +01:00
|
|
|
- name: Cache dependencies
|
2023-11-01 18:57:42 +01:00
|
|
|
uses: Swatinem/rust-cache@v2.7.1
|
2023-02-18 15:30:44 +01: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 10:46:29 +01:00
|
|
|
|
|
|
|
test-others:
|
2021-03-22 19:17:18 +01:00
|
|
|
name: Tests on ${{ matrix.os }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-12-20 11:10:09 +01:00
|
|
|
os: [macos-12, windows-2022]
|
2021-03-22 19:17:18 +01:00
|
|
|
steps:
|
2024-05-29 11:14:12 +02:00
|
|
|
- name: Check free disk space on C
|
|
|
|
run: |
|
|
|
|
fsutil volume diskfree c:
|
|
|
|
- name: Check free disk space on D
|
|
|
|
run: |
|
|
|
|
fsutil volume diskfree d:
|
2023-02-18 15:30:44 +01:00
|
|
|
- uses: actions/checkout@v3
|
2023-03-13 14:24:15 +01:00
|
|
|
- name: Cache dependencies
|
2023-11-01 18:57:42 +01:00
|
|
|
uses: Swatinem/rust-cache@v2.7.1
|
2024-01-16 18:10:30 +01:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
2024-05-29 11:14:12 +02:00
|
|
|
- name: Check free disk space on C
|
|
|
|
run: |
|
|
|
|
fsutil volume diskfree c:
|
|
|
|
- name: Check free disk space on D
|
|
|
|
run: |
|
|
|
|
fsutil volume diskfree d:
|
2023-02-18 15:30:44 +01:00
|
|
|
- name: Run cargo check without any default features
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --locked --release --no-default-features --all
|
2024-05-29 11:14:12 +02:00
|
|
|
- name: Check free disk space on C
|
|
|
|
run: |
|
|
|
|
fsutil volume diskfree c:
|
|
|
|
- name: Check free disk space on D
|
|
|
|
run: |
|
|
|
|
fsutil volume diskfree d:
|
2023-02-18 15:30:44 +01:00
|
|
|
- name: Run cargo test
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
|
|
|
args: --locked --release --all
|
|
|
|
|
|
|
|
test-all-features:
|
2024-01-09 13:25:31 +01:00
|
|
|
name: Tests almost all features
|
2023-03-03 13:07:42 +01:00
|
|
|
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-08-09 16:47:28 +02:00
|
|
|
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
2023-02-18 15:30:44 +01:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
2023-03-06 13:08:32 +01: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
|
2024-01-09 13:25:31 +01:00
|
|
|
- name: Run cargo build with almost all features
|
|
|
|
run: |
|
|
|
|
cargo build --workspace --locked --release --features "$(cargo xtask list-features --exclude-feature cuda)"
|
|
|
|
- name: Run cargo test with almost all features
|
|
|
|
run: |
|
|
|
|
cargo test --workspace --locked --release --features "$(cargo xtask list-features --exclude-feature cuda)"
|
2021-02-24 10:31:28 +01:00
|
|
|
|
2023-05-11 22:28:04 +02:00
|
|
|
test-disabled-tokenization:
|
2023-05-25 10:02:57 +02:00
|
|
|
name: Test disabled tokenization
|
2023-05-11 22:28:04 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
image: ubuntu:18.04
|
2023-08-09 16:47:28 +02:00
|
|
|
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
2023-05-11 22:28:04 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Install needed dependencies
|
|
|
|
run: |
|
|
|
|
apt-get update
|
|
|
|
apt-get install --assume-yes build-essential curl
|
2023-07-12 11:16:01 +02:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
2023-05-25 10:03:45 +02:00
|
|
|
- name: Run cargo tree without default features and check lindera is not present
|
2023-05-11 22:28:04 +02:00
|
|
|
run: |
|
2023-09-11 12:30:53 +02:00
|
|
|
if cargo tree -f '{p} {f}' -e normal --no-default-features | grep -vqz lindera; then
|
|
|
|
echo "lindera has been found in the sources and it shouldn't"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-05-25 10:04:07 +02:00
|
|
|
- name: Run cargo tree with default features and check lindera is pressent
|
2023-05-11 22:28:04 +02:00
|
|
|
run: |
|
|
|
|
cargo tree -f '{p} {f}' -e normal | grep lindera -qz
|
2023-07-12 11:16:01 +02:00
|
|
|
|
2022-03-16 17:13:49 +01: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 10:46:29 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2022-12-19 18:46:27 +01:00
|
|
|
# Use ubuntu-18.04 to compile with glibc 2.27, which are the production expectations
|
2022-12-19 10:46:29 +01:00
|
|
|
image: ubuntu:18.04
|
2022-03-16 17:13:49 +01:00
|
|
|
steps:
|
2022-06-28 22:21:41 +02:00
|
|
|
- uses: actions/checkout@v3
|
2022-12-19 18:35:33 +01:00
|
|
|
- name: Install needed dependencies
|
2022-12-19 10:46:29 +01:00
|
|
|
run: |
|
|
|
|
apt-get update && apt-get install -y curl
|
|
|
|
apt-get install build-essential -y
|
2022-03-16 17:13:49 +01:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
override: true
|
2023-03-13 14:24:15 +01:00
|
|
|
- name: Cache dependencies
|
2023-11-01 18:57:42 +01:00
|
|
|
uses: Swatinem/rust-cache@v2.7.1
|
2022-03-16 17:13:49 +01:00
|
|
|
- name: Run tests in debug
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: test
|
2023-01-19 17:25:21 +01:00
|
|
|
args: --locked --all
|
2022-03-16 17:13:49 +01:00
|
|
|
|
2021-03-22 19:17:18 +01:00
|
|
|
clippy:
|
|
|
|
name: Run Clippy
|
2022-12-19 10:46:29 +01:00
|
|
|
runs-on: ubuntu-latest
|
2021-03-22 19:17:18 +01:00
|
|
|
steps:
|
2022-06-28 22:21:41 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-03-22 19:17:18 +01:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2024-01-16 16:36:54 +01:00
|
|
|
toolchain: 1.75.0
|
2021-03-22 19:17:18 +01:00
|
|
|
override: true
|
|
|
|
components: clippy
|
2023-03-13 14:24:15 +01:00
|
|
|
- name: Cache dependencies
|
2023-11-01 18:57:42 +01:00
|
|
|
uses: Swatinem/rust-cache@v2.7.1
|
2021-03-22 19:17:18 +01:00
|
|
|
- name: Run cargo clippy
|
|
|
|
uses: actions-rs/cargo@v1
|
|
|
|
with:
|
|
|
|
command: clippy
|
2023-02-07 09:28:58 +01:00
|
|
|
args: --all-targets -- --deny warnings
|
2021-06-29 15:25:18 +02:00
|
|
|
|
|
|
|
fmt:
|
|
|
|
name: Run Rustfmt
|
2022-12-19 10:46:29 +01:00
|
|
|
runs-on: ubuntu-latest
|
2021-06-29 15:25:18 +02:00
|
|
|
steps:
|
2022-06-28 22:21:41 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-06-29 15:25:18 +02:00
|
|
|
- uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
profile: minimal
|
2022-12-08 11:51:13 +01:00
|
|
|
toolchain: nightly
|
2021-06-29 15:25:18 +02:00
|
|
|
override: true
|
|
|
|
components: rustfmt
|
2023-03-13 14:24:15 +01:00
|
|
|
- name: Cache dependencies
|
2023-11-01 18:57:42 +01:00
|
|
|
uses: Swatinem/rust-cache@v2.7.1
|
2021-06-29 15:25:18 +02:00
|
|
|
- name: Run cargo fmt
|
2023-01-17 16:26:03 +01: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
|