-
Notifications
You must be signed in to change notification settings - Fork 48
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
2dfea24
commit 8008882
Showing
8 changed files
with
112 additions
and
222 deletions.
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
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 |
---|---|---|
@@ -1,189 +1,40 @@ | ||
language: python | ||
python: | ||
- "3.5" | ||
os: | ||
- linux | ||
dist: trusty | ||
sudo: required | ||
env: | ||
global: | ||
- SOLC_BASE_INSTALL_PATH=$TRAVIS_BUILD_DIR | ||
# Based on https://github.com/cclauss/Travis-CI-Python-on-three-OSes | ||
matrix: | ||
include: | ||
# lint | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e flake8" | ||
# installation | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34-installation" | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35-installation" | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36-installation" | ||
# solc 0.4.1 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.1 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.1 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.1 | ||
# solc 0.4.2 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.2 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.2 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.2 | ||
# solc 0.4.6 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.6 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.6 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.6 | ||
# solc 0.4.7 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.7 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.7 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.7 | ||
# solc 0.4.8 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.8 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.8 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.8 | ||
# solc 0.4.9 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.9 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.9 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.9 | ||
# solc 0.4.11 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.11 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.11 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.11 | ||
# solc 0.4.12 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.12 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.12 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.12 | ||
# solc 0.4.13 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.13 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.13 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.13 | ||
# solc 0.4.14 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.14 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.14 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.14 | ||
# solc 0.4.15 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.15 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.15 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.15 | ||
# solc 0.4.16 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.16 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.16 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.16 | ||
# solc 0.4.17 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.17 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.17 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.17 | ||
# solc 0.4.18 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.18 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.18 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.18 | ||
# solc 0.4.19 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.19 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.19 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.19 | ||
# solc 0.4.20 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.20 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.20 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.20 | ||
# solc 0.4.21 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.21 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.21 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.21 | ||
# solc 0.4.22 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.22 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.22 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.22 | ||
# solc 0.4.23 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.23 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.23 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.23 | ||
# solc 0.4.24 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.24 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.24 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.24 | ||
# solc 0.4.25 | ||
- python: "3.4" | ||
env: TOX_POSARGS="-e py34" SOLC_VERSION=v0.4.25 | ||
- python: "3.5" | ||
env: TOX_POSARGS="-e py35" SOLC_VERSION=v0.4.25 | ||
- python: "3.6" | ||
env: TOX_POSARGS="-e py36" SOLC_VERSION=v0.4.25 | ||
- name: "Python 3.7.1 on Xenial Linux" | ||
language: python | ||
python: 3.7 # this works for Linux but is ignored on macOS or Windows | ||
dist: xenial # required for Python >= 3.7 | ||
sudo: true | ||
install: | ||
- sudo add-apt-repository -y ppa:ethereum/ethereum | ||
- sudo apt-get update | ||
- sudo apt-get install -y solc | ||
- pip install -r requirements-dev.txt | ||
- pip install flake8 | ||
script: flake8 solcx/ tests/ --max-line-length=100 | ||
- name: "Python 3.6.8 on Xenial Linux" | ||
language: python | ||
python: 3.6 | ||
dist: xenial | ||
sudo: true | ||
install: | ||
- sudo add-apt-repository -y ppa:ethereum/ethereum | ||
- sudo apt-get update | ||
- sudo apt-get install -y solc | ||
- pip install -r requirements-dev.txt | ||
script: python -m pytest tests/ --cov=solcx/ | ||
- name: "Python 3.7.3 on Windows" | ||
os: windows # Windows 10.0.17134 N/A Build 17134 | ||
language: shell # 'language: python' is an error on Travis CI Windows | ||
# python: 3.7 # 'python:' is ignored on Travis CI Windows | ||
install: | ||
- choco install python # this install takes at least 1 min 30 sec | ||
- python -m pip install --upgrade pip | ||
- pip3 install -r requirements-dev.txt | ||
env: PATH=/c/Python37:/c/Python37/Scripts:$PATH | ||
|
||
cache: | ||
- pip: true | ||
before_install: | ||
install: | ||
- travis_retry pip install setuptools --upgrade | ||
- travis_retry pip install tox | ||
- pip --version | ||
- pip install -e . # install py-solc globally in order to use the solc installation scripts. | ||
before_script: | ||
- python --version | ||
- if [ -n "$SOLC_VERSION" ]; then python -m solc.install $SOLC_VERSION; fi | ||
- if [ -n "$SOLC_VERSION" ]; then export SOLC_BINARY="$SOLC_BASE_INSTALL_PATH/solc-$SOLC_VERSION/bin/solc"; fi | ||
- if [ -n "$SOLC_VERSION" ]; then export LD_LIBRARY_PATH="$SOLC_BASE_INSTALL_PATH/solc-$SOLC_VERSION/bin"; fi | ||
- env | ||
- if [ -n "$SOLC_BINARY" ]; then $SOLC_BINARY --version; fi | ||
script: | ||
- tox $TOX_POSARGS | ||
after_script: | ||
- cat .tox/$TOX_POSARGS/log/*.log | ||
script: python -m pytest tests --cov=solcx/ | ||
after_success: coveralls | ||
notifications: | ||
email: false |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pytest>=2.9.2 | ||
tox>=2.3.1 | ||
coveralls==1.7.0 | ||
pytest>=5.0.0 | ||
pytest-cov>=2.7.1 | ||
semantic_version>=2.6.0 | ||
bumpversion==0.5.3 | ||
twine==1.12.1 | ||
twine==1.13.0 | ||
requests>=2.19.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
Binary file not shown.
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,52 @@ | ||
from base64 import b64encode | ||
import os | ||
import pytest | ||
import sys | ||
|
||
import solcx | ||
|
||
TEST_CONTRACT = '''pragma solidity >=0.4.11 <0.6.0; | ||
contract Foo { | ||
function return13() public returns (uint) { | ||
return 13; | ||
} | ||
} | ||
''' | ||
|
||
if sys.platform == "darwin": | ||
VERSIONS = solcx.get_installed_solc_versions() | ||
else: | ||
auth = b64encode(os.environ['GITAUTH'].encode()).decode('ascii') | ||
headers = {'Authorization': f"Basic {auth}"} | ||
VERSIONS = solcx.get_available_solc_versions(headers=headers) | ||
|
||
|
||
def pytest_generate_tests(metafunc): | ||
if 'all_versions' in metafunc.fixturenames: | ||
metafunc.parametrize('all_versions', VERSIONS, indirect=True) | ||
|
||
|
||
_installed = {} | ||
@pytest.fixture() | ||
def all_versions(request): | ||
version = request.param | ||
if version not in _installed: | ||
try: | ||
solcx.install_solc(version) | ||
_installed[version] = True | ||
except Exception: | ||
_installed[version] = False | ||
pytest.fail(f"Unable to install solc {version}") | ||
if _installed[version]: | ||
solcx.set_solc_version(version) | ||
else: | ||
request.applymarker('skip') | ||
|
||
|
||
@pytest.fixture() | ||
def contract_source(tmp_path): | ||
source = tmp_path.joinpath('test.sol') | ||
with source.open('w') as fp: | ||
fp.write(TEST_CONTRACT) | ||
return str(source) |
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,12 @@ | ||
import pytest | ||
|
||
import solcx | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def setup(all_versions): | ||
pass | ||
|
||
|
||
def test_compile_files(contract_source): | ||
solcx.compile_files([contract_source]) |