|
| 1 | +name: main |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +env: |
| 6 | + CIBW_BEFORE_BUILD_MACOS: "bash {project}/.github/scripts/install-macos-deps.sh" |
| 7 | + |
| 8 | +jobs: |
| 9 | + |
| 10 | + |
| 11 | + build-cibuildwheel: |
| 12 | + name: Build wheels on ${{ matrix.os }} |
| 13 | + runs-on: ${{ matrix.os }} |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + os: [ubuntu-20.04, macos-13] |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + with: |
| 21 | + submodules: recursive |
| 22 | + |
| 23 | + - name: Set up Python |
| 24 | + uses: actions/setup-python@v4 |
| 25 | + with: |
| 26 | + python-version: 3.8 |
| 27 | + |
| 28 | + - name: Build wheels |
| 29 | + run: | |
| 30 | + pip install --upgrade pip build cibuildwheel |
| 31 | + cibuildwheel |
| 32 | +
|
| 33 | + - uses: actions/upload-artifact@v3 |
| 34 | + with: |
| 35 | + name: static-wheels |
| 36 | + path: ./wheelhouse/* |
| 37 | + |
| 38 | + |
| 39 | + build-dynamic-linux: |
| 40 | + name: Build dynamic wheel on linux |
| 41 | + runs-on: ubuntu-latest |
| 42 | + |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v3 |
| 45 | + with: |
| 46 | + submodules: recursive |
| 47 | + |
| 48 | + - name: Set up Python |
| 49 | + uses: actions/setup-python@v4 |
| 50 | + with: |
| 51 | + python-version: 3.8 |
| 52 | + |
| 53 | + - name: Build wheel |
| 54 | + run: | |
| 55 | + pip install --upgrade pip build wheel auditwheel |
| 56 | + BTCLIB_LIBSECP256K1_DYNAMIC=true python -m build -w |
| 57 | + auditwheel repair dist/* |
| 58 | +
|
| 59 | + - uses: actions/upload-artifact@v3 |
| 60 | + with: |
| 61 | + name: dynamic-wheels |
| 62 | + path: ./wheelhouse/* |
| 63 | + |
| 64 | + - name: Build source |
| 65 | + run: python -m build -s -o wheelhouse |
| 66 | + |
| 67 | + - uses: actions/upload-artifact@v3 |
| 68 | + with: |
| 69 | + name: sdist |
| 70 | + path: ./wheelhouse/*.tar.gz |
| 71 | + |
| 72 | + |
| 73 | + build-dynamic-macos: |
| 74 | + name: Build dynamic wheel on Macos |
| 75 | + runs-on: macos-11 |
| 76 | + |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v3 |
| 79 | + with: |
| 80 | + submodules: recursive |
| 81 | + |
| 82 | + - name: Set up Python |
| 83 | + uses: actions/setup-python@v4 |
| 84 | + with: |
| 85 | + python-version: 3.8 |
| 86 | + |
| 87 | + - name: Install dependencies |
| 88 | + run: bash .github/scripts/install-macos-deps.sh |
| 89 | + |
| 90 | + - name: Build wheel |
| 91 | + run: | |
| 92 | + pip install --upgrade pip build wheel delocate |
| 93 | + BTCLIB_LIBSECP256K1_DYNAMIC=true CFFI_PLATFORM=Darwin python -m build -w |
| 94 | + delocate-wheel -w wheelhouse dist/* |
| 95 | +
|
| 96 | + - uses: actions/upload-artifact@v3 |
| 97 | + with: |
| 98 | + name: dynamic-wheels |
| 99 | + path: ./wheelhouse/* |
| 100 | + |
| 101 | + |
| 102 | + build-windows: |
| 103 | + name: "Build on Linux for Windows" |
| 104 | + runs-on: ubuntu-latest |
| 105 | + |
| 106 | + steps: |
| 107 | + - uses: actions/checkout@v3 |
| 108 | + with: |
| 109 | + submodules: recursive |
| 110 | + |
| 111 | + - name: Set up Python |
| 112 | + uses: actions/setup-python@v4 |
| 113 | + with: |
| 114 | + python-version: 3.8 |
| 115 | + |
| 116 | + - name: Install dependencies |
| 117 | + run: sudo apt install -y mingw-w64 |
| 118 | + |
| 119 | + - name: Build Windows wheel |
| 120 | + run: | |
| 121 | + pip install --upgrade pip build wheel |
| 122 | + BTCLIB_LIBSECP256K1_CROSS_COMPILE=true CFFI_PLATFORM=Windows python -m build -w |
| 123 | +
|
| 124 | + - uses: actions/upload-artifact@v3 |
| 125 | + with: |
| 126 | + name: dynamic-wheels |
| 127 | + path: dist/* |
| 128 | + |
| 129 | + |
| 130 | + test-dynamic: |
| 131 | + name: "Test ${{ matrix.python-version }} on ${{ matrix.os }}" |
| 132 | + runs-on: ${{ matrix.os }} |
| 133 | + strategy: |
| 134 | + fail-fast: false |
| 135 | + matrix: |
| 136 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 137 | + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.7", "pypy-3.8", "pypy-3.9"] |
| 138 | + env: |
| 139 | + PYTHON_VERSION: ${{ matrix.python-version }} |
| 140 | + OS_NAME: ${{ matrix.os }} |
| 141 | + needs: [build-windows, build-dynamic-linux, build-dynamic-macos] |
| 142 | + |
| 143 | + steps: |
| 144 | + - uses: actions/checkout@v3 |
| 145 | + |
| 146 | + - name: Set up Python ${{ matrix.python-version }} |
| 147 | + uses: actions/setup-python@v4 |
| 148 | + with: |
| 149 | + python-version: ${{ matrix.python-version }} |
| 150 | + |
| 151 | + - name: Upgrade Python packaging tools |
| 152 | + run: pip install --upgrade pip pytest |
| 153 | + |
| 154 | + - name: Show runner information |
| 155 | + run: | |
| 156 | + python --version |
| 157 | + pip --version |
| 158 | +
|
| 159 | + - uses: actions/download-artifact@v3 |
| 160 | + with: |
| 161 | + name: dynamic-wheels |
| 162 | + path: dist |
| 163 | + |
| 164 | + - name: Install lib |
| 165 | + run: | |
| 166 | + python -m pip install cffi |
| 167 | + python -m pip install --verbose --no-index --find-links dist/ btclib_libsecp256k1 |
| 168 | +
|
| 169 | + - name: Test |
| 170 | + run: pytest |
| 171 | + |
| 172 | + |
| 173 | + test-static: |
| 174 | + name: "Test ${{ matrix.python-version }} on ${{ matrix.os }}" |
| 175 | + runs-on: ${{ matrix.os }} |
| 176 | + strategy: |
| 177 | + fail-fast: false |
| 178 | + matrix: |
| 179 | + os: [ubuntu-latest, macos-latest] |
| 180 | + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.7", "pypy-3.8", "pypy-3.9"] |
| 181 | + env: |
| 182 | + PYTHON_VERSION: ${{ matrix.python-version }} |
| 183 | + OS_NAME: ${{ matrix.os }} |
| 184 | + needs: build-cibuildwheel |
| 185 | + |
| 186 | + steps: |
| 187 | + - uses: actions/checkout@v3 |
| 188 | + |
| 189 | + - name: Set up Python ${{ matrix.python-version }} |
| 190 | + uses: actions/setup-python@v4 |
| 191 | + with: |
| 192 | + python-version: ${{ matrix.python-version }} |
| 193 | + |
| 194 | + - name: Upgrade Python packaging tools |
| 195 | + run: pip install --upgrade pip pytest |
| 196 | + |
| 197 | + - name: Show runner information |
| 198 | + run: | |
| 199 | + python --version |
| 200 | + pip --version |
| 201 | +
|
| 202 | + - uses: actions/download-artifact@v3 |
| 203 | + with: |
| 204 | + name: static-wheels |
| 205 | + path: dist |
| 206 | + |
| 207 | + - name: Install lib |
| 208 | + run: | |
| 209 | + python -m pip install cffi |
| 210 | + python -m pip install --verbose --no-index --find-links dist/ btclib_libsecp256k1 |
| 211 | +
|
| 212 | + - name: Test |
| 213 | + run: pytest |
0 commit comments