|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: Build and Deploy |
| 4 | + |
| 5 | +# Controls when the workflow will run |
| 6 | +on: |
| 7 | + # Triggers the workflow on push or pull request events but only for the master branch |
| 8 | + push: |
| 9 | + branches: [master, develop] |
| 10 | + pull_request: |
| 11 | + branches: [ master, develop ] |
| 12 | + |
| 13 | + # Allows you to run this workflow manually from the Actions tab |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 17 | +jobs: |
| 18 | + job: |
| 19 | + name: ${{ matrix.os }}-build-and-test |
| 20 | + runs-on: ${{ matrix.os }} |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 25 | + include: |
| 26 | + - os: windows-latest |
| 27 | + triplet: x64-windows |
| 28 | + openmp: ON |
| 29 | + builddir: dist/wheelhouse |
| 30 | + builddir1: dist |
| 31 | + - os: ubuntu-latest |
| 32 | + triplet: x64-linux |
| 33 | + builddir: wheelhouse |
| 34 | + builddir1: wheelhouse |
| 35 | + - os: macos-latest |
| 36 | + triplet: x64-osx |
| 37 | + builddir: wheelhouse |
| 38 | + builddir1: wheelhouse |
| 39 | + env: |
| 40 | + # Indicates the CMake build directory where project files and binaries are being produced. |
| 41 | + CMAKE_BUILD_DIR: ${{ github.workspace }}/builddir/ |
| 42 | + # Indicates the location of the vcpkg as a Git submodule of the project repository. |
| 43 | + VCPKG_ROOT: ${{ github.workspace }}/external/LibAPR/vcpkg |
| 44 | + CIBW_ENVIRONMENT_WINDOWS: EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=D:\\a\\PyLibAPR\\PyLibAPR\\external\\LibAPR\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake -DVCPKG_MANIFEST_DIR=D:\\a\\PyLibAPR\\PyLibAPR\\external\\LibAPR\\" |
| 45 | + CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-*" |
| 46 | + CIBW_ARCHS: "auto64" |
| 47 | + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_24" |
| 48 | + TWINE_USERNAME: __token__ |
| 49 | + CIBW_BUILD_VERBOSITY: 3 |
| 50 | + 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 }}" |
| 53 | + CIBW_BEFORE_BUILD_LINUX: "apt update && apt install -y libtiff5-dev libhdf5-dev" |
| 54 | + |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v2 |
| 57 | + with: |
| 58 | + submodules: true |
| 59 | + |
| 60 | + - name: Submodule recursive |
| 61 | + run: git submodule update --init --recursive |
| 62 | + |
| 63 | + # Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be quickly restored from GitHub cache service. |
| 64 | + - uses: lukka/get-cmake@latest |
| 65 | + # Restore both vcpkg and its artifacts from the GitHub cache service. |
| 66 | + - name: Restore vcpkg and its artifacts. |
| 67 | + uses: actions/cache@v2 |
| 68 | + with: |
| 69 | + # The first path is where vcpkg generates artifacts while consuming the vcpkg.json manifest file. |
| 70 | + # The second path is the location of vcpkg (it contains the vcpkg executable and data files). |
| 71 | + # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages. |
| 72 | + path: | |
| 73 | + ${{ env.CMAKE_BUILD_DIR }}/vcpkg_installed/ |
| 74 | + ${{ env.VCPKG_ROOT }} |
| 75 | + !${{ env.VCPKG_ROOT }}/buildtrees |
| 76 | + !${{ env.VCPKG_ROOT }}/packages |
| 77 | + !${{ env.VCPKG_ROOT }}/downloads |
| 78 | + # The key is composed in a way that it gets properly invalidated: this must happen whenever vcpkg's Git commit id changes, or the list of packages changes. In this case a cache miss must happen and a new entry with a new key with be pushed to GitHub the cache service. |
| 79 | + # The key includes: hash of the vcpkg.json file, the hash of the vcpkg Git commit id, and the used vcpkg's triplet. The vcpkg's commit id would suffice, but computing an hash out it does not harm. |
| 80 | + # Note: given a key, the cache content is immutable. If a cache entry has been created improperly, in order the recreate the right content the key must be changed as well, and it must be brand new (i.e. not existing already). |
| 81 | + key: | |
| 82 | + ${{ hashFiles( 'external/LibAPR/vcpkg.json' ) }}-${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}-${{ matrix.triplet }}-invalidate |
| 83 | +
|
| 84 | + - name: check file paths |
| 85 | + run: | |
| 86 | + cd ${{ github.workspace }}/external/LibAPR/vcpkg/scripts/buildsystems/ |
| 87 | + ls |
| 88 | +
|
| 89 | + - name: Show content of workspace after cache has been restored |
| 90 | + run: find $RUNNER_WORKSPACE |
| 91 | + shell: bash |
| 92 | + |
| 93 | + # On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly. As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK. |
| 94 | + - uses: ilammy/msvc-dev-cmd@v1 |
| 95 | + |
| 96 | + - uses: actions/setup-python@v2 |
| 97 | + name: Install Python |
| 98 | + with: |
| 99 | + python-version: '3.7' |
| 100 | + |
| 101 | + - name: Install cibuildwheel |
| 102 | + run: | |
| 103 | + python3 -m pip install cibuildwheel==1.10.0 |
| 104 | +
|
| 105 | + - name: Install OpenMP dependencies with brew for OSX |
| 106 | + if: contains(matrix.os,'macos') |
| 107 | + run: | |
| 108 | + brew install libomp |
| 109 | + brew install c-blosc |
| 110 | + brew install hdf5 |
| 111 | +
|
| 112 | + - name: Run cibuildwheel |
| 113 | + run: | |
| 114 | + python3 -m cibuildwheel --output-dir ${{matrix.builddir1}} |
| 115 | +
|
| 116 | + - name: Fix windows wheels |
| 117 | + if: contains(matrix.os,'windows') |
| 118 | + run: | |
| 119 | + python3 -m pip install wheel |
| 120 | + python3 -m pip install delvewheel |
| 121 | + python3 fix_windows_wheel.py |
| 122 | +
|
| 123 | + - name: Install twine |
| 124 | + run: | |
| 125 | + python3 -m pip install twine |
| 126 | +
|
| 127 | + - name: Publish to test Pypi |
| 128 | + run: | |
| 129 | + python3 -m twine upload --skip-existing --repository pypi ${{matrix.builddir}}/*.whl -p ${{ secrets.PYPI_API_TOKEN }} |
| 130 | +
|
| 131 | +# - name: Test release from pypi 3.7 |
| 132 | +# run: | |
| 133 | +# pip install pyapr |
| 134 | +# python3 -m unittest |
0 commit comments