• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
8name: Cross Compile
9
10on: [pull_request, push]
11
12permissions:
13  contents: read
14
15jobs:
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        platform: [
34          {
35            arch: aarch64-linux-gnu,
36            libs: libc6-dev-arm64-cross,
37            target: linux-aarch64
38          }, {
39            arch: alpha-linux-gnu,
40            libs: libc6.1-dev-alpha-cross,
41            target: linux-alpha-gcc
42          }, {
43            arch: arm-linux-gnueabi,
44            libs: libc6-dev-armel-cross,
45            target: linux-armv4,
46            tests: -test_includes -test_store -test_x509_store
47          }, {
48            arch: arm-linux-gnueabihf,
49            libs: libc6-dev-armhf-cross,
50            target: linux-armv4,
51            tests: -test_includes -test_store -test_x509_store
52          }, {
53            arch: hppa-linux-gnu,
54            libs: libc6-dev-hppa-cross,
55            target: -static linux-generic32,
56            fips: no,
57            tests: -test_includes -test_store -test_x509_store
58          }, {
59            arch: m68k-linux-gnu,
60            libs: libc6-dev-m68k-cross,
61            target: -static -m68040 linux-latomic,
62            fips: no,
63            tests: -test_includes -test_store -test_x509_store
64          }, {
65            arch: mips-linux-gnu,
66            libs: libc6-dev-mips-cross,
67            target: -static linux-mips32,
68            fips: no,
69            tests: -test_includes -test_store -test_x509_store
70          }, {
71            arch: mips64-linux-gnuabi64,
72            libs: libc6-dev-mips64-cross,
73            target: -static linux64-mips64,
74            fips: no
75          }, {
76            arch: mipsel-linux-gnu,
77            libs: libc6-dev-mipsel-cross,
78            target: linux-mips32,
79            tests: -test_includes -test_store -test_x509_store
80          }, {
81            arch: powerpc64le-linux-gnu,
82            libs: libc6-dev-ppc64el-cross,
83            target: linux-ppc64le
84          }, {
85            arch: riscv64-linux-gnu,
86            libs: libc6-dev-riscv64-cross,
87            target: linux64-riscv64
88          }, {
89            arch: s390x-linux-gnu,
90            libs: libc6-dev-s390x-cross,
91            target: linux64-s390x
92          }, {
93            arch: sh4-linux-gnu,
94            libs: libc6-dev-sh4-cross,
95            target: no-async linux-latomic,
96            tests: -test_includes -test_store -test_x509_store
97          },
98
99          # These build with shared libraries but they crash when run
100          # They mirror static builds above in order to cover more of the
101          # code base.
102          {
103            arch: hppa-linux-gnu,
104            libs: libc6-dev-hppa-cross,
105            target: linux-generic32,
106            tests: none
107          }, {
108            arch: m68k-linux-gnu,
109            libs: libc6-dev-m68k-cross,
110            target: -mcfv4e linux-latomic,
111            tests: none
112          }, {
113            arch: mips-linux-gnu,
114            libs: libc6-dev-mips-cross,
115            target: linux-mips32,
116            tests: none
117          }, {
118            arch: mips64-linux-gnuabi64,
119            libs: libc6-dev-mips64-cross,
120            target: linux64-mips64,
121            tests: none
122          },
123
124          # This build doesn't execute either with or without shared libraries.
125          {
126            arch: sparc64-linux-gnu,
127            libs: libc6-dev-sparc64-cross,
128            target: linux64-sparcv9,
129            tests: none
130          }
131        ]
132    runs-on: ubuntu-latest
133    steps:
134    - name: install packages
135      run: |
136        sudo apt-get update
137        sudo apt-get -yq --force-yes install \
138            gcc-${{ matrix.platform.arch }} \
139            ${{ matrix.platform.libs }}
140    - uses: actions/checkout@v2
141
142    - name: config with FIPS
143      if: matrix.platform.fips != 'no'
144      run: |
145        ./config --banner=Configured --strict-warnings enable-fips \
146                 --cross-compile-prefix=${{ matrix.platform.arch }}- \
147                 ${{ matrix.platform.target }}
148    - name: config without FIPS
149      if: matrix.platform.fips == 'no'
150      run: |
151        ./config --banner=Configured --strict-warnings \
152                 --cross-compile-prefix=${{ matrix.platform.arch }}- \
153                 ${{ matrix.platform.target }}
154    - name: config dump
155      run: ./configdata.pm --dump
156
157    - name: make
158      run: make -s -j4
159
160    - name: install qemu
161      if: github.event_name == 'push' && matrix.platform.tests != 'none'
162      run: sudo apt-get -yq --force-yes install qemu-user
163
164    - name: make all tests
165      if: github.event_name == 'push' && matrix.platform.tests == ''
166      run: |
167        make test HARNESS_JOBS=${HARNESS_JOBS:-4} \
168                  QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}
169    - name: make some tests
170      if: github.event_name == 'push' && matrix.platform.tests != 'none' && matrix.platform.tests != ''
171      run: |
172        make test HARNESS_JOBS=${HARNESS_JOBS:-4} \
173                  TESTS="${{ matrix.platform.tests }}" \
174                  QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }}
175