Skip to content

refactor(core): remove CodeRepositoryAccess, add AllowedCodeRepositor… #4209

refactor(core): remove CodeRepositoryAccess, add AllowedCodeRepositor…

refactor(core): remove CodeRepositoryAccess, add AllowedCodeRepositor… #4209

Workflow file for this run

name: Test Rust
on:
push:
branches: [ "main" ]
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'crates/**'
- 'ee/**'
- '!ee/tabby-ui/**'
- '.github/workflows/test-rust.yml'
pull_request:
branches: [ "main" ]
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'crates/**'
- 'ee/**'
- '!ee/tabby-ui/**'
- '.github/workflows/test-rust.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
# If this is enabled it will cancel current running and start latest
cancel-in-progress: true
env:
RUST_TOOLCHAIN: 1.76.0
jobs:
tests:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: sccache
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Sccache cache
uses: mozilla-actions/[email protected]
with:
version: "v0.4.0"
- 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
- run: sudo bash ./ci/prepare_build_environment.sh
- name: Run doc tests
run: cargo test --doc
- name: Run unit tests on community build
run: cargo test --bin tabby --no-default-features
- name: Run unit tests
run: cargo test --bin tabby --lib
coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: sccache
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Sccache cache
uses: mozilla-actions/[email protected]
with:
version: "v0.4.0"
- 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
- run: sudo bash ./ci/prepare_build_environment.sh
- name: Generate code coverage
env:
CI_COVERAGE: 1
run: cargo llvm-cov --bin tabby --lib --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: lcov.info
fail_ci_if_error: true