Use cargo nextest

This commit is contained in:
bitfl0wer 2024-07-24 13:58:19 +02:00
parent 7a2666bde2
commit 6cd3c1081b
No known key found for this signature in database
GPG Key ID: 0ACD574FCF5226CF
1 changed files with 103 additions and 126 deletions

View File

@ -2,153 +2,130 @@ name: Build and Test
on: on:
push: push:
branches: [ "main" ] branches: ["main"]
pull_request: pull_request:
branches: [ "main", "dev" ] branches: ["main", "dev"]
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
jobs: jobs:
linux: linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30 timeout-minutes: 30
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Clone spacebar server - name: Clone spacebar server
run: | run: |
git clone https://github.com/bitfl0wer/server.git git clone https://github.com/bitfl0wer/server.git
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 18 node-version: 18
cache: 'npm' cache: "npm"
cache-dependency-path: server/package-lock.json cache-dependency-path: server/package-lock.json
- name: Prepare and start Spacebar server - name: Prepare and start Spacebar server
run: | run: |
npm install npm install
npm run setup npm run setup
npm run start & npm run start &
working-directory: ./server working-directory: ./server
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
cache-all-crates: "true" cache-all-crates: "true"
prefix-key: "linux" prefix-key: "linux"
- name: Build, Test and Publish Coverage - uses: taiki-e/install-action@nextest
run: | - name: Build, Test with nextest, Publish Coverage
if [ -n "${{ secrets.COVERALLS_REPO_TOKEN }}" ]; then run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash if [ -n "${{ secrets.COVERALLS_REPO_TOKEN }}" ]; then
cargo binstall --no-confirm cargo-tarpaulin --force if [ "${github.event.pull_request.head.ref}" = "main" ]; then
cargo tarpaulin --all-features --avoid-cfg-tarpaulin --tests --verbose --skip-clean --coveralls ${{ secrets.COVERALLS_REPO_TOKEN }} --timeout 120 curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
else cargo binstall --no-confirm cargo-tarpaulin --force
echo "Code Coverage step is skipped on forks!" cargo tarpaulin --all-features --avoid-cfg-tarpaulin --tests --verbose --skip-clean --coveralls ${{ secrets.COVERALLS_REPO_TOKEN }} --timeout 120
cargo build --verbose --all-features else
cargo test --verbose --all-features echo "Code Coverage step is skipped on non-main PRs and PRs from forks."
fi cargo build --verbose --all-features
- name: Check common non-default feature configurations cargo nextest run --verbose --all-features
run: | fi
echo "No features:" else
cargo check --features="" --no-default-features echo "Code Coverage step is skipped on non-main PRs and PRs from forks."
echo "Only client:" cargo build --verbose --all-features
cargo check --features="client" --no-default-features cargo nextest run --verbose --all-features
echo "Only backend:" fi
cargo check --features="backend" --no-default-features - name: Check common non-default feature configurations
echo "Only voice:" run: |
cargo check --features="voice" --no-default-features echo "No features:"
echo "Only voice gateway:" cargo check --features="" --no-default-features
cargo check --features="voice_gateway" --no-default-features echo "Only client:"
echo "Backend + client:" cargo check --features="client" --no-default-features
cargo check --features="backend, client" --no-default-features echo "Only backend:"
echo "Backend + voice:" cargo check --features="backend" --no-default-features
cargo check --features="backend, voice" --no-default-features echo "Only voice:"
echo "Backend + voice gateway:" cargo check --features="voice" --no-default-features
cargo check --features="backend, voice_gateway" --no-default-features echo "Only voice gateway:"
echo "Client + voice gateway:" cargo check --features="voice_gateway" --no-default-features
cargo check --features="client, voice_gateway" --no-default-features echo "Backend + client:"
# wasm-safari: cargo check --features="backend, client" --no-default-features
# runs-on: macos-latest echo "Backend + voice:"
# steps: cargo check --features="backend, voice" --no-default-features
# - uses: actions/checkout@v4 echo "Backend + voice gateway:"
# - name: Clone spacebar server cargo check --features="backend, voice_gateway" --no-default-features
# run: | echo "Client + voice gateway:"
# git clone https://github.com/bitfl0wer/server.git cargo check --features="client, voice_gateway" --no-default-features
# - uses: actions/setup-node@v4
# with:
# node-version: 18
# cache: 'npm'
# cache-dependency-path: server/package-lock.json
# - name: Prepare and start Spacebar server
# run: |
# npm install
# npm run setup
# npm run start &
# working-directory: ./server
# - uses: Swatinem/rust-cache@v2
# with:
# cache-all-crates: "true"
# prefix-key: "macos-safari"
# - name: Run WASM tests with Safari, Firefox, Chrome
# run: |
# rustup target add wasm32-unknown-unknown
# curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
# cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force
# SAFARIDRIVER=$(which safaridriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt" --no-fail-fast
wasm-gecko: wasm-gecko:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30 timeout-minutes: 30
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Clone spacebar server - name: Clone spacebar server
run: | run: |
git clone https://github.com/bitfl0wer/server.git git clone https://github.com/bitfl0wer/server.git
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 18 node-version: 18
cache: 'npm' cache: "npm"
cache-dependency-path: server/package-lock.json cache-dependency-path: server/package-lock.json
- name: Prepare and start Spacebar server - name: Prepare and start Spacebar server
run: | run: |
npm install npm install
npm run setup npm run setup
npm run start & npm run start &
working-directory: ./server working-directory: ./server
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
cache-all-crates: "true" cache-all-crates: "true"
prefix-key: "macos" prefix-key: "macos"
- name: Run WASM tests with Safari, Firefox, Chrome - name: Run WASM tests with Safari, Firefox, Chrome
run: | run: |
rustup target add wasm32-unknown-unknown rustup target add wasm32-unknown-unknown
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.92" --force cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.92" --force
GECKODRIVER=$(which geckodriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway" GECKODRIVER=$(which geckodriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway"
wasm-chrome: wasm-chrome:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 30 timeout-minutes: 30
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Clone spacebar server - name: Clone spacebar server
run: | run: |
git clone https://github.com/bitfl0wer/server.git git clone https://github.com/bitfl0wer/server.git
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 18 node-version: 18
cache: 'npm' cache: "npm"
cache-dependency-path: server/package-lock.json cache-dependency-path: server/package-lock.json
- name: Prepare and start Spacebar server - name: Prepare and start Spacebar server
run: | run: |
npm install npm install
npm run setup npm run setup
npm run start & npm run start &
working-directory: ./server working-directory: ./server
- uses: Swatinem/rust-cache@v2 - uses: Swatinem/rust-cache@v2
with: with:
cache-all-crates: "true" cache-all-crates: "true"
prefix-key: "macos" prefix-key: "macos"
- name: Run WASM tests with Safari, Firefox, Chrome - name: Run WASM tests with Safari, Firefox, Chrome
run: | run: |
rustup target add wasm32-unknown-unknown rustup target add wasm32-unknown-unknown
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.92" --force cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.92" --force
CHROMEDRIVER=$(which chromedriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway" CHROMEDRIVER=$(which chromedriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway"