cross-compiles.yml 6.3 KB

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