11# This is a basic workflow to help you get started with Actions
22
3- name : Build and Deploy
3+ name : build
44
55# Controls when the workflow will run
66on :
77 # Triggers the workflow on push or pull request events but only for the master branch
88 push :
9- branches : [master, develop]
9+ branches :
10+ - master
11+ tags :
12+ - " v*"
1013 pull_request :
11- branches : [ master, develop ]
14+ branches :
15+ - master
1216
1317 # Allows you to run this workflow manually from the Actions tab
1418 workflow_dispatch :
1519
1620# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1721jobs :
18- job :
19- name : ${{ matrix.os }}- build- and- test
22+ build-wheels :
23+ name : ${{ matrix.os }} build and test wheels
2024 runs-on : ${{ matrix.os }}
2125 strategy :
2226 fail-fast : false
@@ -25,17 +29,13 @@ jobs:
2529 include :
2630 - os : windows-latest
2731 triplet : x64-windows
28- openmp : ON
29- builddir : dist/wheelhouse
30- builddir1 : dist
32+ builddir : dist
3133 - os : ubuntu-latest
3234 triplet : x64-linux
3335 builddir : wheelhouse
34- builddir1 : wheelhouse
3536 - os : macos-latest
3637 triplet : x64-osx
3738 builddir : wheelhouse
38- builddir1 : wheelhouse
3939 env :
4040 # Indicates the CMake build directory where project files and binaries are being produced.
4141 CMAKE_BUILD_DIR : ${{ github.workspace }}/builddir/
@@ -45,16 +45,17 @@ jobs:
4545 CIBW_BUILD : " cp36-* cp37-* cp38-* cp39-*"
4646 CIBW_ARCHS : " auto64"
4747 CIBW_MANYLINUX_X86_64_IMAGE : " manylinux_2_24"
48- TWINE_USERNAME : __token__
49- CIBW_BUILD_VERBOSITY : 3
48+ CIBW_BUILD_VERBOSITY : 1
5049 CIBW_REPAIR_WHEEL_COMMAND_MACOS : " pip uninstall -y delocate && pip install git+https://github.com/Chia-Network/delocate.git && delocate-listdeps {wheel} && delocate-wheel -w {dest_dir} -v {wheel}"
51- # CIBW_BEFORE_TEST_LINUX: "pip install -r requirements.txt"
52- # CIBW_TEST_COMMAND_LINUX: "python3 -m unittest discover -s ${{ github.workspace }}"
50+ CIBW_REPAIR_WHEEL_COMMAND_WINDOWS : " pip install -U wheel delvewheel && python fix_windows_wheel.py {wheel} {dest_dir}"
51+ CIBW_TEST_COMMAND : " python3 -m unittest discover -s {project}"
52+ CIBW_TEST_SKIP : " *-win_amd64" # skip tests on windows
5353 CIBW_BEFORE_BUILD_LINUX : " apt update && apt install -y libtiff5-dev libhdf5-dev"
5454
5555 steps :
5656 - uses : actions/checkout@v2
5757 with :
58+ fetch-depth : 0
5859 submodules : true
5960
6061 - name : Submodule recursive
8182 key : |
8283 ${{ hashFiles( 'external/LibAPR/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate
8384
84- - name : check file paths
85+ - name : Check file paths
8586 run : |
8687 cd ${{ github.workspace }}/external/LibAPR/vcpkg/scripts/buildsystems/
8788 ls
@@ -111,24 +112,84 @@ jobs:
111112
112113 - name : Run cibuildwheel
113114 run : |
114- python3 -m cibuildwheel --output-dir ${{matrix.builddir1 }}
115+ python3 -m cibuildwheel --output-dir ${{matrix.builddir }}
115116
116- - name : Fix windows wheels
117- if : contains(matrix.os,'windows')
117+ - name : Upload wheels as artifacts
118+ uses : actions/upload-artifact@v2
119+ with :
120+ name : ${{ matrix.os }}-wheels
121+ path : ${{matrix.builddir}}/
122+ retention-days : 5
123+
124+ windows-tests :
125+ name : windows py${{ matrix.python-version }} tests
126+ runs-on : windows-latest
127+ needs : build-wheels
128+ strategy :
129+ fail-fast : false
130+ matrix :
131+ python-version : [3.6, 3.7, 3.8, 3.9]
132+ include :
133+ - os : windows-latest
134+ triplet : x64-windows
135+
136+ steps :
137+ - name : Checkout
138+ uses : actions/checkout@v2
139+ with :
140+ submodules : false
141+
142+ - name : Set up Python
143+ uses : actions/setup-python@v2
144+ with :
145+ python-version : ${{ matrix.python-version }}
146+
147+ - name : Download wheels from artifacts
148+ uses : actions/download-artifact@v2
149+ with :
150+ name : windows-latest-wheels
151+ path : wheelhouse
152+
153+ - name : Set version string
154+ shell : bash
155+ run : echo "py_version_str=cp$(echo ${{ matrix.python-version }} | tr -d -c 0-9)" >> $GITHUB_ENV
156+
157+ - name : Install package from wheel
158+ shell : bash
118159 run : |
119- python3 -m pip install wheel
120- python3 -m pip install delvewheel
121- python3 fix_windows_wheel.py
160+ ls -R wheelhouse
161+ python -m pip install --upgrade pip
162+ pip install wheelhouse/pyapr-*${{ env.py_version_str }}*.whl
122163
123- - name : Install twine
164+ - name : Run tests
124165 run : |
125- python3 -m pip install twine
166+ python -m unittest discover -s ${{ github.workspace }}
167+
126168
127- - name : Publish to test Pypi
169+ deploy :
170+ runs-on : ubuntu-latest
171+ needs : windows-tests
172+ name : publish to pypi
173+ if : contains(github.ref, 'tags') # only run on tagged commits starting with "v*"
174+ steps :
175+ - name : Download wheels from artifacts
176+ uses : actions/download-artifact@v2
177+ with :
178+ path : wheelhouse
179+
180+ - name : Set up Python
181+ uses : actions/setup-python@v2
182+ with :
183+ python-version : ' 3.7'
184+
185+ - name : Install dependencies
128186 run : |
129- python3 -m twine upload --skip-existing --repository pypi ${{matrix.builddir}}/*.whl -p ${{ secrets.PYPI_API_TOKEN }}
187+ python -m pip install --upgrade pip
188+ pip install -U twine
130189
131- # - name: Test release from pypi 3.7
132- # run: |
133- # pip install pyapr
134- # python3 -m unittest
190+ - name : Publish
191+ env :
192+ TWINE_USERNAME : __token__
193+ TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
194+ run : |
195+ twine upload wheelhouse/*wheels/*.whl
0 commit comments