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