-
Notifications
You must be signed in to change notification settings - Fork 3
113 lines (110 loc) · 4.15 KB
/
python-app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# 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"
jobs:
run:
runs-on: ${{ matrix.os }}
env:
VERSION: 0.2.5
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10"]
os: ['windows-2019', 'ubuntu-18.04', 'macos-latest']
# 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.17'
- 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 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
run: |
python setup.py sdist bdist_wheel
- name: get whl file
id: whlfile
run: |
echo "::set-output name=value::$(python scripts/get_whl_file.py)"
- 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_testnet.py -k test_hello
- name: auditwheel repair
if: ${{ matrix.os == 'ubuntu-18.04' }}
id: manylinuxwhlfile
working-directory: ./dist
run: |
python -m auditwheel repair --plat manylinux_2_17_x86_64 ${{ steps.whlfile.outputs.value }}
echo "::set-output name=value::$(python ../scripts/get_whl_file.py ./wheelhouse manylinux)"
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-18.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-18.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-18.04' && matrix.python-version == '3.10' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}