Bump actions/setup-python from 4.7.0 to 4.7.1
[openssl.git] / .github / workflows / ci.yml
1 # Copyright 2021-2023 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
8 name: GitHub CI
9
10 on: [pull_request, push]
11
12 # for some reason, this does not work:
13 # variables:
14 #   BUILDOPTS: "-j4"
15 #   HARNESS_JOBS: "${HARNESS_JOBS:-4}"
16
17 # for some reason, this does not work:
18 # before_script:
19 #     - make="make -s"
20
21 permissions:
22   contents: read
23
24 jobs:
25   check_update:
26     runs-on: ubuntu-latest
27     steps:
28     - name: install unifdef
29       run: |
30         sudo apt-get update
31         sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install unifdef
32     - uses: actions/checkout@v4
33       with:
34         fetch-depth: 0
35     - name: config
36       run: ./config --banner=Configured --strict-warnings enable-fips && perl configdata.pm --dump
37     - name: make build_generated
38       run: make -s build_generated
39     - name: make update
40       run: make update
41     - name: git diff
42       run: git diff --exit-code
43
44   check_docs:
45     runs-on: ubuntu-latest
46     steps:
47     - uses: actions/checkout@v4
48     - name: config
49       run: ./config --banner=Configured --strict-warnings enable-fips && perl configdata.pm --dump
50     - name: make build_generated
51       run: make -s build_generated
52     - name: make doc-nits
53       run: make doc-nits
54     - name: make help
55       run: make help
56     - name: make md-nits
57       run: |
58           sudo gem install mdl
59           make md-nits
60
61   # This checks that we use ANSI C language syntax and semantics.
62   # We are not as strict with libraries, but rather adapt to what's
63   # expected to be available in a certain version of each platform.
64   check-ansi:
65     runs-on: ubuntu-latest
66     steps:
67     - uses: actions/checkout@v4
68     - name: config
69       run: CPPFLAGS=-ansi ./config --banner=Configured no-asm no-makedepend enable-buildtest-c++ enable-fips --strict-warnings -D_DEFAULT_SOURCE && perl configdata.pm --dump
70     - name: make
71       run: make -s -j4
72
73   basic_gcc:
74     runs-on: ubuntu-latest
75     steps:
76     - uses: actions/checkout@v4
77     - name: checkout fuzz/corpora submodule
78       run: git submodule update --init --depth 1 fuzz/corpora
79     - name: localegen
80       run: sudo locale-gen tr_TR.UTF-8
81     - name: config
82       # enable-quic is on by default, but we leave it here to check we're testing the explicit enable somewhere
83       run: CC=gcc ./config --banner=Configured enable-fips enable-quic --strict-warnings && perl configdata.pm --dump
84     - name: make
85       run: make -s -j4
86     - name: make test
87       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
88
89   basic_clang:
90     runs-on: ubuntu-latest
91     steps:
92     - uses: actions/checkout@v4
93     - name: checkout fuzz/corpora submodule
94       run: git submodule update --init --depth 1 fuzz/corpora
95     - name: config
96       run: CC=clang ./config --banner=Configured no-fips --strict-warnings && perl configdata.pm --dump
97     - name: make
98       run: make -s -j4
99     - name: make test
100       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
101
102   minimal:
103     runs-on: ubuntu-latest
104     steps:
105     - uses: actions/checkout@v4
106     - name: checkout fuzz/corpora submodule
107       run: git submodule update --init --depth 1 fuzz/corpora
108     - name: config
109       run: ./config --banner=Configured --strict-warnings no-bulk no-pic no-asm -DOPENSSL_NO_SECURE_MEMORY -DOPENSSL_SMALL_FOOTPRINT && perl configdata.pm --dump
110     - name: make
111       run: make -j4 # verbose, so no -s here
112     - name: make test
113       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
114
115   no-deprecated:
116     runs-on: ubuntu-latest
117     steps:
118     - uses: actions/checkout@v4
119     - name: checkout fuzz/corpora submodule
120       run: git submodule update --init --depth 1 fuzz/corpora
121     - name: config
122       run: ./config --banner=Configured --strict-warnings no-deprecated enable-fips && perl configdata.pm --dump
123     - name: make
124       run: make -s -j4
125     - name: make test
126       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
127
128   no-shared:
129     strategy:
130       matrix:
131         os: [ ubuntu-latest, macos-latest ]
132     runs-on: ${{matrix.os}}
133     steps:
134     - uses: actions/checkout@v4
135     - name: checkout fuzz/corpora submodule
136       run: git submodule update --init --depth 1 fuzz/corpora
137     - name: config
138       run: ./config --banner=Configured --strict-warnings no-shared no-fips && perl configdata.pm --dump
139     - name: make
140       run: make -s -j4
141     - name: make test
142       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
143
144   non-caching:
145     runs-on: ubuntu-latest
146     steps:
147     - uses: actions/checkout@v4
148     - name: checkout fuzz/corpora submodule
149       run: git submodule update --init --depth 1 fuzz/corpora
150     - name: config
151       run: ./config --banner=Configured --debug enable-asan enable-ubsan no-cached-fetch no-fips no-dtls no-tls1 no-tls1-method no-tls1_1 no-tls1_1-method no-async && perl configdata.pm --dump
152     - name: make
153       run: make -s -j4
154     - name: make test
155       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} OPENSSL_TEST_RAND_ORDER=0 TESTS="-test_fuzz* -test_ssl_* -test_sslapi -test_evp -test_cmp_http -test_verify -test_cms -test_store -test_enc -[01][0-9]"
156
157   address_ub_sanitizer:
158     runs-on: ubuntu-latest
159     steps:
160     - uses: actions/checkout@v4
161     - name: checkout fuzz/corpora submodule
162       run: git submodule update --init --depth 1 fuzz/corpora
163     - name: config
164       run: ./config --banner=Configured --debug enable-asan enable-ubsan enable-rc5 enable-md2 enable-ec_nistp_64_gcc_128 enable-fips -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION && perl configdata.pm --dump
165     - name: make
166       run: make -s -j4
167     - name: make test
168       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} OPENSSL_TEST_RAND_ORDER=0
169
170   memory_sanitizer:
171     runs-on: ubuntu-latest
172     steps:
173     - uses: actions/checkout@v4
174     - name: checkout fuzz/corpora submodule
175       run: git submodule update --init --depth 1 fuzz/corpora
176     - name: config
177       # --debug -O1 is to produce a debug build that runs in a reasonable amount of time
178       run: CC=clang ./config --banner=Configured --debug -O1 -fsanitize=memory -DOSSL_SANITIZE_MEMORY -fno-optimize-sibling-calls enable-rc5 enable-md2 enable-ec_nistp_64_gcc_128 enable-fips && perl configdata.pm --dump
179     - name: make
180       run: make -s -j4
181     - name: make test
182       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} OPENSSL_TEST_RAND_ORDER=0
183
184   threads_sanitizer:
185     runs-on: ubuntu-latest
186     steps:
187     - uses: actions/checkout@v4
188     - name: checkout fuzz/corpora submodule
189       run: git submodule update --init --depth 1 fuzz/corpora
190     - name: config
191       run: CC=clang ./config --banner=Configured no-fips --strict-warnings -fsanitize=thread && perl configdata.pm --dump
192     - name: make
193       run: make -s -j4
194     - name: make test
195       run: make V=1 TESTS="test_threads test_internal_provider test_provfetch test_provider test_pbe test_evp_kdf test_pkcs12 test_store test_evp test_quic*" test HARNESS_JOBS=${HARNESS_JOBS:-4}
196
197   enable_non-default_options:
198     runs-on: ubuntu-latest
199     steps:
200     - uses: actions/checkout@v4
201     - name: checkout fuzz/corpora submodule
202       run: git submodule update --init --depth 1 fuzz/corpora
203     - name: modprobe tls
204       run: sudo modprobe tls
205     - name: config
206       run: ./config --banner=Configured --strict-warnings no-ec enable-ssl-trace enable-zlib enable-zlib-dynamic enable-crypto-mdebug enable-crypto-mdebug-backtrace enable-egd enable-ktls enable-fips no-threads && perl configdata.pm --dump
207     - name: make
208       run: make -s -j4
209     - name: make test
210       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
211
212   fips_and_ktls:
213     runs-on: ubuntu-latest
214     steps:
215     - uses: actions/checkout@v4
216     - name: checkout fuzz/corpora submodule
217       run: git submodule update --init --depth 1 fuzz/corpora
218     - name: modprobe tls
219       run: sudo modprobe tls
220     - name: config
221       run: ./config --banner=Configured --strict-warnings enable-ktls enable-fips && perl configdata.pm --dump
222     - name: make
223       run: make -s -j4
224     - name: make test
225       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
226
227   enable_brotli_dynamic:
228     runs-on: ubuntu-latest
229     steps:
230     - name: install brotli
231       run: |
232         sudo apt-get update
233         sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install brotli libbrotli1 libbrotli-dev
234     - name: checkout openssl
235       uses: actions/checkout@v4
236     - name: checkout fuzz/corpora submodule
237       run: git submodule update --init --depth 1 fuzz/corpora
238     - name: config
239       run: ./config enable-comp enable-brotli enable-brotli-dynamic && perl configdata.pm --dump
240     - name: make
241       run: make -s -j4
242     - name: make test
243       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
244
245   enable_zstd_dynamic:
246     runs-on: ubuntu-latest
247     steps:
248     - name: install zstd
249       run: |
250         sudo apt-get update
251         sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install zstd libzstd1 libzstd-dev
252     - name: checkout openssl
253       uses: actions/checkout@v4
254     - name: checkout fuzz/corpora submodule
255       run: git submodule update --init --depth 1 fuzz/corpora
256     - name: config
257       run: ./config enable-comp enable-zstd enable-zstd-dynamic && perl configdata.pm --dump
258     - name: make
259       run: make -s -j4
260     - name: make test
261       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
262
263   enable_brotli_and_zstd_dynamic:
264     runs-on: ubuntu-latest
265     steps:
266     - name: install brotli and zstd
267       run: |
268         sudo apt-get update
269         sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install brotli libbrotli1 libbrotli-dev
270         sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install zstd libzstd1 libzstd-dev
271     - name: checkout openssl
272       uses: actions/checkout@v4
273     - name: checkout fuzz/corpora submodule
274       run: git submodule update --init --depth 1 fuzz/corpora
275     - name: config
276       run: ./config enable-comp enable-brotli enable-brotli-dynamic enable-zstd enable-zstd-dynamic && perl configdata.pm --dump
277     - name: make
278       run: make -s -j4
279     - name: make test
280       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
281
282   enable_brotli_and_asan_ubsan:
283     runs-on: ubuntu-latest
284     steps:
285     - name: install brotli
286       run: |
287         sudo apt-get update
288         sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install brotli libbrotli1 libbrotli-dev
289     - name: checkout openssl
290       uses: actions/checkout@v4
291     - name: checkout fuzz/corpora submodule
292       run: git submodule update --init --depth 1 fuzz/corpora
293     - name: config
294       run: ./config --banner=Configured --debug enable-asan enable-ubsan enable-comp enable-brotli -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -DPEDANTIC && perl configdata.pm --dump
295     - name: make
296       run: make -s -j4
297     - name: make test
298       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} OPENSSL_TEST_RAND_ORDER=0
299
300   enable_zstd_and_asan_ubsan:
301     runs-on: ubuntu-latest
302     steps:
303     - name: install zstd
304       run: |
305         sudo apt-get update
306         sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install zstd libzstd1 libzstd-dev
307     - name: checkout openssl
308       uses: actions/checkout@v4
309     - name: checkout fuzz/corpora submodule
310       run: git submodule update --init --depth 1 fuzz/corpora
311     - name: config
312       run: ./config --banner=Configured --debug enable-asan enable-ubsan enable-comp enable-zstd -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -DPEDANTIC && perl configdata.pm --dump
313     - name: make
314       run: make -s -j4
315     - name: make test
316       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4} OPENSSL_TEST_RAND_ORDER=0
317
318   no-legacy:
319     runs-on: ubuntu-latest
320     steps:
321     - uses: actions/checkout@v4
322     - name: checkout fuzz/corpora submodule
323       run: git submodule update --init --depth 1 fuzz/corpora
324     - name: config
325       run: ./config --banner=Configured --strict-warnings no-legacy enable-fips && perl configdata.pm --dump
326     - name: make
327       run: make -s -j4
328     - name: make test
329       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
330
331   legacy:
332     runs-on: ubuntu-latest
333     steps:
334     - uses: actions/checkout@v4
335     - name: checkout fuzz/corpora submodule
336       run: git submodule update --init --depth 1 fuzz/corpora
337     - name: config
338       run: ./config --banner=Configured -Werror --debug no-afalgeng no-shared enable-crypto-mdebug enable-rc5 enable-md2 enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 no-fips && perl configdata.pm --dump
339     - name: make
340       run: make -s -j4
341     - name: make test
342       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
343
344   enable-tfo:
345     strategy:
346       matrix:
347         os: [ ubuntu-latest, macos-latest ]
348     runs-on: ${{matrix.os}}
349     steps:
350     - uses: actions/checkout@v4
351     - name: checkout fuzz/corpora submodule
352       run: git submodule update --init --depth 1 fuzz/corpora
353     - name: config
354       run: CC=gcc ./config --banner=Configured enable-tfo --strict-warnings && perl configdata.pm --dump
355     - name: make
356       run: make -s -j4
357     - name: make test
358       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
359
360   buildtest:
361     runs-on: ubuntu-latest
362     steps:
363     - uses: actions/checkout@v4
364     - name: checkout fuzz/corpora submodule
365       run: git submodule update --init --depth 1 fuzz/corpora
366     - name: config
367       run: ./config --banner=Configured no-asm no-makedepend enable-buildtest-c++ enable-fips --strict-warnings -D_DEFAULT_SOURCE && perl configdata.pm --dump
368     - name: make
369       run: make -s -j4
370     - name: make test
371       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
372
373   out-of-source-and-install:
374     strategy:
375       matrix:
376         os: [ubuntu-latest, macos-latest ]
377     runs-on: ${{matrix.os}}
378     steps:
379     - uses: actions/checkout@v4
380     - name: checkout fuzz/corpora submodule
381       run: git submodule update --init --depth 1 fuzz/corpora
382     - name: extra preparations
383       run: |
384         mkdir ./build
385         mkdir ./install
386     - name: config
387       run: ../config --banner=Configured enable-fips enable-acvp-tests --strict-warnings --prefix=$(cd ../install; pwd) && perl configdata.pm --dump
388       working-directory: ./build
389     - name: make
390       run: make -s -j4
391       working-directory: ./build
392     - name: make test
393       run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}
394       working-directory: ./build
395     - name: make install
396       run: make install
397       working-directory: ./build
398
399   external-tests:
400     runs-on: ubuntu-latest
401     steps:
402     - uses: actions/checkout@v4
403       with:
404         submodules: recursive
405     - name: package installs
406       run: |
407         sudo apt-get update
408         sudo apt-get -yq install bison gettext keyutils ldap-utils libldap2-dev libkeyutils-dev python3 python3-paste python3-pyrad slapd tcsh python3-virtualenv virtualenv python3-kdcproxy
409     - name: install cpanm and Test2::V0 for gost_engine testing
410       uses: perl-actions/install-with-cpanm@v1
411       with:
412         install: Test2::V0
413     - name: setup hostname workaround
414       run: sudo hostname localhost
415     - name: config
416       run: ./config --banner=Configured --strict-warnings --debug no-afalgeng enable-rc5 enable-md2 enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers enable-zlib enable-ec_nistp_64_gcc_128 enable-external-tests no-fips && perl configdata.pm --dump
417     - name: make
418       run: make -s -j4
419     - name: test external gost-engine
420       run: make test TESTS="test_external_gost_engine"
421     - name: test external krb5
422       run: make test TESTS="test_external_krb5"
423     - name: test external_tlsfuzzer
424       run: make test TESTS="test_external_tlsfuzzer"
425     - name: test external oqs-provider
426       run: make test TESTS="test_external_oqsprovider"
427
428   external-test-pyca:
429     runs-on: ubuntu-latest
430     strategy:
431       matrix:
432         RUST:
433           - 1.51.0
434         PYTHON:
435           - 3.9
436     steps:
437     - uses: actions/checkout@v4
438       with:
439         submodules: recursive
440     - name: Configure OpenSSL
441       run: ./config --banner=Configured --strict-warnings --debug enable-external-tests && perl configdata.pm --dump
442     - name: make
443       run: make -s -j4
444     - name: Setup Python
445       uses: actions/setup-python@v4.7.1
446       with:
447         python-version: ${{ matrix.PYTHON }}
448     - uses: actions-rs/toolchain@v1
449       with:
450         profile: minimal
451         toolchain: ${{ matrix.RUST }}
452         override: true
453         default: true
454     - name: test external pyca
455       run: make test TESTS="test_external_pyca" VERBOSE=1
456
457   external-test-cf-quiche:
458     runs-on: ubuntu-latest
459     steps:
460     - uses: actions/checkout@v4
461       with:
462         submodules: recursive
463     - name: Configure OpenSSL
464       run: ./config --banner=Configured --strict-warnings enable-external-tests && perl configdata.pm --dump
465     - name: make
466       run: make -s -j4
467     - uses: actions-rs/toolchain@v1
468       with:
469         profile: default
470         toolchain: stable
471         default: true
472     - name: test external Cloudflare quiche
473       run: make test TESTS="test_external_cf_quiche" VERBOSE=1