-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbc7371
commit 61a7db0
Showing
188 changed files
with
24,824 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: blockchyp-rust | ||
on: | ||
push: | ||
branches: | ||
- "develop" | ||
- "master" | ||
- "preview" | ||
tags: | ||
- "*" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: act10ns/slack@v1 | ||
with: | ||
status: starting | ||
channel: '#gitactivity' | ||
if: always() | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: rustup update stable && rustup default stable | ||
- name: Run Tests | ||
run: make test | ||
- uses: act10ns/slack@v1 | ||
with: | ||
status: ${{ job.status }} | ||
channel: '#gitactivity' | ||
if: always() | ||
test-build: | ||
runs-on: ubuntu-latest | ||
if: ${{ always() && contains(join(needs.*.result, ','), 'success')}} | ||
needs: [ test ] | ||
steps: | ||
- uses: act10ns/slack@v1 | ||
with: | ||
status: starting | ||
channel: '#gitactivity' | ||
if: always() | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: rustup update stable && rustup default stable | ||
- name: Run Build | ||
run: make build | ||
- name: Dry Run Publish to Cargo | ||
run: make dry-run-publish | ||
- uses: act10ns/slack@v1 | ||
with: | ||
status: ${{ job.status }} | ||
channel: '#gitactivity' | ||
if: always() | ||
publish: | ||
runs-on: ubuntu-latest | ||
if: ${{ always() && contains(join(needs.*.result, ','), 'success') && startsWith(github.ref_name, 'v') }} | ||
needs: [ test ] | ||
steps: | ||
- uses: act10ns/slack@v1 | ||
with: | ||
status: starting | ||
channel: '#gitactivity' | ||
if: always() | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: rustup update stable && rustup default stable | ||
- name: Run Build | ||
run: make build | ||
- name: Publish to Cargo | ||
run: make publish | ||
- uses: act10ns/slack@v1 | ||
with: | ||
status: ${{ job.status }} | ||
channel: '#gitactivity' | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[package] | ||
name = "blockchyp" | ||
version = "2.18.6" | ||
edition = "2021" | ||
description = "This is the SDK for Rust. Like all BlockChyp SDKs, it provides a full client for the BlockChyp gateway and BlockChyp payment terminals." | ||
documentation = "https://docs.blockchyp.com/#overview" | ||
readme = "README.md" | ||
repository = "https://github.com/blockchyp/blockchyp-rust" | ||
license-file = "LICENSE" | ||
keywords = ["payments", "blockchain"] | ||
|
||
[lib] | ||
name = "blockchyp" | ||
path = "src/lib.rs" | ||
|
||
[dependencies] | ||
reqwest = { version = "0.11", features = ["blocking", "json", "rustls-tls"] } | ||
chrono = { version = "0.4", features = ["serde"] } | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_derive = "1.0" | ||
serde_json = "1.0" | ||
hex = "0.4" | ||
hmac = "0.12" | ||
sha2 = "0.10" | ||
thiserror = "1.0" | ||
aes = "0.8.4" | ||
rand = "0.8.4" | ||
form_urlencoded = "1.0" | ||
uuid = { version = "1.8", features = ["v4"] } | ||
|
||
[dev-dependencies] | ||
assert-json-diff = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 BlockChyp | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Version config | ||
TAG := $(shell git tag --points-at HEAD | sort --version-sort | tail -n 1) | ||
LASTTAG := $(or $(shell git tag -l | sort -r -V | head -n 1),0.1.0) | ||
SNAPINFO := $(shell date +%Y%m%d%H%M%S)git$(shell git log -1 --pretty=%h) | ||
RELEASE := $(or $(BUILD_NUMBER), 1) | ||
VERSION := $(or $(TAG:v%=%),$(LASTTAG:v%=%))$(if $(TAG),,.$(SNAPINFO)) | ||
|
||
# Executables | ||
DOCKER = docker | ||
CARGO = cargo | ||
SED = sed | ||
SED_SUBST = $(SED) | ||
UNAME_S := $(shell uname -s) | ||
ifeq ($(UNAME_S),Darwin) | ||
SED_SUBST += -i '' | ||
else | ||
SED_SUBST += -i | ||
endif | ||
|
||
# Integration test config | ||
export BC_TEST_DELAY := 5 | ||
IMAGE := rust:1.79-bookworm | ||
SCMROOT := $(shell git rev-parse --show-toplevel) | ||
PWD := $(shell pwd) | ||
CACHE := $(HOME)/.local/share/blockchyp/itest-cache | ||
CONFIGFILE := $(HOME)/.config/blockchyp/sdk-itest-config.json | ||
CACHEPATHS := $(dir $(CONFIGFILE)) $(HOME)/.cargo $(HOME)/.config/configstore | ||
ifeq ($(shell uname -s), Linux) | ||
HOSTIP = $(shell ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') | ||
else | ||
HOSTIP = host.docker.internal | ||
endif | ||
|
||
# Default target | ||
.PHONY: all | ||
all: clean build test | ||
|
||
# Cleans the package | ||
.PHONY: clean | ||
clean: | ||
$(CARGO) clean | ||
|
||
# Builds the package | ||
.PHONY: build-dev | ||
build-dev: | ||
$(CARGO) build | ||
|
||
# Builds the package with the --release profile to prepare for publishing | ||
.PHONY: build | ||
build: | ||
$(CARGO) build --release | ||
|
||
# Runs unit tests | ||
.PHONY: test | ||
test: | ||
|
||
# Lint the package | ||
.PHONY: lint | ||
lint: | ||
$(CARGO) clippy | ||
|
||
# Publish the package | ||
.PHONY: publish | ||
publish: | ||
$(CARGO) publish | ||
|
||
# Test publishing the package | ||
.PHONY: dry-run-publish | ||
dry-run-publish: | ||
$(CARGO) publish --dry-run | ||
|
||
# Performs any tasks necessary before a release build | ||
.PHONY: stage | ||
stage: | ||
$(SED_SUBST) "s/^version = \".*\"/version = \"$(VERSION)\"/" Cargo.toml | ||
|
||
# Runs integration tests | ||
.PHONY: integration | ||
integration: | ||
$(if $(LOCALBUILD), \ | ||
$(CARGO) build && $(CARGO) test $(if $(TEST),--test (TEST),--no-fail-fast), \ | ||
$(foreach path,$(CACHEPATHS),mkdir -p $(CACHE)/$(path) ; ) \ | ||
sed 's/localhost/$(HOSTIP)/' $(CONFIGFILE) >$(CACHE)/$(CONFIGFILE) ; \ | ||
$(DOCKER) run \ | ||
-v $(SCMROOT):$(SCMROOT):Z \ | ||
--memory 2G \ | ||
--memory-swap -1 \ | ||
$(foreach path,$(CACHEPATHS),-v $(CACHE)$(path):$(path):Z) \ | ||
-e BC_TEST_DELAY=$(BC_TEST_DELAY) \ | ||
-e HOME=$(HOME) \ | ||
-w $(PWD) \ | ||
--init \ | ||
--rm -it $(IMAGE) \ | ||
/bin/sh -c "$(CARGO) build && $(CARGO) test --release $(if $(TEST),--test $(TEST),--tests --no-fail-fast)") |
Oops, something went wrong.