Skip to content

Commit 926d55b

Browse files
committed
add github workflow to build on windows
1 parent 27056ba commit 926d55b

File tree

2 files changed

+68
-16
lines changed

2 files changed

+68
-16
lines changed

.github/workflows/build.yml

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,83 @@
22

33
name: CI
44

5-
# Controls when the action will run. Triggers the workflow on push or pull request
6-
# events but only for the master branch
5+
defaults:
6+
run:
7+
shell: bash
8+
79
on:
810
push:
911
branches: [ master ]
1012
pull_request:
1113
branches: [ master ]
1214

13-
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
env:
16+
OPENBLAS_COMMIT: 349b722d8d09303
17+
OPENBLAS_ROOT: "c:\\opt"
18+
1419
jobs:
15-
# This workflow contains a single job called "build"
1620
build:
1721
strategy:
1822
matrix:
1923
BUILD_BITS: [64, 32]
2024
INTERFACE64: ['1', '']
2125
os: [windows-latest]
22-
# The type of runner that the job will run on
26+
exclude:
27+
- BUILD_BITS: 32
28+
INTERFACE64: 1
29+
2330
runs-on: ${{ matrix.os }}
2431

25-
# Steps represent a sequence of tasks that will be executed as part of the job
2632
steps:
27-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
2833
- uses: actions/checkout@v2
34+
- uses: ilammy/msvc-dev-cmd@v1
35+
36+
- name: Setup
37+
run: |
38+
BITS=${{ matrix.BUILD_BITS }}
39+
echo "BUILD_BITS=$BITS" >> $GITHUB_ENV;
40+
if [ "$BITS" == "32" ]; then
41+
echo "PLAT=i686" >> $GITHUB_ENV;
42+
43+
else
44+
echo "PLAT=x86_64" >> $GITHUB_ENV;
45+
fi
46+
echo "START_DIR=$PWD" >> $GITHUB_ENV;
47+
choco install -y zip
2948
30-
# Runs a set of commands using the runners shell
31-
- name: Run a multi-line script
49+
- run: |
50+
choco install -y mingw --forcex86 --force --version=7.3.0
51+
refreshenv
52+
echo "C:\\ProgramData\\chocolatey\\lib\\mingw\\tools\\install\\mingw32\\bin" >> $GITHUB_PATH;
53+
name: Install 32-bit mingw
54+
shell: powershell
55+
if: ${{ matrix.BUILD_BITS == '32' }}
56+
57+
- name: Build
58+
run: |
59+
BITS=${{ matrix.BUILD_BITS }}
60+
if [ "$BITS" == "32" ]; then
61+
export PATH=/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw32/bin:$PATH
62+
fi
63+
echo $PATH
64+
git submodule update --init --recursive
65+
tools/build_openblas.sh
66+
67+
- name: Test
68+
run: |
69+
BITS=${{ matrix.BUILD_BITS }}
70+
if [ "$BITS" == "32" ]; then
71+
export PATH=/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw32/bin:$PATH
72+
fi
73+
tools/build_gfortran.sh
74+
cp test.exe builds
75+
cp test_dyn.exe builds
76+
./test.exe
77+
cp $(cygpath $OPENBLAS_ROOT)/$BITS/bin/*.dll .
78+
./test_dyn.exe
79+
80+
- name: Upload
3281
run: |
33-
echo Add other actions to build,
34-
echo test, and deploy your project.
82+
pip install -q git+https://github.com/Anaconda-Platform/[email protected]
83+
# upload_to_anaconda_staging.sh
84+

tools/build_openblas.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
# OPENBLAS_ROOT
55
# OPENBLAS_COMMIT
66
# BUILD_BITS
7-
# VC9_ROOT
7+
# START_DIR
8+
# Expects "lib.exe" and "gcc" to be on the path
89

9-
set -e
10+
set -ex
1011

1112
# Paths in Unix format
1213
OPENBLAS_ROOT=$(cygpath "$OPENBLAS_ROOT")
13-
VC9_ROOT=$(cygpath "$VC9_ROOT")
1414

1515
# Our directory for later copying
1616
our_wd=$(cygpath "$START_DIR")
@@ -20,6 +20,7 @@ rm -rf builds
2020
mkdir builds
2121

2222
cd OpenBLAS
23+
git submodule update --init --recursive
2324

2425
# Check which gcc we're using
2526
which gcc
@@ -42,11 +43,12 @@ if [ "$BUILD_BITS" == 64 ]; then
4243
else
4344
march=pentium4
4445
extra="-mfpmath=sse -msse2"
46+
fextra="-m32"
4547
vc_arch="i386"
4648
plat_tag="win32"
4749
fi
4850
cflags="-O2 -march=$march -mtune=generic $extra"
49-
fflags="$cflags -frecursive -ffpe-summary=invalid,zero"
51+
fflags="$fextra $cflags -frecursive -ffpe-summary=invalid,zero"
5052

5153
# Set suffixed-ILP64 flags
5254
if [ "$INTERFACE64" == "1" ]; then
@@ -91,7 +93,7 @@ cd $BUILD_BITS/lib
9193
# export library. Maybe fixed in later binutils by patch referred to in
9294
# https://sourceware.org/ml/binutils/2016-02/msg00002.html
9395
cp ${our_wd}/OpenBLAS/exports/${DLL_BASENAME}.def ${DLL_BASENAME}.def
94-
"$VC9_ROOT/bin/lib.exe" /machine:${vc_arch} /def:${DLL_BASENAME}.def
96+
"lib.exe" /machine:${vc_arch} /def:${DLL_BASENAME}.def
9597
cd ../..
9698
# Build template site.cfg for using this build
9799
cat > ${BUILD_BITS}/site.cfg.template << EOF

0 commit comments

Comments
 (0)