-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: replace real OBS tests with mock server
- Loading branch information
Showing
30 changed files
with
2,004 additions
and
497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Deploy coverage report to Pages | ||
on: | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
jobs: | ||
build: | ||
name: Build coverage report | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Setup Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Configure cache | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Install cargo-llvm-cov | ||
uses: taiki-e/install-action@cargo-llvm-cov | ||
- name: Install just | ||
uses: taiki-e/install-action@just | ||
- name: Setup Pages | ||
id: pages | ||
uses: actions/configure-pages@v5 | ||
- name: Run tests with coverage | ||
run: just coverage | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./target/llvm-cov/html | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
set dotenv-load := true | ||
|
||
_default: | ||
@just --list --unsorted | ||
|
||
# format all Rust source code | ||
fmt: | ||
cargo +nightly fmt --all | ||
|
||
# run unit and integration tests | ||
test: | ||
cargo test | ||
cargo test --all-features --test integration -- --test-threads 1 | ||
cargo nextest run --all-features | ||
|
||
# run integration tests with coverage | ||
coverage: | ||
cargo install cargo-llvm-cov | ||
rustup component add llvm-tools-preview | ||
|
||
cargo llvm-cov --remap-path-prefix --html --all-features -- --test-threads 1 | ||
cargo llvm-cov --remap-path-prefix --no-run --json --summary-only | \ | ||
cargo llvm-cov --html --all-features | ||
cargo llvm-cov --no-run --json --summary-only | \ | ||
jq -c '.data[0].totals.lines.percent | { \ | ||
schemaVersion: 1, \ | ||
label: "coverage", \ | ||
message: "\(.|round)%", \ | ||
color: (if . < 70 then "red" elif . < 80 then "yellow" else "green" end) \ | ||
}' > target/llvm-cov/html/coverage.json | ||
|
||
# upload coverage to GitHub Pages | ||
upload-coverage: coverage | ||
git checkout gh-pages | ||
rm -rf coverage coverage.json index.html style.css | ||
cp -R target/llvm-cov/html/ . | ||
git add -A coverage coverage.json index.html style.css | ||
git commit -m "Coverage for $(git rev-parse --short main)" | ||
git push | ||
git checkout main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
use anyhow::Result; | ||
use obws::requests::EventSubscription; | ||
use test_log::test; | ||
|
||
use crate::common; | ||
|
||
#[tokio::test] | ||
#[test(tokio::test)] | ||
async fn client() -> Result<()> { | ||
let client = common::new_client().await?; | ||
let (client, server) = common::new_client().await?; | ||
|
||
client.reidentify(EventSubscription::ALL).await?; | ||
|
||
Ok(()) | ||
server.stop().await | ||
} |
Oops, something went wrong.