Skip to content

Commit

Permalink
chore: badges, update GH workflows, dependabot (#16)
Browse files Browse the repository at this point in the history
* chore: badges, update GH workflows, dependabot

* fix GH workflow

* clippy
  • Loading branch information
hseeberger authored Jan 7, 2023
1 parent 845d296 commit 39b7937
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 28 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "cargo"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
47 changes: 47 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3

- name: Install Rust toolchain
run: |
rustup update
rustup toolchain install nightly
rustup component add rustfmt --toolchain nightly
rustup component add clippy --toolchain nightly
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Check code format (cargo fmt)
run: cargo +nightly fmt --check

- name: Lint (cargo clippy)
run: cargo clippy --no-deps -- -D warnings

- name: Test (cargo test)
env:
GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }}
run: |
printenv GCP_SERVICE_ACCOUNT > pub-sub-client-tests/secrets/active-road-365118-2eca6b7b8fd9.json
cargo test
21 changes: 0 additions & 21 deletions .github/workflows/test.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
members = [ "pub-sub-client", "pub-sub-client-derive", "pub-sub-client-tests" ]

[workspace.package]
version = "0.10.1-alpha.0"
# No use to define version here, because cargo release ignores it!
# version = "0.10.1-alpha.0"
edition = "2021"
description = "Google Cloud Pub/Sub client library"
authors = [ "Heiko Seeberger <[email protected]>" ]
license = "Apache-2.0"
readme = "README.md"
homepage = "https://github.com/hseeberger/pub-sub-client"
repository = "https://github.com/hseeberger/pub-sub-client"
documentation = "https://github.com/hseeberger/pub-sub-client"
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Google Cloud Pub/Sub client

[![Crates.io][crates-badge]][crates-url]
[![license][license-badge]][license-url]
[![build][build-badge]][build-url]

[crates-badge]: https://img.shields.io/crates/v/pub-sub-client
[crates-url]: https://crates.io/crates/pub-sub-client
[license-badge]: https://img.shields.io/github/license/hseeberger/pub-sub-client
[license-url]: https://github.com/hseeberger/pub-sub-client/blob/main/LICENSE
[build-badge]: https://img.shields.io/github/actions/workflow/status/hseeberger/pub-sub-client/ci.yaml
[build-url]: https://github.com/hseeberger/pub-sub-client/actions/workflows/ci.yaml

Google Cloud Pub/Sub client library in [Rust](https://www.rust-lang.org/). Currently publishing, pulling and acknowledging are supported, but no management tasks like creating topics or subscriptions.

Messages can either be published/pulled as raw or, if the payload is JSON data, serialized from/deserialized into domain messages (structs or enums) via [Serde](https://serde.rs/) and [Serde JSON](https://docs.serde.rs/serde_json). Both raw `ReceivedMessages` and "typed" `PulledMessages` expose metadata like message ID, acknowledge ID, attributes, etc.
Expand Down
2 changes: 1 addition & 1 deletion pub-sub-client/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub enum Error {
},

#[error("Getting authentication token failed")]
TokenFetch { source: goauth::GoErr },
TokenFetch { source: Box<goauth::GoErr> },

#[error("HTTP communication with Pub/Sub service failed")]
HttpServiceCommunication { source: reqwest::Error },
Expand Down
4 changes: 3 additions & 1 deletion pub-sub-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ impl PubSubClient {
.token_fetcher
.fetch_token()
.await
.map_err(|source| Error::TokenFetch { source })?;
.map_err(|source| Error::TokenFetch {
source: Box::new(source),
})?;

let request = self
.reqwest_client
Expand Down
6 changes: 3 additions & 3 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
edition = "2021"

unstable_features = true
comment_width = 100
unstable_features = true
comment_width = 100
imports_granularity = "Crate"
wrap_comments = true
wrap_comments = true

0 comments on commit 39b7937

Please sign in to comment.