compile.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. name: Compile & test
  2. # Run whenever we push to any branch without a "/", other than [coverity-scan].
  3. on:
  4. push:
  5. branches:
  6. - '*'
  7. - '!coverity-scan'
  8. env:
  9. # Shared variables amongst all projects / platforms / compilers.
  10. CFLAGS_ALL: -std=c99 -O2
  11. CFLAGS_CLANG_LIBCPERCIVA: -Wall -Wextra -Werror -Weverything
  12. -Wno-#warnings -Wno-pedantic -Wno-padded
  13. -Wno-format-nonliteral
  14. -Wno-disabled-macro-expansion
  15. -Wno-missing-noreturn
  16. -Wno-unused-macros
  17. -Wno-documentation-unknown-command
  18. -Wno-implicit-fallthrough
  19. CFLAGS_GCC_LIBCPERCIVA: -Wall -Wextra -Werror -Wpedantic
  20. -pedantic-errors -Wno-clobbered
  21. # Variables for specific projects / platforms / compilers.
  22. CFLAGS_CLANG_PROJECT: -Wno-reserved-id-macro
  23. CFLAGS_GCC_PROJECT: -Wno-cpp
  24. CFLAGS_OSX: -Wno-poison-system-directories
  25. -I/usr/local/opt/openssl@1.1/include
  26. LDFLAGS_OSX: -L/usr/local/opt/openssl@1.1/lib
  27. jobs:
  28. Ubuntu:
  29. name: Ubuntu
  30. runs-on: ubuntu-20.04
  31. steps:
  32. - name: Update apt-get
  33. run: sudo apt-get update
  34. - name: Install software
  35. run: sudo apt-get install --no-install-recommends
  36. valgrind autoconf-archive
  37. - name: Checkout code
  38. uses: actions/checkout@v3
  39. - name: Run autoreconf
  40. run:
  41. autoreconf -i
  42. - name: Configure with clang
  43. env:
  44. CC: clang-10
  45. CFLAGS: ${{ env.CFLAGS_ALL }}
  46. run: ./configure
  47. - name: Compile with clang
  48. env:
  49. CC: clang-10
  50. CFLAGS: ${{ env.CFLAGS_ALL }}
  51. ${{ env.CFLAGS_CLANG_LIBCPERCIVA }}
  52. ${{ env.CFLAGS_CLANG_PROJECT }}
  53. # make(1) doesn't automatically override the CFLAGS macro set inside
  54. # Makefile with the environment variable.
  55. run: make CFLAGS="${{ env.CFLAGS }}"
  56. - name: Test clang binaries
  57. env:
  58. USE_VALGRIND: 1
  59. run: make test VERBOSE=1
  60. - name: Clean
  61. run: make clean
  62. - name: Configure with gcc
  63. env:
  64. CC: gcc-10
  65. CFLAGS: ${{ env.CFLAGS_ALL }}
  66. run: ./configure
  67. - name: Compile with gcc
  68. env:
  69. CC: gcc-10
  70. CFLAGS: ${{ env.CFLAGS_ALL }}
  71. ${{ env.CFLAGS_GCC_LIBCPERCIVA }}
  72. ${{ env.CFLAGS_GCC_PROJECT }}
  73. # make(1) doesn't automatically override the CFLAGS macro set inside
  74. # Makefile with the environment variable.
  75. run: make CFLAGS="${{ env.CFLAGS }}"
  76. - name: Test gcc binaries
  77. env:
  78. USE_VALGRIND: 1
  79. run: make test VERBOSE=1
  80. - name: Check for untracked files
  81. run: test -z "$(git status --porcelain=v1)"
  82. macOS:
  83. name: macOS
  84. runs-on: macOS-11
  85. steps:
  86. - name: Checkout code
  87. uses: actions/checkout@v3
  88. - name: Install software
  89. run: brew install automake
  90. - name: Run autoreconf
  91. run: autoreconf -i
  92. - name: Configure with clang
  93. env:
  94. CC: clang
  95. CFLAGS: ${{ env.CFLAGS_ALL }}
  96. ${{ env.CFLAGS_OSX }}
  97. LDFLAGS: ${{ env.LDFLAGS_OSX }}
  98. run: ./configure
  99. - name: Compile with clang
  100. env:
  101. CC: clang
  102. CFLAGS: ${{ env.CFLAGS_ALL }}
  103. ${{ env.CFLAGS_CLANG_LIBCPERCIVA }}
  104. ${{ env.CFLAGS_CLANG_PROJECT }}
  105. ${{ env.CFLAGS_OSX }}
  106. LDFLAGS: ${{ env.LDFLAGS_OSX }}
  107. # make(1) doesn't automatically override the CFLAGS macro set inside
  108. # Makefile with the environment variable.
  109. run: make CFLAGS="${{ env.CFLAGS }}"
  110. - name: Test clang binaries
  111. run: make test VERBOSE=1