The push and pull_request triggers both matched every branch, so each PR kicked off two identical runs of lint, the three-OS test matrix and the soulfind e2e job. Push now only covers master; branches are covered by the pull_request trigger. Adds a concurrency group so a follow-up push cancels the superseded run instead of queueing behind it.
100 lines
2.3 KiB
YAML
100 lines
2.3 KiB
YAML
name: CI
|
|
|
|
# Branch pushes are covered by the pull_request trigger. Listening to both for
|
|
# every branch ran the whole matrix twice per PR.
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: ['**']
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
RUST_BACKTRACE: 1
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Run clippy
|
|
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
|
|
|
|
format:
|
|
name: Format Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt --all -- --check
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
rust: [stable]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Run tests
|
|
run: cargo test --verbose
|
|
|
|
e2e:
|
|
name: End-to-end (soulfind)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- uses: Swatinem/rust-cache@v2
|
|
|
|
- name: Install SQLite runtime/dev libraries
|
|
run: sudo apt-get update && sudo apt-get install -y libsqlite3-dev
|
|
|
|
- name: Install D toolchain (LDC)
|
|
uses: dlang-community/setup-dlang@v2
|
|
with:
|
|
compiler: ldc-latest
|
|
|
|
- name: Build soulfind server
|
|
run: |
|
|
git clone --depth 1 https://github.com/soulfind-dev/soulfind.git soulfind
|
|
dub build :server --root soulfind
|
|
test -x soulfind/bin/soulfind
|
|
echo "SOULFIND_BIN=$PWD/soulfind/bin/soulfind" >> "$GITHUB_ENV"
|
|
|
|
- name: Run e2e tests (required against soulfind)
|
|
env:
|
|
SOULSEEK_E2E_REQUIRED: "1"
|
|
run: cargo test -p soulseek-rs-lib --test e2e -- --nocapture
|