Skip to content

Commit

Permalink
Feat/deserialize and certificate parts (#3)
Browse files Browse the repository at this point in the history
* Derive Deserialize for APS and sub-structs
* Add Client::certificate_parts to support more use cases
* Fix stack-overflow in Error's Display impl
  Also removed some deprecated impls and changed the "reason" string from
  the debug string to the human-readable message.

* Bump to v0.6.2
* Migrate to new maintainers
* fix: Adds tcp feature to hyper (WalletConnect#61)

Co-authored-by: Mark Drobnak <mdrobnak@mozilla.com>
Co-authored-by: Julius de Bruijn <bruijn@prisma.io>
Co-authored-by: Julius de Bruijn <julius+github@nauk.io>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rich Neswold <neswold@fnal.gov>
Co-authored-by: Alex Hortopan <alex@hortopan.com>
Co-authored-by: Harry Bairstow <h.bairstow22@gmail.com>
Co-authored-by: Austin Evans <austinjevans@me.com>
  • Loading branch information
9 people committed Sep 22, 2022
1 parent c7b325e commit cad6030
Show file tree
Hide file tree
Showing 27 changed files with 659 additions and 621 deletions.
4 changes: 4 additions & 0 deletions .envrc
@@ -0,0 +1,4 @@
if command -v nix-shell &> /dev/null
then
use nix
fi
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
@@ -0,0 +1,25 @@
# Description

<!--
Please include:
* summary of the changes and the related issue
* relevant motivation and context
-->

Resolves # (issue)

## How Has This Been Tested?

<!--
Please:
* describe the tests that you ran to verify your changes.
* provide instructions so we can reproduce.
-->

<!-- If valid for smoke test on feature add screenshots -->

## Due Dilligence

* [ ] Breaking change
* [ ] Requires a documentation update
* [ ] Requires a e2e/integration test update
111 changes: 111 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,111 @@
name: ci

on:
pull_request:
paths-ignore:
- '.github/**'
- 'README.md'

push:
branches: ['main']
paths-ignore:
- '.github/**'
- 'README.md'

concurrency:
# Support push/pr as event types with different behaviors each:
# 1. push: queue up builds
# 2. pr: only allow one run per PR
group: ${{ github.workflow }}-${{ github.event.type }}${{ github.event.pull_request.number }}
# If there is already a workflow running for the same pull request, cancel it
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
tasks:
name: "[${{ matrix.os }}] ${{ matrix.cargo.name }}"
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
rust:
- stable
cargo:
- name: "Clippy"
cmd: clippy
args: -- -D clippy::all
cache: {}
- name: "Formatting"
cmd: fmt
args: -- --check
cache: {}
- name: "Unit Tests"
cmd: test
args: --all-features
cache: { sharedKey: "tests" }
include:
- os: ubuntu-latest
sccache-path: /home/runner/.cache/sccache
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 1G
SCCACHE_DIR: ${{ matrix.sccache-path }}
steps:
# Checkout code
- name: "Git checkout"
uses: actions/checkout@v2

# Install sccache
- name: "Install sccache"
if: matrix.os == 'ubuntu-latest'
env:
SCCACHE_URL: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.2.15
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
curl -sSL "$SCCACHE_URL/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
install -vDm 755 "$SCCACHE_FILE/sccache" "$HOME/.local/bin/sccache"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
# Install Rust toolchain
- name: "Install Rust ${{ matrix.rust }}"
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true

# Rebuild cache
- name: Cache cargo registry
uses: Swatinem/rust-cache@3bb3a9a087029c7bc392586cdc88cb6f66b9c6ef
with: ${{ matrix.cargo.cache }}
continue-on-error: false

- name: Cache sccache
uses: actions/cache@v2
continue-on-error: false
with:
path: ${{ matrix.sccache-path }}
key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-sccache-
# Run job
- name: "Start sccache server"
run: |
sccache --stop-server || true
sccache --start-server
- name: "Task ${{ matrix.cargo.name }}"
uses: actions-rs/cargo@v1
with:
command: ${{ matrix.cargo.cmd }}
args: ${{ matrix.cargo.args }}

- name: "Print sccache stats"
run: sccache --show-stats

- name: "Stop sccache server"
run: sccache --stop-server || true
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -28,3 +28,5 @@ Cargo.lock

/examples/*.p8
/examples/*.p12

.direnv
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

52 changes: 0 additions & 52 deletions .travis/docs.sh

This file was deleted.

92 changes: 50 additions & 42 deletions CHANGELOG.md
@@ -1,73 +1,81 @@
# Changelog
# Changelog

## v0.5.2
## v0.6.2

- Fix `TooManyProviderTokenUpdates` issue [#44](https://github.com/pimeys/a2/pull/44)
- Add support for Safari web push

## v0.5.1
## v0.6.0

- Enforcing static lifetimes for client send [#43](https://github.com/pimeys/a2/pull/43)
- Update to Tokio 1.0

## v0.5.0
## v0.5.2

- Stable Hyper 0.13 and Tokio 0.2 support
- Fix `TooManyProviderTokenUpdates` issue [#44](https://github.com/pimeys/a2/pull/44)

## v0.5.0-alpha.6
## v0.5.1

- Fix a bug in ALPN resolving.
- Enforcing static lifetimes for client send [#43](https://github.com/pimeys/a2/pull/43)

## v0.5.0-alpha.5
## v0.5.0

- And down to async-std's new `ToSocketAddrs` resolver
- Stable Hyper 0.13 and Tokio 0.2 support

## v0.5.0-alpha.4
## v0.5.0-alpha.6

- Switch to Hyper's GaiResolver to go around of a bug in the latest nightly.
- Fix a bug in ALPN resolving.

## v0.5.0-alpha.1
## v0.5.0-alpha.5

- Update to `std::future` and async/await, requiring a nightly compiler for now.
- And down to async-std's new `ToSocketAddrs` resolver

## v0.4.1
## v0.5.0-alpha.4

- Fix token_client example not building due to unresolvable `as_ref()`. [#35](https://github.com/pimeys/a2/pull/35)
- Move indoc to dev-dependencies so that crates depending on us don't need it. [#36](https://github.com/pimeys/a2/pull/36)
- Move pretty_env_logger to dev-dependencies, it's not useful to crates depending on us. [#37](https://github.com/pimeys/a2/pull/37)
- Remove unused tokio-io dependency. [#38](https://github.com/pimeys/a2/pull/38)
- Switch to Hyper's GaiResolver to go around of a bug in the latest nightly.

## v0.4.0
## v0.5.0-alpha.1

Introduces two changes that are a bit more drastic and hence increasing the
major version. The 2018 syntax requires a Rust compiler version 1.31 or newer
and the locking primitive hasn't been measured with high traffic yet in a2.
- Update to `std::future` and async/await, requiring a nightly compiler for now.

- Upgrade to Rust 2018 syntax [#29](https://github.com/pimeys/a2/pull/29)
- Switch from deprecated crossbeam ArcCell to parking_lot RwLock
[#32](https://github.com/pimeys/a2/pull/32)
## v0.4.1

## v0.3.5
- Fix token_client example not building due to unresolvable `as_ref()`. [#35](https://github.com/pimeys/a2/pull/35)
- Move indoc to dev-dependencies so that crates depending on us don't need it. [#36](https://github.com/pimeys/a2/pull/36)
- Move pretty_env_logger to dev-dependencies, it's not useful to crates depending on us. [#37](https://github.com/pimeys/a2/pull/37)
- Remove unused tokio-io dependency. [#38](https://github.com/pimeys/a2/pull/38)

- Implement `fmt::Display` for `ErrorReason` [#28](https://github.com/pimeys/a2/pull/28)
## v0.4.0

## v0.3.4
Introduces two changes that are a bit more drastic and hence increasing the
major version. The 2018 syntax requires a Rust compiler version 1.31 or newer
and the locking primitive hasn't been measured with high traffic yet in a2.

- Changing the author email due to company breakdown to the private one.
- Upgrade to Rust 2018 syntax [#29](https://github.com/pimeys/a2/pull/29)
- Switch from deprecated crossbeam ArcCell to parking_lot RwLock
[#32](https://github.com/pimeys/a2/pull/32)

## v0.3.3
## v0.3.5

- Taking the alpn connector out to its own crate, using tokio-dns for resolving
- Implement `fmt::Display` for `ErrorReason` [#28](https://github.com/pimeys/a2/pull/28)

## v0.3.2
## v0.3.4

- OK responses don't have a body, so we don't need to handle it and gain a bit
more performance
- Changing the author email due to company breakdown to the private one.

## v0.3.1
## v0.3.3

- Bunch of examples to the builder documentation
- Taking the alpn connector out to its own crate, using tokio-dns for resolving

## v0.3.0
## v0.3.2

- Convert the API to not clone the input data, using references until
converting to JSON, remove tokio-service dependency
[#25](https://github.com/pimeys/a2/pull/25)
- OK responses don't have a body, so we don't need to handle it and gain a bit
more performance

## v0.3.1

- Bunch of examples to the builder documentation

## v0.3.0

- Convert the API to not clone the input data, using references until
converting to JSON, remove tokio-service dependency
[#25](https://github.com/pimeys/a2/pull/25)
18 changes: 10 additions & 8 deletions Cargo.toml
@@ -1,16 +1,17 @@
[package]
name = "a2"
version = "0.5.2"
version = "0.6.2"
authors = [
"Harry Bairstow <harry@walletconnect.com>",
"Julius de Bruijn <julius@nauk.io>",
"Sergey Tkachenko <seriy.tkachenko@gmail.com>",
]
license = "MIT"
readme = "README.md"
description = "A native, asynchronous Apple push notification client"
keywords = ["apns", "apple", "push", "async", "http2"]
repository = "https://github.com/pimeys/a2.git"
homepage = "https://github.com/pimeys/a2"
repository = "https://github.com/walletconnect/a2.git"
homepage = "https://github.com/walletconnect/a2"
documentation = "https://docs.rs/a2"
edition = "2018"

Expand All @@ -19,16 +20,17 @@ serde = "1"
erased-serde = "0.3"
serde_derive = "1"
serde_json = "1"
thiserror = "1"
openssl = "0.10"
futures = "0.3"
http = "0.2"
base64 = "0.12"
base64 = "0.13"
log = "0.4"
hyper = "0.13"
hyper-alpn = "0.2"
hyper = { version = "0.14", features = ["client", "http2", "tcp"] }
hyper-alpn = "0.3"

[dev-dependencies]
argparse = "0.2"
pretty_env_logger = "0.4"
indoc = "0.3"
tokio = { version = "0.2", features = ["rt-threaded", "macros"] }
indoc = "1"
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }

0 comments on commit cad6030

Please sign in to comment.