From abcfefac070d3fb8fb52d6cede3591f43b3acd2e Mon Sep 17 00:00:00 2001 From: Jacobi Petrucciani <8117202+jpetrucciani@users.noreply.github.com> Date: Thu, 29 Oct 2020 18:25:40 -0400 Subject: [PATCH] [ops] switching from travis to github actions (#7) * [ops] switching from travis to github actions * fixing double run of github actions --- .github/workflows/deploy.yml | 28 ++++ .github/workflows/test.yml | 29 +++- .gitignore | 6 +- .prospector.yaml | 3 + .travis.yml | 26 ---- LICENSE | 2 +- Pipfile | 12 -- Pipfile.lock | 282 ----------------------------------- gamble/models/dice.py | 8 +- requirements.dev.txt | 4 + setup.py | 4 +- 11 files changed, 73 insertions(+), 331 deletions(-) create mode 100644 .github/workflows/deploy.yml delete mode 100644 .travis.yml delete mode 100644 Pipfile delete mode 100644 Pipfile.lock create mode 100644 requirements.dev.txt diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..22cd769 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,28 @@ +--- +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 + sed -i -E "s#VERSION#${GITHUB_REF/refs\/tags\//}#g" ./setup.py + - name: build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USER }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51f6788..7f654cf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,27 +1,46 @@ +--- name: test -on: [push, pull_request] +on: [push] jobs: archives: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: jpetrucciani/archives-check@master with: path: 'gamble/' prospector: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: jpetrucciani/prospector-check@master mypy: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: jpetrucciani/mypy-check@master black: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: jpetrucciani/black-check@master + tests: + runs-on: ubuntu-latest + needs: [archives, mypy, prospector, black] + strategy: + matrix: + python-version: ['3.6', '3.7', '3.8', '3.9'] + name: python ${{ matrix.python-version }} tests + steps: + - uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: x64 + - name: install requirements + run: pip install tox pytest pytest-cov + - name: run Tox + run: tox -e py diff --git a/.gitignore b/.gitignore index 4cc5567..1f26333 100644 --- a/.gitignore +++ b/.gitignore @@ -110,4 +110,8 @@ ENV/ # mkdocs documentation /site -# End of https://www.gitignore.io/api/python \ No newline at end of file +# End of https://www.gitignore.io/api/python + +# vscode +.history/ +.vscode/ diff --git a/.prospector.yaml b/.prospector.yaml index 474d551..bf74b6c 100644 --- a/.prospector.yaml +++ b/.prospector.yaml @@ -50,6 +50,9 @@ pep8: vulture: run: false +bandit: + run: true + pyroma: run: false disable: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 668a273..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -dist: xenial -sudo: false -language: python -matrix: - include: - - python: 3.6 - env: TOXENV=py36 - - python: 3.7 - env: TOXENV=py37 - - python: 3.8-dev - env: TOXENV=py38 -install: - - pip install tox pipenv - - pipenv install --dev -script: - - tox - - archives gamble/ -deploy: - provider: pypi - user: jacobi - skip_existing: true - on: - branch: master - tags: true - password: - secure: XaZWWSz0QOmCvh5mhyrJcbKYQ25HMzdgc+tIFDEhGIPX77D+Oa9T+qThQn1268WgJeQNLGc1kiR3DauoVN1BNJeUoyXyvpdytvndnQmrj3+7abjSaOtPPrFU0rlB9tOrUs/tb1maaY0f38TlElbdWPGC6T7M7JQ9j9CmZ734bPpBrImDNMnYJ7IUHG+9OVY8PJanih1ss3TGk7tZ+FbS9ojC2CayyQsfcMsrQwJLcSUiCbeu209JX3G9QgwDs+BegrGsX170UaibS438CcXJa05zGH7irW5ooQj3inEHAevJIlpdZN+A+terqtwdghDs7tX/cVxReeeWsavOusxxK5mjQkB0shMTWQ2NBCXAheHsyGt2Kd+vZ7Ro81xMbmHnGKQtGzu5AKR4vV7MUWzNeGGPqUYttiHCk8u3aGf+iAbrEJMS9+oYT8hgsBNdyWu7uBjkjG+ugbFpDA0mJj54omYlJv0tuPW25JUpEppk3gvNaZAX6RVGr3kNzXsJjxwNyFKm/Z0fG9IgkPnNPOT0bp3sN9/uIkGZKCacUyun+yRlqLeqdBRPGhmDKNj668/9fgs388idqf1Z5LxKBMJGsO4GVAB/2esNrAKh1wvN9quEEgZyTFXOZ/nxtiUHjgbXD8hmQHx20G5/kaLAiO1Y3ST5d5B9F71ef9FoJSR31N0= diff --git a/LICENSE b/LICENSE index c9deaf7..2a137a3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Jacobi Petrucciani +Copyright (c) 2020 Jacobi Petrucciani Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 45de7c7..0000000 --- a/Pipfile +++ /dev/null @@ -1,12 +0,0 @@ -[[source]] -name = "pypi" -url = "https://pypi.org/simple" -verify_ssl = true - -[dev-packages] -tox = "*" -pytest = "*" -pytest-cov = "*" -archives = ">=0.9" - -[packages] diff --git a/Pipfile.lock b/Pipfile.lock deleted file mode 100644 index b86e6ef..0000000 --- a/Pipfile.lock +++ /dev/null @@ -1,282 +0,0 @@ -{ - "_meta": { - "hash": { - "sha256": "0547c6043b641c8451066cc4f8d29cf00ca586f97c259d04a9a0e1a82a58e85e" - }, - "pipfile-spec": 6, - "requires": {}, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.org/simple", - "verify_ssl": true - } - ] - }, - "default": {}, - "develop": { - "archives": { - "hashes": [ - "sha256:6dcecc0309233eabf80f764e12b499dd8af2a064eeb6794f53f1221a6f71924a" - ], - "index": "pypi", - "version": "==0.9" - }, - "atomicwrites": { - "hashes": [ - "sha256:03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4", - "sha256:75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6" - ], - "version": "==1.3.0" - }, - "attrs": { - "hashes": [ - "sha256:69c0dbf2ed392de1cb5ec704444b08a5ef81680a61cb899dc08127123af36a79", - "sha256:f0b870f674851ecbfbbbd364d6b5cbdff9dcedbc7f3f5e18a6891057f21fe399" - ], - "version": "==19.1.0" - }, - "click": { - "hashes": [ - "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", - "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7" - ], - "version": "==7.0" - }, - "colorama": { - "hashes": [ - "sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d", - "sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48" - ], - "version": "==0.4.1" - }, - "coverage": { - "hashes": [ - "sha256:08907593569fe59baca0bf152c43f3863201efb6113ecb38ce7e97ce339805a6", - "sha256:0be0f1ed45fc0c185cfd4ecc19a1d6532d72f86a2bac9de7e24541febad72650", - "sha256:141f08ed3c4b1847015e2cd62ec06d35e67a3ac185c26f7635f4406b90afa9c5", - "sha256:19e4df788a0581238e9390c85a7a09af39c7b539b29f25c89209e6c3e371270d", - "sha256:23cc09ed395b03424d1ae30dcc292615c1372bfba7141eb85e11e50efaa6b351", - "sha256:245388cda02af78276b479f299bbf3783ef0a6a6273037d7c60dc73b8d8d7755", - "sha256:331cb5115673a20fb131dadd22f5bcaf7677ef758741312bee4937d71a14b2ef", - "sha256:386e2e4090f0bc5df274e720105c342263423e77ee8826002dcffe0c9533dbca", - "sha256:3a794ce50daee01c74a494919d5ebdc23d58873747fa0e288318728533a3e1ca", - "sha256:60851187677b24c6085248f0a0b9b98d49cba7ecc7ec60ba6b9d2e5574ac1ee9", - "sha256:63a9a5fc43b58735f65ed63d2cf43508f462dc49857da70b8980ad78d41d52fc", - "sha256:6b62544bb68106e3f00b21c8930e83e584fdca005d4fffd29bb39fb3ffa03cb5", - "sha256:6ba744056423ef8d450cf627289166da65903885272055fb4b5e113137cfa14f", - "sha256:7494b0b0274c5072bddbfd5b4a6c6f18fbbe1ab1d22a41e99cd2d00c8f96ecfe", - "sha256:826f32b9547c8091679ff292a82aca9c7b9650f9fda3e2ca6bf2ac905b7ce888", - "sha256:93715dffbcd0678057f947f496484e906bf9509f5c1c38fc9ba3922893cda5f5", - "sha256:9a334d6c83dfeadae576b4d633a71620d40d1c379129d587faa42ee3e2a85cce", - "sha256:af7ed8a8aa6957aac47b4268631fa1df984643f07ef00acd374e456364b373f5", - "sha256:bf0a7aed7f5521c7ca67febd57db473af4762b9622254291fbcbb8cd0ba5e33e", - "sha256:bf1ef9eb901113a9805287e090452c05547578eaab1b62e4ad456fcc049a9b7e", - "sha256:c0afd27bc0e307a1ffc04ca5ec010a290e49e3afbe841c5cafc5c5a80ecd81c9", - "sha256:dd579709a87092c6dbee09d1b7cfa81831040705ffa12a1b248935274aee0437", - "sha256:df6712284b2e44a065097846488f66840445eb987eb81b3cc6e4149e7b6982e1", - "sha256:e07d9f1a23e9e93ab5c62902833bf3e4b1f65502927379148b6622686223125c", - "sha256:e2ede7c1d45e65e209d6093b762e98e8318ddeff95317d07a27a2140b80cfd24", - "sha256:e4ef9c164eb55123c62411f5936b5c2e521b12356037b6e1c2617cef45523d47", - "sha256:eca2b7343524e7ba246cab8ff00cab47a2d6d54ada3b02772e908a45675722e2", - "sha256:eee64c616adeff7db37cc37da4180a3a5b6177f5c46b187894e633f088fb5b28", - "sha256:ef824cad1f980d27f26166f86856efe11eff9912c4fed97d3804820d43fa550c", - "sha256:efc89291bd5a08855829a3c522df16d856455297cf35ae827a37edac45f466a7", - "sha256:fa964bae817babece5aa2e8c1af841bebb6d0b9add8e637548809d040443fee0", - "sha256:ff37757e068ae606659c28c3bd0d923f9d29a85de79bf25b2b34b148473b5025" - ], - "version": "==4.5.4" - }, - "entrypoints": { - "hashes": [ - "sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19", - "sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451" - ], - "version": "==0.3" - }, - "filelock": { - "hashes": [ - "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59", - "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836" - ], - "version": "==3.0.12" - }, - "flake8": { - "hashes": [ - "sha256:19241c1cbc971b9962473e4438a2ca19749a7dd002dd1a946eaba171b4114548", - "sha256:8e9dfa3cecb2400b3738a42c54c3043e821682b9c840b0448c0503f781130696" - ], - "version": "==3.7.8" - }, - "flake8-polyfill": { - "hashes": [ - "sha256:12be6a34ee3ab795b19ca73505e7b55826d5f6ad7230d31b18e106400169b9e9", - "sha256:e44b087597f6da52ec6393a709e7108b2905317d0c0b744cdca6208e670d8eda" - ], - "version": "==1.0.2" - }, - "future": { - "hashes": [ - "sha256:67045236dcfd6816dc439556d009594abf643e5eb48992e36beac09c2ca659b8" - ], - "version": "==0.17.1" - }, - "importlib-metadata": { - "hashes": [ - "sha256:652234b6ab8f2506ae58e528b6fbcc668831d3cc758e1bc01ef438d328b68cdb", - "sha256:6f264986fb88042bc1f0535fa9a557e6a376cfe5679dc77caac7fe8b5d43d05f" - ], - "markers": "python_version < '3.8'", - "version": "==0.22" - }, - "mando": { - "hashes": [ - "sha256:4ce09faec7e5192ffc3c57830e26acba0fd6cd11e1ee81af0d4df0657463bd1c", - "sha256:79feb19dc0f097daa64a1243db578e7674909b75f88ac2220f1c065c10a0d960" - ], - "version": "==0.6.4" - }, - "mccabe": { - "hashes": [ - "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42", - "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f" - ], - "version": "==0.6.1" - }, - "more-itertools": { - "hashes": [ - "sha256:409cd48d4db7052af495b09dec721011634af3753ae1ef92d2b32f73a745f832", - "sha256:92b8c4b06dac4f0611c0729b2f2ede52b2e1bac1ab48f089c7ddc12e26bb60c4" - ], - "version": "==7.2.0" - }, - "packaging": { - "hashes": [ - "sha256:a7ac867b97fdc07ee80a8058fe4435ccd274ecc3b0ed61d852d7d53055528cf9", - "sha256:c491ca87294da7cc01902edbe30a5bc6c4c28172b5138ab4e4aa1b9d7bfaeafe" - ], - "version": "==19.1" - }, - "pluggy": { - "hashes": [ - "sha256:0db4b7601aae1d35b4a033282da476845aa19185c1e6964b25cf324b5e4ec3e6", - "sha256:fa5fa1622fa6dd5c030e9cad086fa19ef6a0cf6d7a2d12318e10cb49d6d68f34" - ], - "version": "==0.13.0" - }, - "py": { - "hashes": [ - "sha256:64f65755aee5b381cea27766a3a147c3f15b9b6b9ac88676de66ba2ae36793fa", - "sha256:dc639b046a6e2cff5bbe40194ad65936d6ba360b52b3c3fe1d08a82dd50b5e53" - ], - "version": "==1.8.0" - }, - "pycodestyle": { - "hashes": [ - "sha256:95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56", - "sha256:e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c" - ], - "version": "==2.5.0" - }, - "pyflakes": { - "hashes": [ - "sha256:17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0", - "sha256:d976835886f8c5b31d47970ed689944a0262b5f3afa00a5a7b4dc81e5449f8a2" - ], - "version": "==2.1.1" - }, - "pyparsing": { - "hashes": [ - "sha256:6f98a7b9397e206d78cc01df10131398f1c8b8510a2f4d97d9abd82e1aacdd80", - "sha256:d9338df12903bbf5d65a0e4e87c2161968b10d2e489652bb47001d82a9b028b4" - ], - "version": "==2.4.2" - }, - "pytest": { - "hashes": [ - "sha256:95d13143cc14174ca1a01ec68e84d76ba5d9d493ac02716fd9706c949a505210", - "sha256:b78fe2881323bd44fd9bd76e5317173d4316577e7b1cddebae9136a4495ec865" - ], - "index": "pypi", - "version": "==5.1.2" - }, - "pytest-cov": { - "hashes": [ - "sha256:2b097cde81a302e1047331b48cadacf23577e431b61e9c6f49a1170bbe3d3da6", - "sha256:e00ea4fdde970725482f1f35630d12f074e121a23801aabf2ae154ec6bdd343a" - ], - "index": "pypi", - "version": "==2.7.1" - }, - "radon": { - "hashes": [ - "sha256:0cde1953547a164d24420ed6ccdfa18b61f1457b96a2b99ff0de76b22d504a0f", - "sha256:ee20308ce8bae7a89b067425b63b141a0077632ab318d5288da649c830882b3d" - ], - "version": "==3.0.3" - }, - "six": { - "hashes": [ - "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", - "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" - ], - "version": "==1.12.0" - }, - "toml": { - "hashes": [ - "sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c", - "sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e" - ], - "version": "==0.10.0" - }, - "tox": { - "hashes": [ - "sha256:0bc216b6a2e6afe764476b4a07edf2c1dab99ed82bb146a1130b2e828f5bff5e", - "sha256:c4f6b319c20ba4913dbfe71ebfd14ff95d1853c4231493608182f66e566ecfe1" - ], - "index": "pypi", - "version": "==3.14.0" - }, - "typed-ast": { - "hashes": [ - "sha256:18511a0b3e7922276346bcb47e2ef9f38fb90fd31cb9223eed42c85d1312344e", - "sha256:262c247a82d005e43b5b7f69aff746370538e176131c32dda9cb0f324d27141e", - "sha256:2b907eb046d049bcd9892e3076c7a6456c93a25bebfe554e931620c90e6a25b0", - "sha256:354c16e5babd09f5cb0ee000d54cfa38401d8b8891eefa878ac772f827181a3c", - "sha256:4e0b70c6fc4d010f8107726af5fd37921b666f5b31d9331f0bd24ad9a088e631", - "sha256:630968c5cdee51a11c05a30453f8cd65e0cc1d2ad0d9192819df9978984529f4", - "sha256:66480f95b8167c9c5c5c87f32cf437d585937970f3fc24386f313a4c97b44e34", - "sha256:71211d26ffd12d63a83e079ff258ac9d56a1376a25bc80b1cdcdf601b855b90b", - "sha256:95bd11af7eafc16e829af2d3df510cecfd4387f6453355188342c3e79a2ec87a", - "sha256:bc6c7d3fa1325a0c6613512a093bc2a2a15aeec350451cbdf9e1d4bffe3e3233", - "sha256:cc34a6f5b426748a507dd5d1de4c1978f2eb5626d51326e43280941206c209e1", - "sha256:d755f03c1e4a51e9b24d899561fec4ccaf51f210d52abdf8c07ee2849b212a36", - "sha256:d7c45933b1bdfaf9f36c579671fec15d25b06c8398f113dab64c18ed1adda01d", - "sha256:d896919306dd0aa22d0132f62a1b78d11aaf4c9fc5b3410d3c666b818191630a", - "sha256:ffde2fbfad571af120fcbfbbc61c72469e72f550d676c3342492a9dfdefb8f12" - ], - "version": "==1.4.0" - }, - "virtualenv": { - "hashes": [ - "sha256:680af46846662bb38c5504b78bad9ed9e4f3ba2d54f54ba42494fdf94337fe30", - "sha256:f78d81b62d3147396ac33fc9d77579ddc42cc2a98dd9ea38886f616b33bc7fb2" - ], - "version": "==16.7.5" - }, - "wcwidth": { - "hashes": [ - "sha256:3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e", - "sha256:f4ebe71925af7b40a864553f761ed559b43544f8f71746c2d756c7fe788ade7c" - ], - "version": "==0.1.7" - }, - "zipp": { - "hashes": [ - "sha256:3718b1cbcd963c7d4c5511a8240812904164b7f381b647143a89d3b98f9bcd8e", - "sha256:f06903e9f1f43b12d371004b4ac7b06ab39a44adc747266928ae6debfa7b3335" - ], - "version": "==0.6.0" - } - } -} diff --git a/gamble/models/dice.py b/gamble/models/dice.py index 3c6218a..05d6de9 100644 --- a/gamble/models/dice.py +++ b/gamble/models/dice.py @@ -109,7 +109,7 @@ def roll(self) -> int: @desc roll the die @ret the value rolled by this die """ - value = random.randrange(self.sides) + 1 + value = random.randrange(self.sides) + 1 # nosec self.rolls += 1 return value * self.multiplier @@ -140,8 +140,10 @@ def roll(self) -> int: @desc sometime override supers die roll depending on the rigged_factor @ret the value rolled by this die """ - if random.randrange(101) <= self.rigged_factor: - value = [self.sides, self.sides - 1, self.sides - 2][random.randrange(3)] + if random.randrange(101) <= self.rigged_factor: # nosec + value = [self.sides, self.sides - 1, self.sides - 2][ + random.randrange(3) + ] # nosec self.rolls += 1 return value * self.multiplier return super().roll() diff --git a/requirements.dev.txt b/requirements.dev.txt new file mode 100644 index 0000000..e41b352 --- /dev/null +++ b/requirements.dev.txt @@ -0,0 +1,4 @@ +tox +pytest +pytest-cov +archives diff --git a/setup.py b/setup.py index c186194..ab1bb8d 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ __library__ = "gamble" -__version__ = "0.7" +__version__ = "VERSION" with open("README.md") as readme: LONG_DESCRIPTION = readme.read() @@ -29,6 +29,8 @@ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ],