Skip to content

Commit

Permalink
Skale endpoint addition & Github workflows for docker & pypi deploys (h…
Browse files Browse the repository at this point in the history
…umanprotocol#261)

* Added SKALE Network Testnet Endpoint

* Switch to new version and repo.

* Switch version in package.json

* Create docker-publish.yml

* Remove stop from end of test script, solve naming inconsistency in library, make handlers add other handlers instead of factory.

* Create python-publish.yml

* Go 0.9.1

* Correct docker image

* Fail CI check if tests fail

Co-authored-by: Christine Perry <[email protected]>
Co-authored-by: Vlad Silviu Farcas <[email protected]>
  • Loading branch information
3 people authored Apr 28, 2021
1 parent 563a2e2 commit 5357df3
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 15 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Docker

on:
push:
# Publish `master` as Docker `latest` image.
branches:
- master

# Publish `v1.2.3` tags as releases.
tags:
- v*

# Run tests for any PRs.
pull_request:


jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run tests
run: |
./bin/ci
31 changes: 31 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
5 changes: 1 addition & 4 deletions bin/ci
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@ set -exu
docker-compose build
docker-compose run --no-deps -e CI=true job './bin/lint'
docker-compose run job
docker-compose run job ./bin/generate-docs

./bin/stop

docker-compose run job ./bin/generate-docs
2 changes: 1 addition & 1 deletion contracts/Escrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ contract Escrow {
}

function addTrustedHandlers(address[] memory _handlers) public {
require(msg.sender == launcher, "Address calling cannot add trusted handllers");
require(areTrustedHandlers[msg.sender], "Address calling cannot add trusted handlers");
for (uint256 i = 0; i < _handlers.length; i++) {
areTrustedHandlers[_handlers[i]] = true;
}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '2'
services:

job:
image: hcaptcha/hmt-escrow:latest
image: humanprotocol/hmt-escrow:latest
build: .
environment:
- HMT_ETH_SERVER=http://ganache:8545
Expand Down
2 changes: 1 addition & 1 deletion hmt_escrow/eth_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,4 @@ def test_set_pub_key_at_address(self):
if __name__ == "__main__":
from test_manifest import manifest

unittest.main(exit=False)
unittest.main(exit=True)
6 changes: 3 additions & 3 deletions hmt_escrow/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def manifest_hash(
def is_trusted_handler(
escrow_contract: Contract, handler_addr: str, gas_payer: str, gas: int = GAS_LIMIT
) -> bool:
return escrow_contract.functions.isTrustedHandler(handler_addr).call(
return escrow_contract.functions.areTrustedHandlers(handler_addr).call(
{"from": gas_payer, "gas": Wei(gas)}
)

Expand Down Expand Up @@ -1666,7 +1666,7 @@ def test_job_bulk_payout(self):

def test_job_abort(self):

# The escrow contract is in Paid state after the a full bulk payout and it can't be aborted.
# The escrow contract is in Paid state after the full bulk payout and it can't be aborted.

self.assertTrue(self.job.launch(self.rep_oracle_pub_key))
self.assertTrue(self.job.setup())
Expand Down Expand Up @@ -1726,4 +1726,4 @@ def test_job_balance(self):
if __name__ == "__main__":
from test_manifest import manifest

unittest.main(exit=False)
unittest.main(exit=True)
2 changes: 1 addition & 1 deletion hmt_escrow/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,4 @@ def test_encrypt(self):
from test_manifest import manifest
from job import Job

unittest.main(exit=False)
unittest.main(exit=True)
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hmt-escrow",
"version": "0.8.11",
"version": "0.9.1",
"description": "Launch escrow contracts to the HUMAN network",
"main": "truffle.js",
"directories": {
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

setuptools.setup(
name="hmt-escrow",
version="0.8.11",
version="0.9.1",
author="HUMAN Protocol",
description="A python library to launch escrow contracts to the HUMAN network.",
url="https://github.com/hCaptcha/hmt-escrow",
url="https://github.com/humanprotocol/hmt-escrow",
include_package_data=True,
zip_safe=True,
classifiers=[
Expand Down
4 changes: 4 additions & 0 deletions truffle.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ module.exports = {
provider: () => new PrivateKeyProvider(PRIV_KEY, 'https://rpc.testnet.moonbeam.network', 1287),
network_id: '1287',
},
skale: {
provider: () => new HDWalletProvider(MNEMONIC, 'https://humanprotocol-integration.skale.network', 0, 10),
network_id: '344435',
},
},
compilers: {
solc: {
Expand Down

0 comments on commit 5357df3

Please sign in to comment.