|
| 1 | +name: ATECC608 simulator test |
| 2 | + |
| 3 | +# START OF COMMON SECTION |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: [ 'master', 'main', 'release/**' ] |
| 7 | + pull_request: |
| 8 | + branches: [ '*' ] |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: true |
| 13 | +# END OF COMMON SECTION |
| 14 | + |
| 15 | +# Build the ATECC608 software simulator (https://github.com/wolfSSL/simulators, |
| 16 | +# ATECC608Sim/ subdirectory), build wolfSSL against cryptoauthlib + the |
| 17 | +# simulator's TCP HAL, and run the wolfCrypt ATECC608 test binary against the |
| 18 | +# simulator. |
| 19 | +# |
| 20 | +# The simulator's own Dockerfile.wolfcrypt clones a pinned wolfSSL release. |
| 21 | +# We patch it to COPY the PR checkout instead so CI reflects the PR's source. |
| 22 | +# We also strip the inline test.c patch RUN block: those guard fixes now live |
| 23 | +# upstream in this tree, so re-applying them would fail with "patch target not |
| 24 | +# found". The remaining sed-based patches in the Dockerfile (atmel.c XMEMSET |
| 25 | +# swap and atmel_set_slot_allocator visibility) are no-ops on pre-patched |
| 26 | +# source and their grep validations still pass, so we leave them alone. |
| 27 | + |
| 28 | +env: |
| 29 | + SIMULATORS_REF: 773fe70 |
| 30 | + |
| 31 | +jobs: |
| 32 | + atecc608_sim: |
| 33 | + name: wolfCrypt against ATECC608 simulator |
| 34 | + if: github.repository_owner == 'wolfssl' |
| 35 | + runs-on: ubuntu-24.04 |
| 36 | + timeout-minutes: 30 |
| 37 | + steps: |
| 38 | + - name: Checkout wolfSSL (PR source) |
| 39 | + uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + path: wolfssl-src |
| 42 | + |
| 43 | + - name: Clone ATECC608 simulator |
| 44 | + run: | |
| 45 | + git clone https://github.com/wolfSSL/simulators simulators |
| 46 | + cd simulators && git checkout "$SIMULATORS_REF" |
| 47 | +
|
| 48 | + - name: Stage PR wolfSSL into simulator build context |
| 49 | + run: mv wolfssl-src simulators/ATECC608Sim/wolfssl |
| 50 | + |
| 51 | + - name: Patch Dockerfile to use PR wolfSSL and drop redundant test.c patches |
| 52 | + working-directory: simulators/ATECC608Sim |
| 53 | + run: | |
| 54 | + # Replace the (multi-line) `RUN git clone ... wolfssl.git /app/wolfssl` |
| 55 | + # with a COPY of the PR checkout so CI tests the PR's source. |
| 56 | + sed -i '/^RUN git clone --branch v5\.9\.1-stable/,/wolfssl\.git \/app\/wolfssl$/c\ |
| 57 | + COPY wolfssl /app/wolfssl' Dockerfile.wolfcrypt |
| 58 | + # Fail fast if the pattern drifted upstream -- better a clear error |
| 59 | + # than a CI run that silently tests a stale release. |
| 60 | + grep -q '^ *COPY wolfssl /app/wolfssl$' Dockerfile.wolfcrypt |
| 61 | + ! grep -q 'git clone .*wolfssl\.git' Dockerfile.wolfcrypt |
| 62 | +
|
| 63 | + # Strip the inline test.c patch RUN block -- those guard fixes now |
| 64 | + # live upstream in this tree. |
| 65 | + sed -i "/^RUN python3 - <<'PY'$/,/^PY$/d" Dockerfile.wolfcrypt |
| 66 | + ! grep -q "RUN python3 - <<'PY'" Dockerfile.wolfcrypt |
| 67 | +
|
| 68 | + - uses: docker/setup-buildx-action@v3 |
| 69 | + |
| 70 | + - name: Build wolfCrypt-ATECC608 test image |
| 71 | + uses: docker/build-push-action@v5 |
| 72 | + with: |
| 73 | + context: simulators/ATECC608Sim |
| 74 | + file: simulators/ATECC608Sim/Dockerfile.wolfcrypt |
| 75 | + push: false |
| 76 | + load: true |
| 77 | + tags: wolfssl-atecc608-sim:ci |
| 78 | + cache-from: type=gha |
| 79 | + cache-to: type=gha,mode=max |
| 80 | + |
| 81 | + - name: Run wolfCrypt tests against simulator |
| 82 | + run: docker run --rm wolfssl-atecc608-sim:ci |
0 commit comments