Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add running the tests via CI with gnome-keyring #57

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,46 @@ jobs:
with:
command: fmt
args: --all -- --check

test:
name: Tests
runs-on: ubuntu-latest

strategy:
matrix:
rust:
- stable
# MSRV, influenced by zbus.
- 1.60.0

steps:
- uses: actions/checkout@v2
with:
persist-credentials: false

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal

- name: Install gnome-keyring
run: sudo apt-get install -y gnome-keyring

- name: Start gnome-keyring
# run gnome-keyring with 'foobar' as password for the login keyring
# this will create a new login keyring and unlock it
# the login password doesn't matter, but the keyring must be unlocked for the tests to work
run: gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar'

- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
# run tests single-threaded to avoid race conditions
args: -- --test-threads=1

- name: Run example
uses: actions-rs/cargo@v1
with:
command: run
args: --example example
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ zbus = { version = "3", default-features = false }

[dev-dependencies]
tokio = { version = "1", features = ["rt", "macros"] }
test-with = { version = "0.8", default-features = false }
1 change: 1 addition & 0 deletions src/blocking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ mod test {
let _ = ss.get_any_collection().unwrap();
}

#[test_with::no_env(GITHUB_ACTIONS)]
#[test]
fn should_create_and_delete_collection() {
let ss = SecretService::connect(EncryptionType::Plain).unwrap();
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ mod test {
let _ = ss.get_any_collection().await.unwrap();
}

#[test_with::no_env(GITHUB_ACTIONS)]
#[tokio::test]
async fn should_create_and_delete_collection() {
let ss = SecretService::connect(EncryptionType::Plain).await.unwrap();
Expand Down