Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev:
  Bump version, update docs and changelog.
  Create separate wasm test file.
  Install wasm-pack for github actions.
  Setup github ci
  Fix clippy warnings.
  Add PR template.
  Tests for SharedPharos.
  Add SharedPharos. TODO: tests.
  Make Observe async and rename pharos::Error to PharErr.
  more chores
  chore: clean up CI, docs, contribution guidelines.
  downloads badge
  cleanup
  Clarify closure filter in readme.
  No longer depend on futures-channel separately.
  • Loading branch information
najamelan committed Feb 17, 2021
2 parents 8ae5977 + d9752d8 commit be16c87
Show file tree
Hide file tree
Showing 32 changed files with 1,249 additions and 722 deletions.
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!--- When contributing all contributions should branch off the -->
<!--- dev branch as master is only used for releases. -->

<!--- Check CONTRIBUTING.md for more information-->

<!--- Please describe the changes in the PR and the motivation below -->
108 changes: 43 additions & 65 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,77 @@
name: Rust


on:
push:
branches:
- master
- dev

pull_request:
branches:
- master
- dev

name: ci
on : [push, pull_request]

jobs:

linux-ci:
linux-stable:

name: Linux Rust Stable
runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v1
- name: Install latest stable Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy

- name: Install rust nightly
- name: Install nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly

run : |
rustup toolchain add nightly
rustup default nightly

- name: Build
run : cargo build --all-features
- name: Checkout crate
uses: actions/checkout@v2

- name: Run tests
run : cargo test --all-features
run: bash ci/test.bash

- name: Build --release
run: cargo build --all-features --release

- name: Run tests --release
run: cargo test --all-features --release
linux-nightly:

- name: Build docs
run : cargo doc --no-deps --all-features
name: Linux Rust Nightly
runs-on: ubuntu-latest

# doesn't work on nightly until rustup can install the latest nightly which has clippy.
#
# - name: Run clippy
# run : cargo +stable clippy --all-features
steps:

- name: Install latest nightly Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: clippy

windows-ci:

runs-on: windows-latest
- name: Checkout crate
uses: actions/checkout@v2

steps:

- uses: actions/checkout@v1
- name: Run clippy
run : bash ci/clippy.bash

- name: Install rust nightly

run : |
rustup toolchain add nightly
rustup default nightly
- name: Build documentation
run : bash ci/doc.bash

- name: Build
run : cargo build --all-features

- name: Run tests
run : cargo test --all-features


macos-ci:
run : bash ci/test.bash

runs-on: macOS-latest

steps:

- uses: actions/checkout@v1
- name: Check coverage
run: bash ci/coverage.bash

- name: Install rust nightly

run : |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh && sh rustup.sh -y
source $HOME/.cargo/env
rustup toolchain add nightly
rustup default nightly
- name: install wasm-pack
uses: jetli/wasm-pack-action@v0.3.0
with:
# Optional version of wasm-pack to install(eg. 'v0.9.1', 'latest')
version: 'latest'

- name: Build
run : |
source $HOME/.cargo/env
cargo build --all-features
- name: Run tests on wasm
run: bash ci/wasm.bash

- name: Run tests
run : |
source $HOME/.cargo/env
cargo test --all-features

47 changes: 31 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
language: rust
rust :
- stable
- nightly

# Need to cache the whole `.cargo` directory to keep .crates.toml for
# cargo-update to work
Expand All @@ -16,38 +13,56 @@ cache:
before_cache:
- rm -rf /home/travis/.cargo/git
- rm -rf /home/travis/.cargo/registry
- rm -rf /home/travis/.cargo/bin/wasm-pack
- rm -rf /home/travis/.cargo/bin/cargo-tarpaulin
- rm -rf target/debug/incremental/{pharos,build_script_build}-*
- rm -rf target/debug/.fingerprint/pharos-*
- rm -rf target/debug/build/pharos-*
- rm -rf target/debug/deps/libpharos-*
- rm -rf target/debug/deps/pharos-*
- rm -rf target/debug/{pharos,libpharos}.d
- cargo clean -p pharos


