]> git.ipfire.org Git - thirdparty/openssl.git/blob - .github/workflows/cross-compiles.yml
Copyright year updates
[thirdparty/openssl.git] / .github / workflows / cross-compiles.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: Cross Compile
9
10 on: [pull_request, push]
11
12 permissions:
13 contents: read
14
15 jobs:
16 cross-compilation:
17 strategy:
18 fail-fast: false
19 matrix:
20 # The platform matrix specifies:
21 # arch: the architecture to build for, this defines the tool-chain
22 # prefix {arch}- and the Debian compiler package gcc-{arch}
23 # name.
24 # libs: the Debian package for the necessary link/runtime libraries.
25 # target: the OpenSSL configuration target to use, this is passed
26 # directly to the config command line.
27 # fips: set to "no" to disable building FIPS, leave unset to
28 # build the FIPS provider.
29 # tests: omit this to run all the tests using QEMU, set it to "none"
30 # to never run the tests, otherwise its value is passed to
31 # the "make test" command to allow selective disabling of
32 # tests.
33 # qemucpu: optional; string that describes CPU properties.
34 # The string will be used to set the QEMU_CPU variable.
35 # opensslcapsname: optional; string that describes the postfix of the
36 # OpenSSL environment variable that defines CPU
37 # capabilities. E.g. "foo" will result in an
38 # environment variable with the name OPENSSL_foo.
39 # opensslcaps: optional; if opensslcapsname (see above) is set, then
40 # this string will be used as content for the OpenSSL
41 # capabilities variable.
42 # ppa: Launchpad PPA repository to download packages from.
43 platform: [
44 {
45 arch: i386-pc-msdosdjgpp,
46 libs: libc-djgpp-dev libwatt-djgpp-dev djgpp-utils,
47 target: no-threads 386 DJGPP,
48 tests: none,
49 ppa: jwt27/djgpp-toolchain
50 }, {
51 arch: aarch64-linux-gnu,
52 libs: libc6-dev-arm64-cross,
53 target: linux-aarch64
54 }, {
55 arch: alpha-linux-gnu,
56 libs: libc6.1-dev-alpha-cross,
57 target: linux-alpha-gcc
58 }, {
59 arch: arm-linux-gnueabi,
60 libs: libc6-dev-armel-cross,
61 target: linux-armv4,
62 tests: -test_includes -test_store -test_x509_store
63 }, {
64 arch: arm-linux-gnueabihf,
65 libs: libc6-dev-armhf-cross,
66 target: linux-armv4,
67 tests: -test_includes -test_store -test_x509_store
68 }, {
69 arch: hppa-linux-gnu,
70 libs: libc6-dev-hppa-cross,
71 target: -static linux-generic32,
72 fips: no,
73 tests: -test_includes -test_store -test_x509_store
74 }, {
75 arch: m68k-linux-gnu,
76 libs: libc6-dev-m68k-cross,
77 target: -static -m68040 linux-latomic -Wno-stringop-overflow,
78 fips: no,
79 tests: -test_includes -test_store -test_x509_store
80 }, {
81 arch: mips-linux-gnu,
82 libs: libc6-dev-mips-cross,
83 target: -static linux-mips32,
84 fips: no,
85 tests: -test_includes -test_store -test_x509_store
86 }, {
87 arch: mips64-linux-gnuabi64,
88 libs: libc6-dev-mips64-cross,
89 target: -static linux64-mips64,
90 fips: no
91 }, {
92 arch: mipsel-linux-gnu,
93 libs: libc6-dev-mipsel-cross,
94 target: linux-mips32,
95 tests: -test_includes -test_store -test_x509_store
96 }, {
97 arch: powerpc64le-linux-gnu,
98 libs: libc6-dev-ppc64el-cross,
99 # The default compiler for this platform on Ubuntu 20.04 seems
100 # buggy and causes test failures. Dropping the optimisation level
101 # resolves it.
102 target: -O2 linux-ppc64le
103 }, {
104 arch: riscv64-linux-gnu,
105 libs: libc6-dev-riscv64-cross,
106 target: linux64-riscv64
107 }, {
108 arch: s390x-linux-gnu,
109 libs: libc6-dev-s390x-cross,
110 target: linux64-s390x -Wno-stringop-overflow
111 }, {
112 arch: sh4-linux-gnu,
113 libs: libc6-dev-sh4-cross,
114 target: no-async linux-latomic,
115 tests: -test_includes -test_store -test_x509_store
116 },
117
118 # These build with shared libraries but they crash when run
119 # They mirror static builds above in order to cover more of the
120 # code base.
121 {
122 arch: hppa-linux-gnu,
123 libs: libc6-dev-hppa-cross,
124 target: linux-generic32,
125 tests: none
126 }, {
127 arch: m68k-linux-gnu,
128 libs: libc6-dev-m68k-cross,
129 target: -mcfv4e linux-latomic -Wno-stringop-overflow no-quic,
130 tests: none
131 }, {
132 arch: mips-linux-gnu,
133 libs: libc6-dev-mips-cross,
134 target: linux-mips32,
135 tests: none
136 }, {
137 arch: mips64-linux-gnuabi64,
138 libs: libc6-dev-mips64-cross,
139 target: linux64-mips64,
140 tests: none
141 },
142
143 # This build doesn't execute either with or without shared libraries.
144 {
145 arch: sparc64-linux-gnu,
146 libs: libc6-dev-sparc64-cross,
147 target: linux64-sparcv9,
148 tests: none
149 }
150 ]
151 runs-on: ubuntu-latest
152 steps:
153 - name: install package repository
154 if: matrix.platform.ppa != ''
155 run: |
156 sudo add-apt-repository ppa:${{ matrix.platform.ppa }}
157 - name: install packages
158 run: |
159 sudo apt-get update
160 sudo apt-get -yq --force-yes install \
161 gcc-${{ matrix.platform.arch }} \
162 ${{ matrix.platform.libs }}
163 - uses: actions/checkout@v4
164 - name: checkout fuzz/corpora submodule
165 run: git submodule update --init --depth 1 fuzz/corpora
166
167 - name: config with FIPS
168 if: matrix.platform.fips != 'no'
169 run: |
170 ./config --banner=Configured --strict-warnings enable-fips \
171 --cross-compile-prefix=${{ matrix.platform.arch }}- \
172 ${{ matrix.platform.target }}
173 - name: config without FIPS
174 if: matrix.platform.fips == 'no'
175 run: |
176 ./config --banner=Configured --strict-warnings \
177 --cross-compile-prefix=${{ matrix.platform.arch }}- \
178 ${{ matrix.platform.target }}
179 - name: config dump
180 run: ./configdata.pm --dump
181
182 - name: make
183 run: make -s -j4
184
185 - name: install qemu
186 if: github.event_name == 'push' && matrix.platform.tests != 'none'
187 run: sudo apt-get -yq --force-yes install qemu-user
188
189 - name: Set QEMU environment
190 if: github.event_name == 'push' && matrix.platform.qemucpu != ''
191 run: echo "QEMU_CPU=${{ matrix.platform.qemucpu }}" >> $GITHUB_ENV
192
193 - name: Set OpenSSL caps environment
194 if: github.event_name == 'push' && matrix.platform.opensslcapsname != ''
195 run: echo "OPENSSL_${{ matrix.platform.opensslcapsname }}=\
196 ${{ matrix.platform.opensslcaps }}" >> $GITHUB_ENV
197
198 - name: make all tests
199 if: github.event_name == 'push' && matrix.platform.tests == ''
200 run: |
201 make test HARNESS_JOBS=${HARNESS_JOBS:-4} \
202 TESTS="-test_afalg" \
203 QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}
204 - name: make some tests
205 if: github.event_name == 'push' && matrix.platform.tests != 'none' && matrix.platform.tests != ''
206 run: |
207 make test HARNESS_JOBS=${HARNESS_JOBS:-4} \
208 TESTS="${{ matrix.platform.tests }} -test_afalg" \
209 QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}