Skip to content

Commit

Permalink
Run Windows CI on Github Actions
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Oct 22, 2024
1 parent f7070f4 commit c2e5b10
Show file tree
Hide file tree
Showing 17 changed files with 292 additions and 352 deletions.
133 changes: 0 additions & 133 deletions .appveyor.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
127 changes: 127 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
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-2019, 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: |
if [[ "${{ github.event_name }}" == "push" ]]; then
if [[ "${{ github.ref_name }}" == "master" ]]; then
./bootstrap
else
./bootstrap.ci -s "-${{ github.ref_name }}"
fi
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
if [[ "${{ github.base_ref }}" == "master" ]]; then
./bootstrap.ci -s "-pr${{ github.event.number }}"
else
./bootstrap.ci -s "-${{ github.base_ref }}-pr${{ github.event.number }}"
fi
fi
- 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 }}-${{ matrix.image }}-${{ matrix.platform }}
- 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 /O1 /Zi /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 /DHAVE_DECL_OPENSSL_ZALLOC /DHAVE_DH_GET0_KEY /DHAVE_DH_GET0_PQG `
/DHAVE_DH_SET0_KEY /DHAVE_DH_SET0_PQG /DHAVE_ECDSA_SIG_GET0 /DHAVE_ECDSA_SIG_SET0 `
/DHAVE_EC_KEY_METHOD /DHAVE_RSA_GET0_KEY /DHAVE_RSA_SET0_KEY /DHAVE_EC_POINT_GET_AFFINE_COORDINATES `
/DHAVE_EC_POINT_SET_AFFINE_COORDINATES /DHAVE_EVP_PKEY_DUP /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.image }}_${{ matrix.platform }}_${{ matrix.configuration }}
path: |
./*.msi
./*-Debug.zip
10 changes: 0 additions & 10 deletions Makefile.mak
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@ SUBDIRS = etc win32 src

default: all

32:
CALL "C:\Program Files\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
$(MAKE) /f Makefile.mak opensc.msi PLATFORM=x86 OPENPACE_DIR=C:\openpace-Win32_1.0.2
MOVE win32\OpenSC.msi OpenSC_win32.msi

64:
CALL "C:\Program Files\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
$(MAKE) /f Makefile.mak opensc.msi OPENPACE_DIR=C:\openpace-Win64_1.0.2
MOVE win32\OpenSC.msi OpenSC_win64.msi

opensc.msi:
$(MAKE) /f Makefile.mak all OPENSSL_DEF=/DENABLE_OPENSSL OPENPACE_DEF=/DENABLE_OPENPACE"
@cmd /c "cd win32 && $(MAKE) /nologo /f Makefile.mak opensc.msi OPENSSL_DEF=/DENABLE_OPENSSL OPENPACE_DEF=/DENABLE_OPENPACE"
Expand Down
Loading

0 comments on commit c2e5b10

Please sign in to comment.