Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kvanbere committed Jan 12, 2018
0 parents commit ee1968a
Show file tree
Hide file tree
Showing 75 changed files with 12,726 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ci-scripts
Submodule .ci-scripts added at 4ec68f
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.hs, *.lhs]
charset = utf-8
indent_size = 4
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**Operating system or device, package version, compiler version:**
<!-- Please provide all of these details. -->

**Issue description:**
<!-- What happened, and what was expected. -->

**Steps to reproduce:**
<!-- Please provide reasonable detail. -->

**Link to minimal example project:**
<!-- Optional but very welcome. You can drag and drop a zip archive to upload it. -->
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**Issue reference:**
<!-- Which issue(s) does this solve? Do you need to make one? -->

**Submission Checklist:**
* [ ] Have you followed the guidelines in our [Contributing](../../CONTRIBUTING.md) document (for example, is your tree a clean merge)?
* [ ] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?
* [ ] Does your submission build?
* [ ] Does your submission pass tests?
* [ ] Have you run lints on your code locally prior to submission?
* [ ] Have you updated *all* of the cabal/nix infrastructure?
* [ ] Is this a breaking change? Have you discussed this?

<!-- Please tag a maintainer if you don't get a response within a reasonable period of time -->
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
dist
dist-*
cabal-dev
*.o
*.hi
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ci-scripts"]
path = .ci-scripts
url = https://github.com/onrock-eng/ci-scripts.git
36 changes: 36 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# .travis.yml
# Used for Continuous Integration builds on Linux/OS X via https://travis-ci.org
sudo: false
language: c # default is ruby

matrix:
fast_finish: true
include:
- os: linux
env:
- STACK_PKG_URL=https://www.stackage.org/stack/linux-x86_64
- HLINT=Y
- WEEDER=Y
- os: osx
env: STACK_PKG_URL=https://www.stackage.org/stack/osx-x86_64

cache:
directories:
- $HOME/.stack

before_install:
- source .ci-scripts/travis/install-stack.sh

# Here starts the actual work to be performed for the package under test;
# any command which exits with a non-zero exit code causes the build to fail.
script:
- if [[ $HLINT ]]; then source .ci-scripts/travis/run-hlint.sh; fi
- travis_wait 30 stack --no-terminal --skip-ghc-check test --haddock --no-haddock-deps
- if [[ $WEEDER ]]; then source .ci-scripts/travis/run-weeder.sh; fi

# Build the integration examples
- travis_wait 30 stack --no-terminal --skip-ghc-check build
github-webhooks-scotty-example
github-webhooks-servant-simple-example
github-webhooks-servant-example

1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Kyle Van Berendonck <kyle.vanberendonck@onrock.engineering>
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 0.9.0

* This is an alpha testing release with an incomplete feature set to recieve feedback on the API.
* The API may change in the recent future. When alpha testing has commenced, the version will start at `1.0.0`.
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at foss@onrock.engineering. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Contributing

Contributions are welcome!

Please file an active issue to further discuss how we can collaborate together.

