Skip to content

Commit

Permalink
Setup windows build to github actions (#395)
Browse files Browse the repository at this point in the history
IB-6794

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored Dec 30, 2020
1 parent 1a30d0c commit cfa08af
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 43 deletions.
143 changes: 120 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
name: CI
on: [push, pull_request]
env:
MAKEFLAGS: -j3
RUN_TESTS: ALL
BUILD_NUMBER: ${{ github.run_number }}
jobs:
macos:
name: Build on macOS for ${{ matrix.target }}
runs-on: macos-latest
env:
MAKEFLAGS: -j3
strategy:
matrix:
target: [osx, ios, iossimulator, androidarm, androidarm64, androidx86, androidx86_64]
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
Expand Down Expand Up @@ -47,10 +48,7 @@ jobs:
run: sudo ln -s $PWD/cache/* /Library/
- name: Build macOS
if: matrix.target == 'osx'
run: |
./build-library.sh all pkcs11sign zipdebug embedlibs pkgbuild
mkdir upload
cp macOS/libdigidocpp*.pkg macOS/libdigidocpp*.zip upload
run: ./build-library.sh all pkcs11sign zipdebug embedlibs pkgbuild
- name: Build ${{ matrix.target }}
if: matrix.target != 'osx'
run: ./build-library.sh ${{ matrix.target }} install/strip
Expand All @@ -59,7 +57,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: pkgs
path: upload
path: macOS/libdigidocpp*.*
ubuntu:
name: Build on Ubuntu to ${{ matrix.container }}
runs-on: ubuntu-latest
Expand All @@ -68,6 +66,7 @@ jobs:
matrix:
container: ['ubuntu:18.04', 'ubuntu:20.04', 'ubuntu:20.10']
env:
MAKEFLAGS: -j3
DEBIAN_FRONTEND: noninteractive
DEBFULLNAME: 'github-actions'
DEBEMAIL: '[email protected]'
Expand All @@ -94,15 +93,80 @@ jobs:
- name: Build packages
run: |
dpkg-buildpackage -rfakeroot -us -uc
mkdir upload
cp ../libdigidocpp*.* upload
mv ../libdigidocpp*.* .
- name: Lintian
run: lintian ../*.deb;
run: lintian *.deb;
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: debs
path: upload
path: libdigidocpp*.*
windows:
name: Build on Windows
runs-on: windows-latest
env:
VCVARSALL: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvarsall.bat"
CACHE: "${{ github.workspace }}/cache"
VER_SUFFIX: ".VS142"
VERSION: "3.14.5.${{ github.run_number }}"
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
run: choco install doxygen.install swig -y > $null
- name: Cache
uses: actions/cache@v2
id: cache
with:
path: cache
key: ${{ matrix.target }}-${{ hashFiles('prepare_osx_build_environment.sh') }}
- name: Build zlib
if: steps.cache.outputs.cache-hit != 'true'
run: .\prepare_win_build_environment.ps1 -target "$env:CACHE" -toolset 142 -vcvars "$env:VCVARSALL" -zlib
- name: Build xerces-c
if: steps.cache.outputs.cache-hit != 'true'
run: .\prepare_win_build_environment.ps1 -target "$env:CACHE" -toolset 142 -vcvars "$env:VCVARSALL" -xerces
- name: Build xalan-c
if: steps.cache.outputs.cache-hit != 'true'
run: .\prepare_win_build_environment.ps1 -target "$env:CACHE" -toolset 142 -vcvars "$env:VCVARSALL" -xalan
- name: Build OpenSSL
if: steps.cache.outputs.cache-hit != 'true'
run: |
choco install activeperl -y > $null
.\prepare_win_build_environment.ps1 -target "$env:CACHE" -toolset 142 -vcvars "$env:VCVARSALL" -openssl
Copy-Item \OpenSSL-Win32 cache\OpenSSL-Win32 -recurse
Copy-Item \OpenSSL-Win64 cache\OpenSSL-Win64 -recurse
- name: Build xml-security-c
if: steps.cache.outputs.cache-hit != 'true'
run: .\prepare_win_build_environment.ps1 -target "$env:CACHE" -toolset 142 -vcvars "$env:VCVARSALL" -xmlsec
- name: Build xsd
if: steps.cache.outputs.cache-hit != 'true'
run: .\prepare_win_build_environment.ps1 -target "$env:CACHE" -toolset 142 -vcvars "$env:VCVARSALL" -xsd
- name: Setup cache
run: |
mkdir \build
Copy-Item cache\zlib \build\zlib -recurse
Copy-Item cache\xerces \build\xerces -recurse
Copy-Item cache\xalan \build\xalan -recurse
Copy-Item cache\xmlsec \build\xmlsec -recurse
Copy-Item cache\xsd \build\xsd -recurse
Copy-Item cache\OpenSSL-Win32 \OpenSSL-Win32 -recurse
Copy-Item cache\OpenSSL-Win64 \OpenSSL-Win64 -recurse
- name: Build
run: |
& .\build.ps1 `
-msiversion $env:VERSION `
-toolset $env:TOOLSET `
-vcvars "$env:VCVARSALL" `
-swig C:/ProgramData/chocolatey/bin/swig.exe `
-doxygen "C:/Program files/doxygen/bin/doxygen.exe"
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
name: msi
path: ./*.msi
pages:
name: Deploy pages
if: contains(github.repository, 'open-eid/libdigidocpp') && contains(github.ref, 'master')
Expand Down Expand Up @@ -130,22 +194,55 @@ jobs:
name: Run Coverity tests
if: contains(github.repository, 'open-eid/libdigidocpp') && contains(github.ref, 'coverity_scan')
runs-on: ubuntu-latest
env:
MAKEFLAGS: -j3
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
PROJECTNAME: 'open-eid/libdigidocpp'
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
run: sudo apt-get update -qq && sudo apt-get install -y cmake vim-common xsdcxx libxml-security-c-dev zlib1g-dev curl wget ruby
- name: Build and send to Coverity
continue-on-error: true
- name: Download Coverity Build Tool
run: |
export TRAVIS_BRANCH=${GITHUB_REF##*/}
wget -O - https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh | bash
env:
COVERITY_SCAN_PROJECT_NAME: 'open-eid/libdigidocpp'
COVERITY_SCAN_NOTIFICATION_EMAIL: '[email protected]'
COVERITY_SCAN_BRANCH_PATTERN: 'coverity_scan'
COVERITY_SCAN_BUILD_COMMAND_PREPEND: 'cmake .'
COVERITY_SCAN_BUILD_COMMAND: 'make'
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=$PROJECTNAME" -O cov-analysis-linux64.tar.gz
mkdir cov-analysis-linux64
tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64
- name: Build
run: |
cmake .
export PATH=$PWD/cov-analysis-linux64/bin:$PATH
cov-build --dir cov-int make
- name: Submit the result to Coverity Scan
run: |
tar czvf upload.tgz cov-int
curl --silent \
--form project=$PROJECTNAME \
--form token=$TOKEN \
--form [email protected] \
--form [email protected] \
--form version=master \
--form description="Github Actions CI build" \
https://scan.coverity.com/builds?project=$PROJECTNAME
codeql:
name: Run CodeQL tests
runs-on: ubuntu-20.04
env:
MAKEFLAGS: -j3
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies
run: sudo apt-get update -qq && sudo apt-get install -y cmake vim-common xsdcxx libxml-security-c-dev zlib1g-dev curl wget ruby
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: cpp
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* [Architecture of ID-software](http://open-eid.github.io)

## Building
[![Build Status](https://travis-ci.com/open-eid/libdigidocpp.svg?branch=master)](https://travis-ci.com/open-eid/libdigidocpp)
[![Build Status](https://ci.appveyor.com/api/projects/status/github/open-eid/libdigidocpp?branch=master&svg=true)](https://ci.appveyor.com/project/open-eid/libdigidocpp)
[![Build Status](https://github.com/open-eid/libdigidocpp/workflows/CI/badge.svg?branch=master)](https://github.com/open-eid/libdigidocpp/actions)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/727/badge.svg)](https://scan.coverity.com/projects/727)
[![LGTM alerts](https://img.shields.io/lgtm/alerts/g/open-eid/libdigidocpp.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/open-eid/libdigidocpp/alerts/)

Expand Down
13 changes: 8 additions & 5 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
param(
[string]$target = "C:\build",
[string]$target = "\build",
[string]$buildver = "0",
[string]$msiversion = "3.14.5.$buildver",
[string]$msi_name = "libdigidocpp-$msiversion$env:VER_SUFFIX.msi",
[string]$cmake = "cmake.exe",
[string]$nmake = "nmake.exe",
[string]$generator = "NMake Makefiles",
[string]$toolset = "141",
[string]$vcvars = $null,
[string]$heat = "$env:WIX\bin\heat.exe",
[string]$candle = "$env:WIX\bin\candle.exe",
[string]$light = "$env:WIX\bin\light.exe",
Expand All @@ -19,10 +20,12 @@ param(
[switch]$source = $false
)

switch ($toolset) {
'140' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" }
'141' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" }
'142' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" }
if (!$vcvars) {
switch ($toolset) {
'140' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" }
'141' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" }
'142' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" }
}
}

$libdigidocpp = split-path -parent $MyInvocation.MyCommand.Definition
Expand Down
8 changes: 4 additions & 4 deletions libdigidocpp.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<Component Id="LibrariesX86" Guid="{57A72AF6-5458-4106-BFC8-A611DAF89A59}">
<File Source="$(var.VCPATH)\x86\Microsoft.VC$(var.VCVER).CRT\msvcp140.dll"/>
<File Source="$(var.VCPATH)\x86\Microsoft.VC$(var.VCVER).CRT\vcruntime140.dll"/>
<File Source="C:\OpenSSL-Win32\bin\libcrypto-1_1.dll"/>
<File Source="C:\OpenSSL-Win32\bin\libssl-1_1.dll"/>
<File Source="\OpenSSL-Win32\bin\libcrypto-1_1.dll"/>
<File Source="\OpenSSL-Win32\bin\libssl-1_1.dll"/>
<File Source="$(var.PREFIX)\zlib\x86\bin\zlib1.dll"/>
<?ifdef var.libdigidoc ?>
<File Source="$(var.PREFIX)\libxml2\x86\bin\libxml2.dll"/>
Expand Down Expand Up @@ -98,8 +98,8 @@
<Component Id="LibrariesX64" Guid="{1A068454-C881-49D3-A3C4-58D513C2BFE9}">
<File Source="$(var.VCPATH)\x64\Microsoft.VC$(var.VCVER).CRT\msvcp140.dll" Id="msvcp140_64.dll"/>
<File Source="$(var.VCPATH)\x64\Microsoft.VC$(var.VCVER).CRT\vcruntime140.dll" Id="vcruntime140_64.dll"/>
<File Source="C:\OpenSSL-Win64\bin\libcrypto-1_1-x64.dll"/>
<File Source="C:\OpenSSL-Win64\bin\libssl-1_1-x64.dll"/>
<File Source="\OpenSSL-Win64\bin\libcrypto-1_1-x64.dll"/>
<File Source="\OpenSSL-Win64\bin\libssl-1_1-x64.dll"/>
<File Source="$(var.PREFIX)\zlib\x64\bin\zlib1.dll" Id="zlib1_64.dll"/>
<?ifdef var.libdigidoc ?>
<File Source="$(var.PREFIX)\libxml2\x64\bin\libxml2.dll" Id="libxml2.dll_64"/>
Expand Down
21 changes: 12 additions & 9 deletions prepare_win_build_environment.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#powershell -ExecutionPolicy ByPass -File prepare_win_build_environment.ps1 [-openssl] [-xerces] [-xalan] [-xmlsec] [-xsd] [-zlib]
param(
[string]$target = "C:\build",
[string]$target = "\build",
[string]$7zip = "C:\Program Files\7-Zip\7z.exe",
[string]$cmake = "cmake.exe",
[string]$nmake = "nmake.exe",
[string]$generator = "NMake Makefiles",
[string]$toolset = "140",
[string]$vcvars = $null,
[string]$windowssdkversion = $(Get-Item "hklm:\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\v10.0").GetValue("ProductVersion"),
[string]$msbuildparams = "PlatformToolset=v$toolset;WindowsTargetPlatformVersion=$($windowssdkversion).0",
[string]$opensslver = "openssl-1.1.1i",
Expand All @@ -26,10 +27,12 @@ param(
[switch]$podofo = $false
)

switch ($toolset) {
'140' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" }
'141' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" }
'142' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" }
if (!$vcvars) {
switch ($toolset) {
'140' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" }
'141' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" }
'142' { $vcvars = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" }
}
}

$libdigidocpp = split-path -parent $MyInvocation.MyCommand.Definition
Expand Down Expand Up @@ -110,10 +113,10 @@ function xmlsec() {
Push-Location -Path xmlsec
& git apply --ignore-space-change --ignore-whitespace --whitespace=nowarn $libdigidocpp\patches\xml-security-c-2.0.1-win.patch
$xsecproj = "Projects\VC15.0\xsec\xsec_lib\xsec_lib.vcxproj"
& $vcvars x86 "&&" msbuild /nologo /verbosity:quiet "/p:$msbuildparams;Configuration=Release;Platform=Win32;OPENSSLROOT=C:\OpenSSL-Win32;XERCESCROOT=$target\xerces\x86;XALANCROOT=$target\xalan\c" $xsecproj
& $vcvars x86 "&&" msbuild /nologo /verbosity:quiet "/p:$msbuildparams;Configuration=Debug;Platform=Win32;OPENSSLROOT=C:\OpenSSL-Win32;XERCESCROOT=$target\xerces\x86;XALANCROOT=$target\xalan\c" $xsecproj
& $vcvars x86 "&&" msbuild /nologo /verbosity:quiet "/p:$msbuildparams;Configuration=Release;Platform=X64;OPENSSLROOT=C:\OpenSSL-Win64;XERCESCROOT=$target\xerces\x64;XALANCROOT=$target\xalan\c" $xsecproj
& $vcvars x86 "&&" msbuild /nologo /verbosity:quiet "/p:$msbuildparams;Configuration=Debug;Platform=X64;OPENSSLROOT=C:\OpenSSL-Win64;XERCESCROOT=$target\xerces\x64;XALANCROOT=$target\xalan\c" $xsecproj
& $vcvars x86 "&&" msbuild /nologo /verbosity:quiet "/p:$msbuildparams;Configuration=Release;Platform=Win32;OPENSSLROOT=\OpenSSL-Win32;XERCESCROOT=$target\xerces\x86;XALANCROOT=$target\xalan\c" $xsecproj
& $vcvars x86 "&&" msbuild /nologo /verbosity:quiet "/p:$msbuildparams;Configuration=Debug;Platform=Win32;OPENSSLROOT=\OpenSSL-Win32;XERCESCROOT=$target\xerces\x86;XALANCROOT=$target\xalan\c" $xsecproj
& $vcvars x86 "&&" msbuild /nologo /verbosity:quiet "/p:$msbuildparams;Configuration=Release;Platform=X64;OPENSSLROOT=\OpenSSL-Win64;XERCESCROOT=$target\xerces\x64;XALANCROOT=$target\xalan\c" $xsecproj
& $vcvars x86 "&&" msbuild /nologo /verbosity:quiet "/p:$msbuildparams;Configuration=Debug;Platform=X64;OPENSSLROOT=\OpenSSL-Win64;XERCESCROOT=$target\xerces\x64;XALANCROOT=$target\xalan\c" $xsecproj
Pop-Location
}

Expand Down

0 comments on commit cfa08af

Please sign in to comment.