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 # The default compiler for this platform on Ubuntu 20.04 seems 84 # buggy and causes test failures. Dropping the optimisation level 85 # resolves it. 86 target: -O2 linux-ppc64le 87 }, { 88 arch: riscv64-linux-gnu, 89 libs: libc6-dev-riscv64-cross, 90 target: linux64-riscv64 91 }, { 92 arch: s390x-linux-gnu, 93 libs: libc6-dev-s390x-cross, 94 target: linux64-s390x 95 }, { 96 arch: sh4-linux-gnu, 97 libs: libc6-dev-sh4-cross, 98 target: no-async linux-latomic, 99 tests: -test_includes -test_store -test_x509_store 100 }, 101 102 # These build with shared libraries but they crash when run 103 # They mirror static builds above in order to cover more of the 104 # code base. 105 { 106 arch: hppa-linux-gnu, 107 libs: libc6-dev-hppa-cross, 108 target: linux-generic32, 109 tests: none 110 }, { 111 arch: m68k-linux-gnu, 112 libs: libc6-dev-m68k-cross, 113 target: -mcfv4e linux-latomic, 114 tests: none 115 }, { 116 arch: mips-linux-gnu, 117 libs: libc6-dev-mips-cross, 118 target: linux-mips32, 119 tests: none 120 }, { 121 arch: mips64-linux-gnuabi64, 122 libs: libc6-dev-mips64-cross, 123 target: linux64-mips64, 124 tests: none 125 }, 126 127 # This build doesn't execute either with or without shared libraries. 128 { 129 arch: sparc64-linux-gnu, 130 libs: libc6-dev-sparc64-cross, 131 target: linux64-sparcv9, 132 tests: none 133 } 134 ] 135 runs-on: ubuntu-latest 136 steps: 137 - name: install packages 138 run: | 139 sudo apt-get update 140 sudo apt-get -yq --force-yes install \ 141 gcc-${{ matrix.platform.arch }} \ 142 ${{ matrix.platform.libs }} 143 - uses: actions/checkout@v2 144 145 - name: config with FIPS 146 if: matrix.platform.fips != 'no' 147 run: | 148 ./config --banner=Configured --strict-warnings enable-fips \ 149 --cross-compile-prefix=${{ matrix.platform.arch }}- \ 150 ${{ matrix.platform.target }} 151 - name: config without FIPS 152 if: matrix.platform.fips == 'no' 153 run: | 154 ./config --banner=Configured --strict-warnings \ 155 --cross-compile-prefix=${{ matrix.platform.arch }}- \ 156 ${{ matrix.platform.target }} 157 - name: config dump 158 run: ./configdata.pm --dump 159 160 - name: make 161 run: make -s -j4 162 163 - name: install qemu 164 if: github.event_name == 'push' && matrix.platform.tests != 'none' 165 run: sudo apt-get -yq --force-yes install qemu-user 166 167 - name: make all tests 168 if: github.event_name == 'push' && matrix.platform.tests == '' 169 run: | 170 make test HARNESS_JOBS=${HARNESS_JOBS:-4} \ 171 TESTS="-test_afalg" \ 172 QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }} 173 - name: make some tests 174 if: github.event_name == 'push' && matrix.platform.tests != 'none' && matrix.platform.tests != '' 175 run: | 176 make test HARNESS_JOBS=${HARNESS_JOBS:-4} \ 177 TESTS="${{ matrix.platform.tests }} -test_afalg" \ 178 QEMU_LD_PREFIX=/usr/${{ matrix.platform.arch }} 179