2022-12-15 09:03:56 -07:00
|
|
|
name: Server Tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
2023-03-03 07:07:27 -07:00
|
|
|
- ".github/workflows/tests.yaml"
|
2022-12-15 09:03:56 -07:00
|
|
|
- "server/**"
|
|
|
|
- "proto/**"
|
2022-12-16 03:29:36 -07:00
|
|
|
- "router/**"
|
|
|
|
- "launcher/**"
|
2023-03-23 11:01:30 -06:00
|
|
|
- "Cargo.lock"
|
|
|
|
- "rust-toolchain.toml"
|
2022-12-15 09:03:56 -07:00
|
|
|
|
2023-03-24 07:02:14 -06:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-12-15 09:03:56 -07:00
|
|
|
jobs:
|
|
|
|
run_tests:
|
2024-04-30 08:19:59 -06:00
|
|
|
runs-on: [ubuntu-latest]
|
|
|
|
|
|
|
|
env:
|
|
|
|
SCCACHE_GHA_ENABLED: "on"
|
|
|
|
RUSTC_WRAPPER: /usr/local/bin/sccache
|
|
|
|
SCCACHE: 0.3.3
|
|
|
|
|
|
|
|
steps:
|
2024-04-30 08:28:21 -06:00
|
|
|
- uses: actions/checkout@v4
|
2024-04-30 08:19:59 -06:00
|
|
|
- name: Set up Python
|
2024-04-30 08:25:03 -06:00
|
|
|
uses: actions/setup-python@v5
|
2024-04-30 08:19:59 -06:00
|
|
|
with:
|
2024-04-30 08:28:21 -06:00
|
|
|
python-version: 3.9
|
2024-04-30 08:19:59 -06:00
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
# Released on: 28 December, 2023
|
|
|
|
# Branched from master on: 10 November, 2023
|
|
|
|
# https://releases.rs/docs/1.75.0/
|
|
|
|
toolchain: 1.75.0
|
|
|
|
override: true
|
|
|
|
components: rustfmt, clippy
|
|
|
|
- name: Install Protoc
|
|
|
|
uses: arduino/setup-protoc@v1
|
|
|
|
- name: Clean unused files
|
|
|
|
run: |
|
|
|
|
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
|
|
|
|
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
|
|
|
|
- name: Install sccache
|
|
|
|
run: |
|
|
|
|
curl -fsSL https://github.com/mozilla/sccache/releases/download/v$SCCACHE/sccache-v$SCCACHE-x86_64-unknown-linux-musl.tar.gz | tar -xzv --strip-components=1 -C /usr/local/bin sccache-v$SCCACHE-x86_64-unknown-linux-musl/sccache
|
|
|
|
chmod +x /usr/local/bin/sccache
|
|
|
|
- name: configure sccache
|
|
|
|
uses: actions/github-script@v6
|
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
|
|
|
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
|
|
|
core.exportVariable('SCCACHE_GHA_CACHE_TO', 'sccache-${{runner.os}}-${{github.ref_name}}');
|
|
|
|
core.exportVariable('SCCACHE_GHA_CACHE_FROM', 'sccache-${{runner.os}}-main,sccache-${{runner.os}}-');
|
|
|
|
- name: cargo registry cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-
|
|
|
|
cargo-${{ runner.os }}-
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
- name: Install
|
|
|
|
run: |
|
|
|
|
make install
|
|
|
|
- name: Run server tests
|
|
|
|
run: |
|
|
|
|
pip install pytest
|
|
|
|
export HUGGING_FACE_HUB_TOKEN=${{ secrets.HUGGING_FACE_HUB_TOKEN }}
|
|
|
|
pytest -s -vv server/tests
|
|
|
|
- name: Pre-commit checks
|
|
|
|
run: |
|
|
|
|
pip install pre-commit
|
|
|
|
pre-commit install
|
|
|
|
pre-commit run --all-files
|
|
|
|
- name: Run Rust tests
|
|
|
|
run: |
|
|
|
|
cargo test
|
|
|
|
- name: sccache stats
|
|
|
|
run: |
|
|
|
|
/usr/local/bin/sccache --show-stats
|
|
|
|
|
|
|
|
run_tests_intel_xpu:
|
2024-04-30 08:22:33 -06:00
|
|
|
runs-on:
|
|
|
|
group: intel-pvc-tgi
|
2023-03-03 07:07:27 -07:00
|
|
|
|
|
|
|
env:
|
|
|
|
SCCACHE_GHA_ENABLED: "on"
|
|
|
|
RUSTC_WRAPPER: /usr/local/bin/sccache
|
|
|
|
SCCACHE: 0.3.3
|
|
|
|
|
2022-12-15 09:03:56 -07:00
|
|
|
steps:
|
2024-04-30 08:28:21 -06:00
|
|
|
- uses: actions/checkout@v4
|
2022-12-15 09:03:56 -07:00
|
|
|
- name: Set up Python
|
2024-04-30 08:28:21 -06:00
|
|
|
uses: actions/setup-python@v5
|
2022-12-15 09:03:56 -07:00
|
|
|
with:
|
2024-04-30 08:28:21 -06:00
|
|
|
python-version: 3.8
|
2022-12-16 03:29:36 -07:00
|
|
|
- name: Install Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
2024-05-06 05:48:11 -06:00
|
|
|
# Released on: 02 May, 2024
|
|
|
|
# https://releases.rs/docs/1.78.0/
|
|
|
|
toolchain: 1.78.0
|
2022-12-16 03:29:36 -07:00
|
|
|
override: true
|
|
|
|
components: rustfmt, clippy
|
2023-02-13 05:02:45 -07:00
|
|
|
- name: Install Protoc
|
|
|
|
uses: arduino/setup-protoc@v1
|
2024-02-21 03:05:32 -07:00
|
|
|
- name: Clean unused files
|
|
|
|
run: |
|
2024-04-30 08:29:55 -06:00
|
|
|
rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
|
|
|
|
rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
|
2023-03-03 07:07:27 -07:00
|
|
|
- name: Install sccache
|
|
|
|
run: |
|
2024-04-30 08:38:31 -06:00
|
|
|
curl -fsSL https://github.com/mozilla/sccache/releases/download/v$SCCACHE/sccache-v$SCCACHE-x86_64-unknown-linux-musl.tar.gz | tar -xzv --strip-components=1 -C /usr/bin sccache-v$SCCACHE-x86_64-unknown-linux-musl/sccache
|
|
|
|
chmod +x /usr/bin/sccache
|
2023-03-03 07:07:27 -07:00
|
|
|
- name: configure sccache
|
|
|
|
uses: actions/github-script@v6
|
2022-12-15 09:03:56 -07:00
|
|
|
with:
|
2023-03-03 07:07:27 -07:00
|
|
|
script: |
|
|
|
|
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
|
|
|
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
|
|
|
core.exportVariable('SCCACHE_GHA_CACHE_TO', 'sccache-${{runner.os}}-${{github.ref_name}}');
|
|
|
|
core.exportVariable('SCCACHE_GHA_CACHE_FROM', 'sccache-${{runner.os}}-main,sccache-${{runner.os}}-');
|
|
|
|
- name: cargo registry cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-
|
|
|
|
cargo-${{ runner.os }}-
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
2022-12-16 03:29:36 -07:00
|
|
|
- name: Install
|
2022-12-15 09:03:56 -07:00
|
|
|
run: |
|
2022-12-16 03:29:36 -07:00
|
|
|
make install
|
|
|
|
- name: Run server tests
|
2022-12-15 09:03:56 -07:00
|
|
|
run: |
|
|
|
|
pip install pytest
|
2023-05-16 15:23:27 -06:00
|
|
|
export HUGGING_FACE_HUB_TOKEN=${{ secrets.HUGGING_FACE_HUB_TOKEN }}
|
|
|
|
pytest -s -vv server/tests
|
2024-02-16 03:58:58 -07:00
|
|
|
- name: Pre-commit checks
|
2023-04-26 12:23:54 -06:00
|
|
|
run: |
|
2024-02-16 03:58:58 -07:00
|
|
|
pip install pre-commit
|
|
|
|
pre-commit install
|
|
|
|
pre-commit run --all-files
|
2022-12-16 03:29:36 -07:00
|
|
|
- name: Run Rust tests
|
|
|
|
run: |
|
|
|
|
cargo test
|
2023-03-03 07:07:27 -07:00
|
|
|
- name: sccache stats
|
|
|
|
run: |
|
2024-04-30 08:38:31 -06:00
|
|
|
/usr/bin/sccache --show-stats
|