branches:
only:
- master
- dev


matrix:
jobs:

include:

- os: linux
- name : linux stable check
os : linux
rust : stable
script: cargo check

script:
- cargo test
- cargo test --release
- cargo doc --no-deps --all-features

- name : linux nightly test everything
os : linux
dist : bionic
rust : nightly

- os: osx
addons:
firefox: latest
apt:
packages:
- libssl-dev # for cargo-tarpaulin

script:
- cargo test
- bash ci/check.bash
- bash ci/test.bash
- bash ci/doc.bash
- bash ci/coverage.bash


- os : osx
script:
- bash ci/test.bash

- os: windows

- os : windows
script:
- cargo test

- bash ci/test.bash


13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Pharos Changelog

## 0.5.0 - 2020-02-17

- **BREAKING CHANGE**: `Observable::observe` is now an async function. This was needed to make it possible to send
events to a pharos object from different async tasks. So far notifying was async, but observing was not. However
in order to be able to use a mutex, we need both operations to be one or the other. On wasm, one cannot block the
thread hence the choice for an async mutex, but in order to lock that we have to be in async context.
A new helper type `SharedPharos` has been introduced to conveniently use pharos from a shared reference.
- **BREAKING CHANGE**: rename `pharos::Error` to `PharErr`. I want to move away from types that are just called `Error`.
This allows conveniently exporting the error type at crate level.
- no longer depend on futures-channel appart from the main futures lib. It's annoying if a dependant crate
want's to patch futures in Cargo.toml.
- move to github actions after travis becomes a paid service.

## 0.4.2 - 2019-11-13

- drop dependency on log.
Expand Down
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Contributing

This repository accepts contributions. Ideas, questions, feature requests and bug reports can be filed through Github issues.

Pull Requests are welcome on Github. By committing pull requests, you accept that your code might be modified and reformatted to fit the project coding style or to improve the implementation. Contributed code is considered licensed under the same license as the rest of the project unless explicitly agreed otherwise. See the `LICENCE` file.

Please discuss what you want to see modified before filing a pull request if you don't want to be doing work that might be rejected.


## Code formatting

I understand my code formatting style is quite uncommon, but it is deliberate and helps readability for me. Unfortunately, it cannot be achieved with automated tools like `rustfmt`. **Feel free to contribute code formatted however you are comfortable writing it**. I am happy to reformat during the review process. If you are uncomfortable reading my code, I suggest running `rustfmt` on the entire source tree or set your line-height to 1.2 instead of the common 1.5, which will make it look a lot less over the top.


# git workflow

Please file PR's against the `dev` branch, don't forget to update the documentation.
23 changes: 18 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,47 @@ status = "actively-developed"
[badges.travis-ci]
repository = "najamelan/pharos"

[dependencies]
futures-channel = "^0.3"
[build-dependencies]
rustc_version = "^0.2"

[dependencies]
[dependencies.futures]
default-features = false
version = "^0.3"

[dev-dependencies]
assert_matches = "^1"
futures = "^0.3"
wasm-bindgen-test = "^0.3"

[features]
external_doc = []
[dev-dependencies.async-std]
features = ["attributes"]
version = "^1"

[dev-dependencies.async_executors]
features = ["async_std"]
version = "^0.4"

[package]
authors = ["Naja Melan <najamelan@autistici.org>"]
categories = ["asynchronous"]
description = "Observer pattern which generates a futures 0.3 stream of events"
documentation = "https://docs.rs/pharos"
edition = "2018"
exclude = ["tests", "examples", "ci", ".travis.yml", "TODO.md", "CONTRIBUTING.md"]
keywords = ["observer", "futures", "stream", "broadcast", "publish_subscribe"]
license = "Unlicense"
name = "pharos"
readme = "README.md"
repository = "https://github.com/najamelan/pharos"
version = "0.4.2"
version = "0.5.0"

[package.metadata]
[package.metadata.docs]
[package.metadata.docs.rs]
all-features = true
targets = []

[profile]
[profile.release]
codegen-units = 1

0 comments on commit be16c87

Please sign in to comment.