xref: /openssl/.github/workflows/windows.yml (revision 5c5b8d2d)
1# Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved.
2#
3# Licensed under the Apache License 2.0 (the "License").  You may not use
4# this file except in compliance with the License.  You can obtain a copy
5# in the file LICENSE in the source distribution or at
6# https://www.openssl.org/source/license.html
7
8name: Windows GitHub CI
9
10on: [pull_request, push]
11
12permissions:
13  contents: read
14
15jobs:
16  shared:
17    # Run a job for each of the specified target architectures:
18    strategy:
19      matrix:
20        platform:
21          - arch: win64
22            os: windows-2019
23            config: enable-fips
24          - arch: win64
25            os: windows-2022
26            config: enable-fips no-thread-pool no-quic
27          - arch: win32
28            os: windows-2022
29            config: --strict-warnings no-fips
30    runs-on: ${{ matrix.platform.os }}
31    steps:
32    - uses: actions/checkout@v4
33    - name: checkout fuzz/corpora submodule
34      run: git submodule update --init --depth 1 fuzz/corpora
35    - uses: ilammy/msvc-dev-cmd@v1
36      with:
37        arch: ${{ matrix.platform.arch }}
38    - uses: ilammy/setup-nasm@v1
39      with:
40        platform: ${{ matrix.platform.arch }}
41    - name: prepare the build directory
42      run: mkdir _build
43    - name: config
44      working-directory: _build
45      run: |
46        perl ..\Configure --banner=Configured no-makedepend -DOSSL_WINCTX=openssl ${{ matrix.platform.config }}
47        perl configdata.pm --dump
48    - name: build
49      working-directory: _build
50      run: nmake /S
51    - name: download coreinfo
52      uses: suisei-cn/actions-download-file@v1.6.0
53      with:
54        url: "https://download.sysinternals.com/files/Coreinfo.zip"
55        target: _build/coreinfo/
56    - name: Gather openssl version info
57      working-directory: _build
58      run: |
59        apps/openssl.exe version -v
60        apps/openssl.exe version -v | %{($_ -split '\s+')[1]}
61        apps/openssl.exe version -v | %{($_ -split '\s+')[1] -replace '([0-9]+\.[0-9]+)(\..*)','$1'}
62        echo "OSSL_VERSION=$(apps/openssl.exe version -v | %{($_ -split '\s+')[1] -replace '([0-9]+\.[0-9]+)(\..*)','$1'})" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
63    - name: Set registry keys
64      working-directory: _build
65      run: |
66        echo ${Env:OSSL_VERSION}
67        reg.exe add HKLM\SOFTWARE\OpenSSL-${Env:OSSL_VERSION}-openssl /v OPENSSLDIR /t REG_EXPAND_SZ /d TESTOPENSSLDIR /reg:32
68        reg.exe add HKLM\SOFTWARE\OpenSSL-${Env:OSSL_VERSION}-openssl /v ENGINESDIR /t REG_EXPAND_SZ /d TESTOPENSSLDIR /reg:32
69        reg.exe add HKLM\SOFTWARE\OpenSSL-${Env:OSSL_VERSION}-openssl /v MODULESDIR /t REG_EXPAND_SZ /d TESTOPENSSLDIR /reg:32
70        reg.exe query HKLM\SOFTWARE\OpenSSL-${Env:OSSL_VERSION}-openssl /v OPENSSLDIR /reg:32
71    - name: get cpu info
72      working-directory: _build
73      continue-on-error: true
74      run: |
75        7z.exe x coreinfo/Coreinfo.zip
76        ./Coreinfo64.exe -accepteula -f
77        ./apps/openssl.exe version -c
78    - name: Check platform symbol usage
79      working-directory: _build
80      run: perl ../util/checkplatformsyms.pl ../util/platform_symbols/windows-symbols.txt libcrypto-3-x64.dll ./libssl-3-x64.dll
81    - name: test
82      working-directory: _build
83      run: nmake test VERBOSE_FAILURE=yes TESTS=-test_fuzz* HARNESS_JOBS=4
84    - name: install
85      # Run on 64 bit only as 32 bit is slow enough already
86      if: ${{ matrix.platform.arch == 'win64' }}
87      run: |
88        mkdir _dest
89        nmake install DESTDIR=_dest
90      working-directory: _build
91  plain:
92    strategy:
93      matrix:
94        os:
95# Reducing CI footprint  - windows-2019
96          - windows-2022
97    runs-on: ${{ matrix.os }}
98    steps:
99    - uses: actions/checkout@v4
100    - name: checkout fuzz/corpora submodule
101      run: git submodule update --init --depth 1 fuzz/corpora
102    - uses: ilammy/msvc-dev-cmd@v1
103    - name: prepare the build directory
104      run: mkdir _build
105    - name: config
106      working-directory: _build
107      run: |
108        perl ..\Configure --banner=Configured enable-demos no-makedepend no-shared no-fips enable-md2 enable-rc5 enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers enable-trace enable-crypto-mdebug -DOSSL_WINCTX=openssl VC-WIN64A-masm
109        perl configdata.pm --dump
110    - name: build
111      working-directory: _build
112      run: nmake /S
113    - name: download coreinfo
114      uses: suisei-cn/actions-download-file@v1.6.0
115      with:
116        url: "https://download.sysinternals.com/files/Coreinfo.zip"
117        target: _build/coreinfo/
118    - name: get cpu info
119      working-directory: _build
120      continue-on-error: true
121      run: |
122        7z.exe x coreinfo/Coreinfo.zip
123        ./Coreinfo64.exe -accepteula -f
124        ./apps/openssl.exe version -c
125    - name: test
126      working-directory: _build
127      run: nmake test VERBOSE_FAILURE=yes HARNESS_JOBS=4
128  minimal:
129    strategy:
130      matrix:
131        os:
132          - windows-2019
133# Reducing CI footprint  - windows-2022
134    runs-on: ${{ matrix.os }}
135    steps:
136    - uses: actions/checkout@v4
137    - name: checkout fuzz/corpora submodule
138      run: git submodule update --init --depth 1 fuzz/corpora
139    - uses: ilammy/msvc-dev-cmd@v1
140    - name: prepare the build directory
141      run: mkdir _build
142    - name: config
143      working-directory: _build
144      run: |
145        perl ..\Configure --banner=Configured enable-demos no-makedepend no-bulk no-deprecated no-fips no-asm no-threads -DOPENSSL_SMALL_FOOTPRINT -DOSSL_WINCTX=openssl
146        perl configdata.pm --dump
147    - name: build
148      working-directory: _build
149      run: nmake # verbose, so no /S here
150    - name: download coreinfo
151      uses: suisei-cn/actions-download-file@v1.6.0
152      with:
153        url: "https://download.sysinternals.com/files/Coreinfo.zip"
154        target: _build/coreinfo/
155    - name: get cpu info
156      working-directory: _build
157      continue-on-error: true
158      run: |
159        7z.exe x coreinfo/Coreinfo.zip
160        ./Coreinfo64.exe -accepteula -f
161        ./apps/openssl.exe version -c
162    - name: test
163      working-directory: _build
164      run: nmake test VERBOSE_FAILURE=yes TESTS=-test_fuzz* HARNESS_JOBS=4
165  cygwin:
166    # Run a job for each of the specified target architectures:
167    strategy:
168      matrix:
169        os:
170          - windows-2019
171# really worth while running, too? cygwin should mask this
172#          - windows-2022
173        platform:
174          - arch: win64
175            config: -DCMAKE_C_COMPILER=gcc --strict-warnings enable-demos no-fips
176# are we really learning sth new from win32? So let's save some CO2 for now disabling this
177#          - arch: win32
178#            config: -DCMAKE_C_COMPILER=gcc --strict-warnings no-fips
179    runs-on: ${{ matrix.os }}
180    env:
181      CYGWIN_NOWINPATH: 1
182      SHELLOPTS: igncr
183# Don't overwhelm github CI VMs:
184      MAKE_PARAMS: -j 4
185    steps:
186# Checkout before cygwin can mess with PATH...
187    - uses: actions/checkout@v4
188    - uses: cygwin/cygwin-install-action@master
189      with:
190         packages: perl git make gcc-core
191    - name: Check repo
192      run: cygcheck -V
193    - name: Full cygcheck status
194      run: cygcheck -s -v -r -h
195# Activate this if checkout action fails:
196#    - name: Clone repo
197#      run: bash -c "pwd && git clone --branch ${{ github.ref_name }} --depth 1 https://github.com/${{ github.repository }}.git"
198    - name: Full build
199      run: bash -c "gcc --version && ./config ${{ matrix.platform.config }} && make $MAKE_PARAMS"
200# Disable testing for now. TBD: Need local cygwin installation to debug .
201#    - name: Run openssl tests
202#      run: bash -c "cd openssl && make V=1 test"
203