To discuss opportunities, you can email the team at foss@onrock.engineering.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 OnRock Engineering (https://onrock.engineering)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
![github-webhooks Mascot](./doc/github-webhooks-mascot-248.svg)<br/>
github-webhooks
---------------

[![Hackage](https://img.shields.io/hackage/v/github-webhooks.svg?style=flat-square)](https://hackage.haskell.org/package/github-webhooks)
[![Stackage](http://stackage.org/package/github-webhooks/badge/nightly?style=flat-square)](https://www.stackage.org/package/github-webhooks)
[![License](https://img.shields.io/github/license/onrock-eng/github-webhooks.svg?style=flat-square)](#license)

| | `lts-10.0` |
|-------------|------------|
| Linux & OSX | [![Linux & OSX](https://img.shields.io/travis/onrock-eng/github-webhooks/master.svg?style=flat-square)]() |
| Windows | [![Windows](https://img.shields.io/appveyor/ci/OnRockEngineering/github-webhooks/master.svg?style=flat-square)]() |

Complete Haskell types and instances for decoding GitHub API [Webhook] payloads.

* [Features](#features)
* [Installation](#installation)
* [Examples](#examples)
* [Changelog](#changelog)
* [Roadmap](#roadmap)
* [Authors](#authors)
* [License](#license)

## Features
* Best-in-class JSON decoding via [aeson].
* Unicode string support via [text].
* Suitable for large data payloads using [vector].
* Type-safe encoding of optional data.
* Type-safe event action encodings with support for future API changes.
* Instances for Typeable, Data, Generic and NFData.
* Strongly typed utility classes EventHasSender, EventHasRepo et al.
* Strict data types suitable for high performance streaming operations.
* Full support for [these event types](https://developer.github.com/v3/activity/events/types/#event-types--payloads).

## Installation
`github-webhooks` is available via installation on [Hackage](https://hackage.haskell.org/package/github-webhooks) and [Stackage](https://www.stackage.org/package/github-webhooks).

## Examples
Minimal working example:
```hs
$ stack ghci bytestring aeson github-webhooks
import qualified Data.ByteString.Lazy as BSL
import Data.Aeson ( eitherDecode' )

json <- BSL.readFile "fixtures/watch-event.json"
eitherDecode' json :: Either String WatchEvent
```

Some practical integration examples are also provided:
* [Servant Integration (Simple)](./examples/servant-simple#readme)<br/>
Minimal working example of integrating this package with [servant] and [servant-github-webhook].
* [Servant Integration (Typical)](./examples/servant-adv#readme)<br/>
This example demonstrates more advanced use-cases with [servant] by decoding multiple different types of payloads on the same endpoint.
* [Scotty Integration](./examples/scotty#readme)<br/>
Minimal working example of integrating this package with [scotty].

## Changelog
See [CHANGELOG.md](./CHANGELOG.md) for a summary of changes in each release.

## Roadmap
See [ROADMAP.md](./ROADMAP.md) for the project timeline and feature estimation of future releases.

## Authors
See [AUTHORS](./AUTHORS) for a list of significant authors.

## License
See [LICENSE](./LICENSE) for a bundled copy of the MIT license.

<br/>

> ###### Free open source software, sponsored by
> <a href="https://onrock.engineering" rel="sponsor">![OnRock Engineering](./doc/onrock-color-196.svg)</a>
[Webhook]: https://developer.github.com/webhooks/

[aeson]: https://www.stackage.org/package/aeson
[text]: https://www.stackage.org/package/text
[vector]: https://www.stackage.org/package/vector
[servant]: https://www.stackage.org/package/github-webhooks
[servant-github-webhook]: https://www.stackage.org/package/servant-github-webhook
[scotty]: https://www.stackage.org/package/scotty
15 changes: 15 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Roadmap

* Not implemented.

## Upcoming releases

* Not implemented.

## Future Release [Backlog]

* Not implemented: links to sorted backlog.

## Old releases

* None.
3 changes: 3 additions & 0 deletions Setup.lhs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env runhaskell
> import Distribution.Simple
> main = defaultMain
26 changes: 26 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
build: off
clone_folder: "c:\\pkg"

environment:
global:
STACK_PKG_URL: "http://www.stackage.org/stack/windows-x86_64"
PATH: "%PATH%;%APPDATA%\\local\\bin"
STACK_ROOT: "c:\\sr"
LOCAL_BIN: "%APPDATA%\\local\\bin"

cache:
- "%STACK_ROOT% -> stack.yaml"
- "%LOCAL_BIN% -> stack.yaml"

install:
- if not exist %LOCAL_BIN% mkdir %LOCAL_BIN%
- where stack.exe || curl -sSkL -ostack.zip %STACK_PKG_URL% && 7z x stack.zip stack.exe && move stack.exe %LOCAL_BIN%
- stack --version
- stack --no-terminal --verbosity=error setup 2>&1 >stack-setup.log || type stack-setup.log

test_script:
- stack --no-terminal --skip-ghc-check test --haddock --no-haddock-deps
- stack --no-terminal --skip-ghc-check build
github-webhooks-scotty-example
github-webhooks-servant-simple-example
github-webhooks-servant-example
Binary file added doc/example-webhooks-conf-slash-hook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/example-webhooks-conf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ee1968a

Please sign in to comment.