forked from OpenSC/OpenSC
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (130 loc) · 5.68 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Windows
on:
pull_request:
paths:
- '**.c'
- '**.h'
- '**.sh'
- .github/workflows/windows.yml
- '**.am'
- '**.mak'
- configure.ac
push:
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build:
runs-on: ${{ matrix.image }}
strategy:
matrix:
platform: [x86, x64, arm64]
configuration: [Light, Release]
image: [windows-2019, windows-2022]
include:
- platform: x86
setenv: amd64_x86
- platform: x64
setenv: amd64
- platform: arm64
setenv: amd64_arm64
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 ARTIFACT=OpenSC-${{ steps.ghd.outputs.tag }}_${{ matrix.platform }}${{ 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:
install: autotools mingw-w64-x86_64-pkg-config
- name: Bootstrap
shell: msys2 {0}
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref_name }}" == "master" ]]; then
./bootstrap
elif [[ "${{ github.event_name }}" == "push" ]]; then
./bootstrap.ci -s "-${{ github.ref_name }}"
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "master" ]]; then
./bootstrap.ci -s "-pr${{ github.event.number }}"
else
./bootstrap.ci -s "-${{ github.base_ref }}-pr${{ github.event.number }}"
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.setenv }}
- name: Prepare vcpkg
if: matrix.configuration == 'Release'
uses: lukka/run-vcpkg@v7
with:
vcpkgArguments: zlib openssl
vcpkgGitCommitId: 511d74f695bd45959d12b50b00f1b68f69e8f0b0
vcpkgTriplet: ${{ matrix.platform }}-windows-static
- name: Install WIX
run: powershell -ExecutionPolicy Bypass -File .github/setup-wix.ps1
- 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 /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}"
echo "ZLIBSTATIC_DEF=/DENABLE_ZLIB_STATIC" >> $env:GITHUB_ENV
echo "ZLIB_INCL_DIR=/I${VCPKG_DIR}\include" >> $env:GITHUB_ENV
echo "ZLIB_LIB=${VCPKG_DIR}\lib\zlib.lib" >> $env:GITHUB_ENV
echo "OPENSSL_DEF=/DENABLE_OPENSSL" >> $env:GITHUB_ENV
echo "OPENSSL_DIR=${VCPKG_DIR}" >> $env:GITHUB_ENV
echo "OPENSSL_LIB=${VCPKG_DIR}\lib\libcrypto.lib" >> $env:GITHUB_ENV
echo "OPENSSL_EXTRA_CFLAGS=/DOPENSSL_SECURE_MALLOC_SIZE=65536" >> $env:GITHUB_ENV
echo "OPENPACE_DEF=/DENABLE_OPENPACE" >> $env:GITHUB_ENV
echo "OPENPACE_DIR=${env:GITHUB_WORKSPACE}\openpace-${env:OPENPACE_VER}" >> $env:GITHUB_ENV
- name: Build OpenSC
run: |
nmake /nologo /f Makefile.mak opensc.msi
move win32\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