Merge branch 'main' of https://github.com/learnforpractice/mixin-pyth… #104
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 workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Build mixin-python | |
on: | |
push: | |
branches: | |
- "*" | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- "main" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
run: | |
runs-on: ${{ matrix.os }} | |
env: | |
VERSION: 0.2.9 | |
strategy: | |
matrix: | |
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] | |
os: ['windows-2019', 'ubuntu-20.04', 'macos-12'] | |
# python-version: [3.9] | |
# os: ['windows-latest'] | |
fail-fast: false | |
steps: | |
- name: Install scoop | |
if: ${{ matrix.os == 'windows-2019' }} | |
run: | | |
iex "& {$(irm get.scoop.sh)} -RunAsAdmin" | |
scoop install ninja gcc | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.19' | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v1.9 | |
with: | |
cmake-version: '3.16.x' | |
# - uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -U flake8 pytest scikit-build cython auditwheel | |
# - name: Lint with flake8 | |
# run: | | |
# # stop the build if there are Python syntax errors or undefined names | |
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Build libmixin.a | |
working-directory: src/mixin | |
run: | | |
go build -o libmixin.a -buildmode=c-archive | |
- name: Build mixin-python macosx | |
if: ${{ matrix.os == 'macos-12' }} | |
run: | | |
python setup.py bdist_wheel --plat-name macosx-10.15-x86_64 | |
- name: Build mixin-python | |
if: ${{ matrix.os != 'macos-12' }} | |
run: | | |
python setup.py bdist_wheel | |
- name: get whl file | |
id: whlfile | |
shell: bash | |
run: | | |
echo "value=`python scripts/get_whl_file.py`" >> $GITHUB_OUTPUT | |
- name: Install mixin-python | |
run: | | |
python -m pip uninstall mixin-python -y;python -m pip install ./dist/${{ steps.whlfile.outputs.value }} | |
- name: Test | |
if: ${{ matrix.os != 'windows-2019' }} | |
working-directory: tests | |
run: | | |
python -m pip install -r ../requirements-dev.txt | |
python3 -m pytest -s -x test_mixin_api.py | |
- name: Test2 | |
if: ${{ matrix.os != 'windows-2019' }} | |
working-directory: tests | |
run: | | |
python3 -m pytest -s -x test_testnet2.py -k test_hello | |
python3 -m pytest -s -x test_testnet2.py -k test_deposit | |
- name: auditwheel repair | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
id: manylinuxwhlfile | |
working-directory: ./dist | |
run: | | |
python -m pip install -U patchelf | |
python -m auditwheel repair --plat manylinux_2_17_x86_64 ${{ steps.whlfile.outputs.value }} | |
echo "value=`python ../scripts/get_whl_file.py ./wheelhouse manylinux`" >> $GITHUB_OUTPUT | |
echo "+++manylinuxwhlfile: ${{ steps.manylinuxwhlfile.outputs.value }}" | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
./dist/${{ steps.whlfile.outputs.value }} | |
- name: Release manylinux wheel | |
if: ${{ matrix.os == 'ubuntu-20.04' && startsWith(github.ref, 'refs/tags/') }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
./dist/wheelhouse/${{ steps.manylinuxwhlfile.outputs.value }} | |
- name: Downloading whl files | |
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.10' }} | |
working-directory: dist | |
run: | | |
rm *.whl | |
rm -r wheelhouse | |
python ../scripts/download.py ${{ env.VERSION }} | |
- name: Publish a Python distribution to PyPI | |
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.10' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |