Update copyright year
[openssl.git] / .github / workflows / cross-compiles.yml
1 # Copyright 2021-2022 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 jobs:
13   cross-compilation:
14     strategy:
15       fail-fast: false
16       matrix:
17         # The platform matrix specifies:
18         #   arch: the architecture to build for, this defines the tool-chain
19         #         prefix {arch}- and the Debian compiler package gcc-{arch}
20         #         name.
21         #   libs: the Debian package for the necessary link/runtime libraries.
22         #   target: the OpenSSL configuration target to use, this is passed
23         #           directly to the config command line.
24         #   fips:   set to "no" to disable building FIPS, leave unset to
25         #           build the FIPS provider.
26         #   tests: omit this to run all the tests using QEMU, set it to "none"
27         #          to never run the tests, otherwise its value is passed to
28         #          the "make test" command to allow selective disabling of
29         #          tests.
30         platform: [
31           {
32             arch: aarch64-linux-gnu,
33             libs: libc6-dev-arm64-cross,
34             target: linux-aarch64
35           }, {
36             arch: alpha-linux-gnu,
37             libs: libc6.1-dev-alpha-cross,
38             target: linux-alpha-gcc
39           }, {
40             arch: arm-linux-gnueabi,
41             libs: libc6-dev-armel-cross,
42             target: linux-armv4,
43             tests: -test_includes -test_store -test_x509_store
44           }, {
45             arch: arm-linux-gnueabihf,
46             libs: libc6-dev-armhf-cross,
47             target: linux-armv4,
48             tests: -test_includes -test_store -test_x509_store
49           }, {
50             arch: hppa-linux-gnu,
51             libs: libc6-dev-hppa-cross,
52             target: -static linux-generic32,
53             fips: no,
54             tests: -test_includes -test_store -test_x509_store
55           }, {
56             arch: m68k-linux-gnu,
57             libs: libc6-dev-m68k-cross,
58             target: -static -m68040 linux-latomic,
59             fips: no,
60             tests: -test_includes -test_store -test_x509_store
61           }, {
62             arch: mips-linux-gnu,
63             libs: libc6-dev-mips-cross,
64             target: -static linux-mips32,
65             fips: no,
66             tests: -test_includes -test_store -test_x509_store
67           }, {
68             arch: mips64-linux-gnuabi64,
69             libs: libc6-dev-mips64-cross,
70             target: -static linux64-mips64,
71             fips: no
72           }, {
73             arch: mipsel-linux-gnu,
74             libs: libc6-dev-mipsel-cross,
75             target: linux-mips32,
76             tests: -test_includes -test_store -test_x509_store
77           }, {
78             arch: powerpc64le-linux-gnu,
79             libs: libc6-dev-ppc64el-cross,
80             target: linux-ppc64le
81           }, {
82             arch: riscv64-linux-gnu,
83             libs: libc6-dev-riscv64-cross,
84             target: linux64-riscv64
85           }, {
86             arch: s390x-linux-gnu,
87             libs: libc6-dev-s390x-cross,
88             target: linux64-s390x
89           }, {
90             arch: sh4-linux-gnu,
91             libs: libc6-dev-sh4-cross,
92             target: no-async linux-latomic,
93             tests: -test_includes -test_store -test_x509_store
94           },
95
96           # These build with shared libraries but they crash when run
97           # They mirror static builds above in order to cover more of the
98           # code base.
99           {
100             arch: hppa-linux-gnu,
101             libs: libc6-dev-hppa-cross,
102             target: linux-generic32,
103             tests: none
104           }, {
105             arch: m68k-linux-gnu,
106             libs: libc6-dev-m68k-cross,
107             target: -mcfv4e linux-latomic,
108             tests: none
109           }, {
110             arch: mips-linux-gnu,
111             libs: libc6-dev-mips-cross,
112             target: linux-mips32,
113             tests: none
114           }, {
115             arch: mips64-linux-gnuabi64,
116             libs: libc6-dev-mips64-cross,
117             target: linux64-mips64,
118             tests: none
119           },
120
121           # This build doesn't execute either with or without shared libraries.
122           {
123             arch: sparc64-linux-gnu,
124             libs: libc6-dev-sparc64-cross,
125             target: linux64-sparcv9,
126             tests: none
127           }
128         ]
129     runs-on: ubuntu-latest
130     steps:
131     - name: install packages
132       run: |
133         sudo apt-get update
134         sudo apt-get -yq --force-yes install \
135             gcc-${{ matrix.platform.arch }} \
136             ${{ matrix.platform.libs }}
137     - uses: actions/checkout@v2
138
139     - name: config with FIPS
140       if: matrix.platform.fips != 'no'
141       run: |
142         ./config --banner=Configured --strict-warnings enable-fips \
143                  --cross-compile-prefix=${{ matrix.platform.arch }}- \
144                  ${{ matrix.platform.target }}
145     - name: config without FIPS
146       if: matrix.platform.fips == 'no'
147       run: |
148         ./config --banner=Configured --strict-warnings \
149                  --cross-compile-prefix=${{ matrix.platform.arch }}- \
150                  ${{ matrix.platform.target }}
151     - name: config dump
152       run: ./configdata.pm --dump
153
154     - name: make
155       run: make -s -j4
156
157     - name: install qemu
158       if: github.event_name == 'push' && matrix.platform.tests != 'none'
159       run: sudo apt-get -yq --force-yes install qemu-user
160
161     - name: make all tests
162       if: github.event_name == 'push' && matrix.platform.tests == ''
163       run: |
164         make test HARNESS_JOBS=${HARNESS_JOBS:-4} \
165                   TESTS="-test_afalg" \
166                   QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}
167     - name: make some tests
168       if: github.event_name == 'push' && matrix.platform.tests != 'none' && matrix.platform.tests != ''
169       run: |
170         make test HARNESS_JOBS=${HARNESS_JOBS:-4} \
171                   TESTS="${{ matrix.platform.tests }} -test_afalg" \
172                   QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}