Skip to content

Commit

Permalink
.github/workflows/build_package.yaml: update windows build and fix ma…
Browse files Browse the repository at this point in the history
…cos build
  • Loading branch information
szobov committed Oct 20, 2024
1 parent 44a08f7 commit cbf4dce
Showing 1 changed file with 58 additions and 21 deletions.
79 changes: 58 additions & 21 deletions .github/workflows/build_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ jobs:
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ matrix.python-version }}-${{ hashFiles('**/Cargo.lock') }}

- name: Run cargo clippy
run: cargo clippy --all -- -D warnings
- uses: actions/cache@v2
if: matrix.os == 'windows-latest'
with:
path: ./vcpkg
key: vcpkg-openblas

- uses: Swatinem/rust-cache@v2
continue-on-error: true

- name: Install maturin on Linux (with patchelf)
if: matrix.os == 'ubuntu-latest'
Expand All @@ -62,16 +68,52 @@ jobs:
- name: Install OpenBLAS on macOS
if: matrix.os == 'macos-latest'
run: brew install openblas gfortran
run: brew install openblas gcc gfortran

- name: Set up vcpkg
if: matrix.os == 'windows-latest'
run: |
git clone https://github.com/Microsoft/vcpkg.git --depth 1
cd vcpkg
.\bootstrap-vcpkg.bat
shell: cmd

- name: Install OpenBLAS by vcpkg
if: matrix.os == 'windows-latest'
run: |
./vcpkg/vcpkg.exe install openblas:x64-windows-static
- name: Set VCPKG_ROOT environment variable on Windows
if: matrix.os == 'windows-latest'
run: |
setx VCPKG_ROOT "%cd%\vcpkg"
setx PATH "%PATH%;%cd%\vcpkg\installed\x64-windows\bin"
shell: cmd

# - name: Setup GNU Fortran
# if: matrix.os != 'ubuntu-latest'
# uses: fortran-lang/setup-fortran@v1
# with:
# compiler: gcc
# version: 13

- name: Set Fortran Compiler and Linker Flags on macOS
if: matrix.os == 'macos-latest'
run: |
export LDFLAGS="-L$(brew --prefix)/lib -lgfortran"
export LD_LIBRARY_PATH=$(brew --prefix)/lib
echo "export LDFLAGS=-L$(brew --prefix)/lib" >> $GITHUB_ENV
echo "export LD_LIBRARY_PATH=$(brew --prefix)/lib" >> $GITHUB_ENV
# - name: Set up OpenBLAS on Windows
# if: matrix.os == 'windows-latest'
# run: |
# curl -L -o openblas.zip https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
# tar -xf openblas.zip -C C:/openblas
# setx /M OPENBLAS_DIR "C:\openblas"
# setx /M PATH "%PATH%;%OPENBLAS_DIR%\bin"
# shell: cmd
- name: Run cargo tests
run: cargo test
env:
OPENBLAS_DIR: ${{ matrix.os == 'windows-latest' && '%VCPKG_ROOT%/installed/x64-windows' || '/usr/local/opt/openblas' }}

- name: Run cargo clippy
run: cargo clippy --all -- -D warnings
env:
OPENBLAS_DIR: ${{ matrix.os == 'windows-latest' && '%VCPKG_ROOT%/installed/x64-windows' || '/usr/local/opt/openblas' }}

- name: Build wheels with maturin on macOS
if: matrix.os == 'macos-latest'
Expand All @@ -87,17 +129,12 @@ jobs:
env:
OPENBLAS_DIR: /usr/lib/x86_64-linux-gnu

# - name: Build wheels with maturin on Windows
# if: matrix.os == 'windows-latest'
# run: |
# maturin build --release --out dist
# env:
# OPENBLAS_DIR: C:\openblas

- name: Run cargo tests
run: cargo test
- name: Build wheels with maturin on Windows
if: matrix.os == 'windows-latest'
run: |
maturin build --release --out dist
env:
OPENBLAS_DIR: ${{ matrix.os == 'windows-latest' && 'C:/openblas' || '/usr/local/opt/openblas' }}
OPENBLAS_DIR: "%VCPKG_ROOT%/installed/x64-windows"

- name: Install the built package
run: |
Expand Down

0 comments on commit cbf4dce

Please sign in to comment.