Skip to content

Commit

Permalink
build ovs/ovn for windows in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Mar 31, 2022
1 parent 3b4ac99 commit 48e0c4e
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/build-ovs-win64.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build Win64
on: workflow_dispatch

jobs:
build-ovs-and-ovn:
name: Build OVS and OVN
runs-on: windows-2019
steps:
- name: Check out PTHREADS4W
run: |
mkdir pthreads4w
git clone https://git.code.sf.net/p/pthreads4w/code pthreads4w\code
- name: Check out OVS
uses: actions/checkout@v2
with:
repository: openvswitch/ovs
ref: branch-2.16
path: ovs

- name: Check out OVN
uses: actions/checkout@v2
with:
repository: ovn-org/ovn
ref: branch-21.06
path: ovn

- name: Apply OVS patches
working-directory: ovs
run: |
Invoke-WebRequest -Uri "https://github.com/kubeovn/ovs/commit/e238bdcb3d062728f6a3929d7e94c52c26b8b3cc.patch" -OutFile ..\ovs-01.patch
Invoke-WebRequest -Uri "https://github.com/kubeovn/ovs/commit/77edc343f97427940cd10a19c13f2dd5dc72bd45.patch" -OutFile ..\ovs-02.patch
Invoke-WebRequest -Uri "https://github.com/kubeovn/ovs/commit/e4b05cc9cc2836ba18f46d776d7e176038215763.patch" -OutFile ..\ovs-03.patch
git apply ..\ovs-01.patch
git apply ..\ovs-02.patch
git apply ..\ovs-03.patch
- name: Apply OVN patches
working-directory: ovn
run: |
Invoke-WebRequest -Uri "https://github.com/kubeovn/ovn/commit/72d2a0d17763b0d0b49e50a655473046e117c038.patch" -OutFile ..\ovn-01.patch
git apply ..\ovn-01.patch
- name: Build PTHREADS4W
working-directory: pthreads4w\code
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
nmake all install
- name: Install pypiwin32
run: python3 -m pip install pypiwin32

- name: Build OVS and OVN
shell: cmd
env:
MSYS2_PATH_TYPE: inherit
run: |
SETLOCAL ENABLEDELAYEDEXPANSION
SET _p4w_dir=%CD:\=/%/pthreads4w/PTHREADS-BUILT
FOR /F "tokens=* USEBACKQ" %%F IN (`C:\msys64\usr\bin\cygpath.exe -u "%CD%\ovs"`) DO (
SET _ovs_dir=%%F
)
FOR /F "tokens=* USEBACKQ" %%F IN (`C:\msys64\usr\bin\cygpath.exe -u "%CD%\ovn"`) DO (
SET _ovn_dir=%%F
)
CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
SET _vs_path=
FOR %%d IN ("%PATH:;=";"%") DO (
echo %%~d | findstr /C:"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" > nul && set _vs_path=!_vs_path!;%%~d
)
SET PATH="%_vs_path%;%PATH%"
C:\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm"
C:\msys64\usr\bin\bash.exe -lc "pacman -S --noconfirm libtool autoconf automake-wrapper"
C:\msys64\usr\bin\bash.exe -lc "rm -f `which link`"
C:\msys64\usr\bin\bash.exe -lc "cd '%_ovs_dir%' && ./boot.sh"
C:\msys64\usr\bin\bash.exe -lc "cd '%_ovs_dir%' && ./configure CC=./build-aux/cccl LD='`which link`' LIBS='-lws2_32 -lShlwapi -liphlpapi -lwbemuuid -lole32 -loleaut32' --prefix='C:/openvswitch/usr' --localstatedir='C:/openvswitch/var' --sysconfdir='C:/openvswitch/etc' --with-pthread='%_p4w_dir%' --disable-ssl"
C:\msys64\usr\bin\bash.exe -lc "cd '%_ovs_dir%' && make -j"
C:\msys64\usr\bin\bash.exe -lc "cd '%_ovs_dir%' && make windows_installer"
C:\msys64\usr\bin\bash.exe -lc "cd '%_ovn_dir%' && ./boot.sh"
C:\msys64\usr\bin\bash.exe -lc "cd '%_ovn_dir%' && ./configure CC=./build-aux/cccl LD='`which link`' LIBS='-lws2_32 -lShlwapi -liphlpapi -lwbemuuid -lole32 -loleaut32' --prefix='C:/ovn/usr' --localstatedir='C:/ovn/var' --sysconfdir='C:/ovn/etc' --with-pthread='%_p4w_dir%' --disable-ssl --with-ovs-source='../ovs' --with-ovs-build='../ovs'"
C:\msys64\usr\bin\bash.exe -lc "cd '%_ovn_dir%' && make -j"
C:\msys64\usr\bin\bash.exe -lc "cd '%_ovn_dir%' && make install"
- name: Upload OVS
uses: actions/upload-artifact@v2
with:
name: ovs
path: ovs\windows\ovs-windows-installer\bin\x64\Release\OpenvSwitch.msi

- name: Upload OVN
uses: actions/upload-artifact@v2
with:
name: ovn
path: C:\ovn

0 comments on commit 48e0c4e

Please sign in to comment.