|
| 1 | +name: Bare-Metal Configuration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'master', 'main', 'release/**' ] |
| 6 | + pull_request: |
| 7 | + branches: [ '*' ] |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + baremetal_autotools: |
| 15 | + name: Bare-metal build (autotools) |
| 16 | + if: github.repository_owner == 'wolfssl' |
| 17 | + runs-on: ubuntu-latest |
| 18 | + timeout-minutes: 10 |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + config: [ |
| 23 | + '--enable-baremetal', |
| 24 | + '--enable-baremetal --enable-cryptonly' |
| 25 | + ] |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: sudo apt-get update && sudo apt-get install -y autoconf automake libtool |
| 31 | + |
| 32 | + - name: autogen |
| 33 | + run: ./autogen.sh |
| 34 | + |
| 35 | + - name: configure |
| 36 | + run: CPPFLAGS="-DWOLFSSL_USER_IO" ./configure ${{ matrix.config }} --disable-examples --enable-cryptocb |
| 37 | + |
| 38 | + - name: build |
| 39 | + run: make -j$(nproc) |
| 40 | + |
| 41 | + - name: Verify macro definitions |
| 42 | + run: | |
| 43 | + cat > test_baremetal_defines.c <<'EOF' |
| 44 | + #include <wolfssl/options.h> |
| 45 | + #include <wolfssl/wolfcrypt/settings.h> |
| 46 | + #include <stdio.h> |
| 47 | + |
| 48 | + int main() { |
| 49 | + int errors = 0; |
| 50 | + |
| 51 | + #ifdef WOLFSSL_BAREMETAL |
| 52 | + printf("✓ WOLFSSL_BAREMETAL is defined\n"); |
| 53 | + #else |
| 54 | + printf("✗ ERROR: WOLFSSL_BAREMETAL should be defined\n"); |
| 55 | + errors++; |
| 56 | + #endif |
| 57 | + |
| 58 | + #ifdef WOLFCRYPT_ONLY |
| 59 | + printf("✓ WOLFCRYPT_ONLY is defined\n"); |
| 60 | + #ifdef NO_ASN_TIME |
| 61 | + printf("✓ NO_ASN_TIME is defined (expected with WOLFCRYPT_ONLY)\n"); |
| 62 | + #else |
| 63 | + printf("✗ ERROR: NO_ASN_TIME should be defined when WOLFCRYPT_ONLY is set\n"); |
| 64 | + errors++; |
| 65 | + #endif |
| 66 | + #else |
| 67 | + printf("✓ WOLFCRYPT_ONLY is NOT defined\n"); |
| 68 | + #ifdef NO_ASN_TIME |
| 69 | + printf("✗ ERROR: NO_ASN_TIME should NOT be defined without WOLFCRYPT_ONLY\n"); |
| 70 | + errors++; |
| 71 | + #else |
| 72 | + printf("✓ NO_ASN_TIME is NOT defined (expected without WOLFCRYPT_ONLY)\n"); |
| 73 | + #endif |
| 74 | + #endif |
| 75 | + |
| 76 | + return errors; |
| 77 | + } |
| 78 | + EOF |
| 79 | + gcc -I. test_baremetal_defines.c -o test_baremetal_defines |
| 80 | + ./test_baremetal_defines |
| 81 | +
|
| 82 | + baremetal_cmake: |
| 83 | + name: Bare-metal build (CMake) |
| 84 | + if: github.repository_owner == 'wolfssl' |
| 85 | + runs-on: ubuntu-latest |
| 86 | + timeout-minutes: 10 |
| 87 | + strategy: |
| 88 | + fail-fast: false |
| 89 | + matrix: |
| 90 | + cryptonly: [false, true] |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v4 |
| 93 | + |
| 94 | + - name: Install dependencies |
| 95 | + run: sudo apt-get update && sudo apt-get install -y cmake build-essential |
| 96 | + |
| 97 | + - name: Configure CMake |
| 98 | + run: | |
| 99 | + mkdir build && cd build |
| 100 | + if [ "${{ matrix.cryptonly }}" = "true" ]; then |
| 101 | + cmake -DWOLFSSL_BAREMETAL=yes -DWOLFSSL_CRYPTONLY=yes -DWOLFSSL_EXAMPLES=no -DWOLFSSL_CRYPTOCB=yes -DCMAKE_C_FLAGS="-DWOLFSSL_USER_IO -DWOLFCRYPT_ONLY" .. |
| 102 | + else |
| 103 | + cmake -DWOLFSSL_BAREMETAL=yes -DWOLFSSL_EXAMPLES=no -DWOLFSSL_CRYPTOCB=yes -DCMAKE_C_FLAGS="-DWOLFSSL_USER_IO" .. |
| 104 | + fi |
| 105 | + |
| 106 | + - name: Build |
| 107 | + run: cd build && cmake --build . -j$(nproc) |
| 108 | + |
| 109 | + - name: Verify macro definitions |
| 110 | + run: | |
| 111 | + cd build |
| 112 | + cat > test_baremetal_defines.c <<'EOF' |
| 113 | + #include <wolfssl/options.h> |
| 114 | + #include <wolfssl/wolfcrypt/settings.h> |
| 115 | + #include <stdio.h> |
| 116 | + |
| 117 | + int main() { |
| 118 | + int errors = 0; |
| 119 | + |
| 120 | + #ifdef WOLFSSL_BAREMETAL |
| 121 | + printf("✓ WOLFSSL_BAREMETAL is defined\n"); |
| 122 | + #else |
| 123 | + printf("✗ ERROR: WOLFSSL_BAREMETAL should be defined\n"); |
| 124 | + errors++; |
| 125 | + #endif |
| 126 | + |
| 127 | + #ifdef WOLFCRYPT_ONLY |
| 128 | + printf("✓ WOLFCRYPT_ONLY is defined\n"); |
| 129 | + #ifdef NO_ASN_TIME |
| 130 | + printf("✓ NO_ASN_TIME is defined (expected with WOLFCRYPT_ONLY)\n"); |
| 131 | + #else |
| 132 | + printf("✗ ERROR: NO_ASN_TIME should be defined when WOLFCRYPT_ONLY is set\n"); |
| 133 | + errors++; |
| 134 | + #endif |
| 135 | + #else |
| 136 | + printf("✓ WOLFCRYPT_ONLY is NOT defined\n"); |
| 137 | + #ifdef NO_ASN_TIME |
| 138 | + printf("✗ ERROR: NO_ASN_TIME should NOT be defined without WOLFCRYPT_ONLY\n"); |
| 139 | + errors++; |
| 140 | + #else |
| 141 | + printf("✓ NO_ASN_TIME is NOT defined (expected without WOLFCRYPT_ONLY)\n"); |
| 142 | + #endif |
| 143 | + #endif |
| 144 | + |
| 145 | + return errors; |
| 146 | + } |
| 147 | + EOF |
| 148 | + # Key: -I. comes BEFORE -I.. so build/wolfssl/options.h is found first |
| 149 | + gcc -I. -I.. test_baremetal_defines.c -o test_baremetal_defines |
| 150 | + ./test_baremetal_defines |
| 151 | +
|
0 commit comments