cross-compiles.yml 6.1 KB

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