|
| 1 | +name: Test Clang-CL Build (Windows) |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - maintenance/** |
| 8 | + |
| 9 | +env: |
| 10 | + PYTHON_VERSION: 3.11 |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read # to fetch code (actions/checkout) |
| 18 | + |
| 19 | +jobs: |
| 20 | + meson: |
| 21 | + name: Meson windows build/test |
| 22 | + runs-on: windows-2019 |
| 23 | + # if: "github.repository == 'numpy/numpy'" |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 |
| 27 | + with: |
| 28 | + submodules: recursive |
| 29 | + fetch-depth: 0 |
| 30 | + - name: Setup Python |
| 31 | + uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1 |
| 32 | + with: |
| 33 | + python-version: ${{ env.PYTHON_VERSION }} |
| 34 | + |
| 35 | + - name: Install dependencies |
| 36 | + run: | |
| 37 | + pip install -r build_requirements.txt |
| 38 | + - name: openblas-libs |
| 39 | + run: | |
| 40 | + # Download and install pre-built OpenBLAS library |
| 41 | + # with 32-bit interfaces |
| 42 | + # Unpack it in the pkg-config hardcoded path |
| 43 | + choco install unzip -y |
| 44 | + choco install wget -y |
| 45 | + # Install llvm, which contains clang-cl |
| 46 | + choco install llvm -y --version=16.0.6 |
| 47 | + choco install -y --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite |
| 48 | + wget https://anaconda.org/multibuild-wheels-staging/openblas-libs/v0.3.21/download/openblas-v0.3.21-win_amd64-gcc_10_3_0.zip |
| 49 | + unzip -d c:\opt openblas-v0.3.21-win_amd64-gcc_10_3_0.zip |
| 50 | + echo "PKG_CONFIG_PATH=c:\opt\64\lib\pkgconfig;" >> $env:GITHUB_ENV |
| 51 | + - name: meson-configure |
| 52 | + run: | |
| 53 | + "[binaries]","c = 'clang-cl'","cpp = 'clang-cl'","ar = 'llvm-lib'","c_ld = 'lld-link'","cpp_ld = 'lld-link'" | Out-File $PWD/clang-cl-build.ini -Encoding ascii |
| 54 | + meson setup build --prefix=$PWD\build-install --native-file=$PWD/clang-cl-build.ini -Ddebug=false --optimization 2 --vsenv |
| 55 | + - name: meson-build |
| 56 | + run: | |
| 57 | + meson compile -C build -v |
| 58 | +
|
| 59 | + - name: meson-install |
| 60 | + run: | |
| 61 | + cd build |
| 62 | + meson install --no-rebuild |
| 63 | + - name: build-path |
| 64 | + run: | |
| 65 | + echo "installed_path=$PWD\build-install\Lib\site-packages" >> $env:GITHUB_ENV |
| 66 | + - name: post-install |
| 67 | + run: | |
| 68 | + $numpy_path = "${env:installed_path}\numpy" |
| 69 | + $libs_path = "${numpy_path}\.libs" |
| 70 | + mkdir ${libs_path} |
| 71 | + $ob_path = "C:/opt/64/bin/" |
| 72 | + cp $ob_path/*.dll $libs_path |
| 73 | + # Write _distributor_init.py to load .libs DLLs. |
| 74 | + python -c "from tools import openblas_support; openblas_support.make_init(r'${numpy_path}')" |
| 75 | +
|
| 76 | + - name: prep-test |
| 77 | + run: | |
| 78 | + echo "PYTHONPATH=${env:installed_path}" >> $env:GITHUB_ENV |
| 79 | + python -m pip install -r test_requirements.txt |
| 80 | + python -m pip install threadpoolctl |
| 81 | +
|
| 82 | + - name: test |
| 83 | + run: | |
| 84 | + mkdir tmp |
| 85 | + cd tmp |
| 86 | + echo "============================================" |
| 87 | + python -c "import numpy; print(numpy.show_runtime())" |
| 88 | + echo "============================================" |
| 89 | + echo "LASTEXITCODE is '$LASTEXITCODE'" |
| 90 | + python -c "import numpy, sys; sys.exit(numpy.test(verbose=3) is False)" |
| 91 | + echo "LASTEXITCODE is '$LASTEXITCODE'" |
0 commit comments