New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows build in github action #368
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8b163ef
added script to generate bash environment (#3)
fw2568 0a58f31
windows prepare scripts
fw2568 c38ab3a
added windows build files to distribution
fw2568 395bd8d
updated windows build
fw2568 2bbf9b0
added windows build task to build action
fw2568 e3dfc59
use matrix in windows log name
fw2568 8d9a8be
Updated Windows Build (#5)
fw2568 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -x | ||
|
||
CFLAGS_FOR_OVS="-g -O2" | ||
EXTRA_OPTS="--with-pthread=`realpath ./PTHREADS-BUILT | xargs cygpath -m`" | ||
|
||
function configure_ovs() | ||
{ | ||
./boot.sh | ||
./configure CC="./build-aux/cccl" LD="`which link`" \ | ||
LIBS="-lws2_32 -lShlwapi -liphlpapi -lwbemuuid -lole32 -loleaut32" \ | ||
CFLAGS="${CFLAGS_FOR_OVS}" $* || { cat config.log; exit 1; } | ||
} | ||
|
||
|
||
OPTS="${EXTRA_OPTS} ${OPTS} $*" | ||
configure_ovs $OPTS | ||
make -j4 || { cat config.log; exit 1; } | ||
|
||
if [ "$TESTSUITE" ]; then | ||
if ! make check TESTSUITEFLAGS=-j8 RECHECK=yes; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case we need to drop TESTSUITEFLAGS=-j8 |
||
# testsuite.log is necessary for debugging. | ||
cat ./tests/testsuite.log | ||
exit 1 | ||
fi | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
# clone and build pthreads4w | ||
git clone https://git.code.sf.net/p/pthreads4w/code pthreads4w-code | ||
cd pthreads4w-code | ||
nmake all install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,3 +228,83 @@ jobs: | |
with: | ||
name: logs-osx-clang---disable-ssl | ||
path: config.log | ||
|
||
build-windows: | ||
name: windows ${{ join(matrix.*, ' ') }} | ||
env: | ||
OPTS: --prefix=C:/openvswitch/usr --localstatedir=C:/openvswitch/var --sysconfdir=C:/openvswitch/etc ${{ matrix.opts }} | ||
TESTSUITE: ${{ matrix.testsuite }} | ||
|
||
# linking on latest VS 2019 don't work, most propably due to a VS 2019 issue since VS 16.10 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be dropped. |
||
runs-on: windows-2016 | ||
timeout-minutes: 60 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
# run only one job for windows, as more than one be enough currently to verify | ||
# PRs | ||
# tests are not enabled as they take very long and a lot of them will fail to | ||
- opts: --disable-ssl --with-vstudiotarget=Debug --with-vstudiotargetver=Win10 | ||
|
||
defaults: | ||
run: | ||
shell: msys2 {0} | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
- name: install msys | ||
uses: msys2/setup-msys2@v2 | ||
with: | ||
msystem: UCRT64 | ||
update: true | ||
install: base-devel git mingw-w64-ucrt-x86_64-toolchain | ||
- name: set up python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
# pypiwin32 has to be installed with a Windows python version therefore | ||
# this step will configure python first on Windows and exports | ||
# its location for MSYS bash. | ||
- name: configure python in Windows cmdline | ||
shell: cmd | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pypiwin32 | ||
echo export pythonLocation="%pythonLocation%" > %RUNNER_TEMP%\msys\msys64\home\%USERNAME%\.pythonenv.sh | ||
echo export PYTHONPATH="%pythonLocation%\Lib;%pythonLocation%\DLLs;%pythonLocation%\Lib\lib-tk" >> %RUNNER_TEMP%\msys\msys64\home\%USERNAME%\.pythonenv.sh | ||
echo ".pythonenv.sh was generated in %RUNNER_TEMP%\msys\msys64\home\%USERNAME%" | ||
- name: generate Visual Studio environment | ||
shell: cmd | ||
run: | | ||
powershell -c ./build-aux/envdiff.ps1 | ||
@call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | ||
powershell -c ./build-aux/envdiff.ps1 > %RUNNER_TEMP%\msys\msys64\home\%USERNAME%\.visualstudio.sh | ||
echo ".visualstudio.sh was generated in %RUNNER_TEMP%\msys\msys64\home\%USERNAME%" | ||
- name: configure python for MSYS | ||
run: | | ||
source ~/.pythonenv.sh | ||
echo "using python from path $pythonLocation" | ||
mv /ucrt64/bin/python /ucrt64/bin/python_off | ||
mv /ucrt64/bin/python3 /ucrt64/bin/python3_off | ||
ln -s "$pythonLocation\python" /ucrt64/bin/python3 | ||
- name: prepare | ||
run: | | ||
[[ -f /usr/bin/link ]] && mv /usr/bin/link /usr/bin/link_off | ||
source ~/.visualstudio.sh | ||
./.ci/windows-prepare.sh | ||
- name: build | ||
run: | | ||
source ~/.visualstudio.sh | ||
source ~/.pythonenv.sh | ||
echo $PYTHONPATH | ||
./.ci/windows-build.sh | ||
- name: upload logs on failure | ||
if: failure() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: logs-windows-${{ join(matrix.*, '-') }} | ||
path: config.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# script to export windows environment variables to bash shell | ||
# This is useful to create bash environments from vcvars64.bat | ||
# based on the solution from this article https://anadoxin.org/blog/bringing-visual-studio-compiler-into-msys2-environment.html/ | ||
|
||
if((Test-Path "snapshot.env") -eq $false){ | ||
|
||
Get-ChildItem env: | Select-Object Key,Value | ConvertTo-Json | Set-Content "snapshot.env" | ||
Write-Host "Stored snapshot.env" | ||
return | ||
} | ||
|
||
$snapshotEnv = Get-Content "snapshot.env" | ConvertFrom-Json | ||
|
||
foreach($e in Get-ChildItem env:){ | ||
if($e.Key -contains '/') { | ||
# Sometimes Windows uses environment variables like i.e. | ||
# ProgramFiles(x86)=c:\... | ||
# but let's just skip this. | ||
continue; | ||
} | ||
$key = $e.Key | ||
$keyUpperCase = $e.Key.ToUpperInvariant() | ||
|
||
if($keyUpperCase -eq "PATH") { | ||
$path = $e.Value.Replace("c:", "/c").Replace("C:", "/c").Replace("\", "/").Replace(";", ":") | ||
Write-Output "export PATH=""`$PATH:$path""" | ||
continue | ||
} | ||
$valueEscaped = $e.value.replace("\", "\\"); | ||
|
||
$snapShotEntry = $snapshotEnv | Where-Object -Property Key -eq $key | Select-Object -First 1 | ||
|
||
if($null -ne $snapShotEntry){ | ||
Write-Output "# debug: key=$keyUpperCase" | ||
$oldValue = $snapShotEntry.Value | ||
if($oldValue -ne $e.Value) { | ||
Write-Output "export $key=""$valueEscaped"" #changed" | ||
} | ||
} | ||
else{ | ||
Write-Output "export $key=""$valueEscaped"" #new" | ||
|
||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to
make -j
so it will use as many threads as the container / VM has