Skip to content

Win

Win #83

Workflow file for this run

name: Windows
on:
pull_request:
paths:
- '**.c'
- '**.h'
- '**.sh'
- .github/workflows/windows.yml
- '**.am'
- doc/**
- configure.ac
push:
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build:
runs-on: ${{ matrix.image }}
strategy:
matrix:
platform: [x86, x64]
configuration: [Light, Release]
image: [windows-2022]
env:
OPENPACE_VER: 1.1.3
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Git describe
id: ghd
uses: proudust/gh-describe@v2
- name: Package name
shell: bash
run: |
echo PACKAGE_NAME=OpenSC-${{ steps.ghd.outputs.tag }} >> $GITHUB_ENV
echo ARTIFACT=OpenSC-${{ steps.ghd.outputs.tag }}_${{ matrix.platform == 'x86' && 'win32' || 'win64' }}${{ matrix.configuration == 'Light' && '-Light' || '' }} >> $GITHUB_ENV
- name: Install CPDK
run: choco install windows-cryptographic-provider-development-kit -y > $null
- name: Install autotools
uses: msys2/setup-msys2@v2
with:
update: true
install: autotools mingw-w64-x86_64-pkg-config
- name: Bootstrap
shell: msys2 {0}
run: ./bootstrap
- name: Configure
shell: bash
run: ./configure --disable-openssl --disable-readline --disable-zlib || cat config.log
- name: Setup dev env
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.platform }}
- name: Prepare vcpkg
if: matrix.configuration == 'Release'
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: zlib openssl
vcpkgGitCommitId: 18b028fe785e707265fa0e35590b7537ae1d12ea
vcpkgTriplet: ${{ matrix.platform }}-windows-static
- name: Restore Cache
if: matrix.configuration == 'Release'
uses: actions/cache@v4
id: cache
with:
path: openpace-${{ env.OPENPACE_VER }}
key: OpenPACE-${{ env.OPENPACE_VER }}-${{ runner.os }}
- name: Build OpenPACE
if: matrix.configuration == 'Release' && steps.cache.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest "https://github.com/frankmorgner/openpace/archive/${env:OPENPACE_VER}.zip" -OutFile openpace.zip
tar xf openpace.zip
cd openpace-${env:OPENPACE_VER}\src
cl /nologo /machine:${{ matrix.platform }} /W3 /GS /MT /I${env:RUNVCPKG_VCPKG_ROOT}\installed\${env:RUNVCPKG_VCPKG_TRIPLET}\include /I. `
/DX509DIR=`"/`" /DCVCDIR=`"/`" /D_CRT_SECURE_NO_DEPRECATE /DWIN32_LEAN_AND_MEAN `
/DHAVE_ASN1_STRING_GET0_DATA=1 /DHAVE_DECL_OPENSSL_ZALLOC=1 /DHAVE_DH_GET0_KEY=1 /DHAVE_DH_GET0_PQG=1 `
/DHAVE_DH_SET0_KEY=1 /DHAVE_DH_SET0_PQG=1 /DHAVE_ECDSA_SIG_GET0=1 /DHAVE_ECDSA_SIG_SET0=1 `
/DHAVE_EC_KEY_METHOD=1 /DHAVE_RSA_GET0_KEY=1 /DHAVE_RSA_SET0_KEY=1 /DHAVE_EC_POINT_GET_AFFINE_COORDINATES=1 `
/DHAVE_EC_POINT_SET_AFFINE_COORDINATES=1 /c `
ca_lib.c cv_cert.c cvc_lookup.c x509_lookup.c eac_asn1.c eac.c eac_ca.c eac_dh.c `
eac_ecdh.c eac_kdf.c eac_lib.c eac_print.c eac_util.c misc.c pace.c pace_lib.c `
pace_mappings.c ri.c ri_lib.c ta.c ta_lib.c objects.c ssl_compat.c
lib /nologo /machine:${{ matrix.platform }} /out:libeac.lib `
ca_lib.obj cv_cert.obj cvc_lookup.obj x509_lookup.obj eac_asn1.obj eac.obj eac_ca.obj eac_dh.obj `
eac_ecdh.obj eac_kdf.obj eac_lib.obj eac_print.obj eac_util.obj misc.obj pace.obj pace_lib.obj `
pace_mappings.obj ri.obj ri_lib.obj ta.obj ta_lib.obj objects.obj ssl_compat.obj
- name: Set NMake Variables
if: matrix.configuration == 'Release'
run: |
$VCPKG_DIR="${env:RUNVCPKG_VCPKG_ROOT}\installed\${env:RUNVCPKG_VCPKG_TRIPLET}"
$NMAKE_EXTRA="ZLIBSTATIC_DEF=/DENABLE_ZLIB_STATIC ZLIB_INCL_DIR=/I${VCPKG_DIR}\include ZLIB_LIB=${VCPKG_DIR}\lib\zlib.lib"
$NMAKE_EXTRA+=" OPENSSL_DEF=/DENABLE_OPENSSL OPENSSL_DIR=${VCPKG_DIR} OPENSSL_LIB=${VCPKG_DIR}\lib\libcrypto.lib OPENSSL_EXTRA_CFLAGS=/DOPENSSL_SECURE_MALLOC_SIZE=65536"
$NMAKE_EXTRA+=" OPENPACE_DEF=/DENABLE_OPENPACE OPENPACE_DIR=${env:GITHUB_WORKSPACE}\openpace-${env:OPENPACE_VER}"
echo "NMAKE_EXTRA=$NMAKE_EXTRA" >> $env:GITHUB_ENV
- name: Build OpenSC
run: nmake /f Makefile.mak ${env:NMAKE_EXTRA}
- name: Build Installer
run: |
cd win32 && nmake /nologo /f Makefile.mak ${env:NMAKE_EXTRA} OpenSC.msi
move OpenSC.msi "..\\OpenSC-${env:ARTIFACT}.msi"
- name: Debug symbols
run: |
Get-ChildItem -recurse . -exclude vc*.pdb *.pdb | % {
7z a -tzip ${env:ARTIFACT}-Debug.zip $_.FullName
}
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: msi_${{ matrix.platform }}_${{ matrix.configuration }}
path: |
./*.msi
./*-Debug.zip