Add CI that builds and runs every example #26
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CMake | |
| on: | |
| push: | |
| paths: | |
| - 'cmake/**' | |
| - '.github/workflows/cmake.yml' | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| # No cron: nightly.yml calls this, so the whole nightly is ONE run | |
| # and therefore one triage writer. See nightly.yml's header. | |
| workflow_call: | |
| inputs: | |
| caller_run_id: | |
| description: 'run id of the calling workflow; keeps a called run in its own concurrency group' | |
| type: string | |
| default: '' | |
| workflow_dispatch: | |
| # Hardcode this workflow's OWN name: github.workflow is the CALLER's in a called | |
| # workflow, so keying on it put all 12 targets in one group -- and GitHub cancels | |
| # the previously-pending run in a group, so only the last target survived. | |
| concurrency: | |
| group: ${{ inputs.caller_run_id && format('cmake-call-{0}', inputs.caller_run_id) || format('cmake-{0}', github.ref) }} | |
| cancel-in-progress: ${{ !inputs.caller_run_id }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| resolve: | |
| uses: ./.github/workflows/_resolve-wolfssl.yml | |
| with: | |
| stable_count: 1 | |
| cmake: | |
| needs: resolve | |
| name: Run / cmake (myApp) wolfSSL ${{ matrix.wolfssl_ref }} | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| wolfssl_ref: ${{ fromJson(needs.resolve.outputs.refs_json) }} | |
| timeout-minutes: 25 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| # Its own job rather than a manifest entry: CMakeLists.txt does | |
| # add_subdirectory(wolfssl), so it needs a wolfSSL source tree next to it | |
| # instead of the installed lib every other host example links, and cloning | |
| # one is impossible inside examples.yml's network namespace. | |
| - name: Fetch the wolfSSL ref under test | |
| run: | | |
| set -euo pipefail | |
| git clone -q --depth 1 --branch '${{ matrix.wolfssl_ref }}' \ | |
| https://github.com/wolfSSL/wolfssl cmake/wolfssl | |
| git -C cmake/wolfssl log -1 --format='wolfssl at ${{ matrix.wolfssl_ref }}: %h %s' | |
| # README: cmake .. -DCMAKE_C_FLAGS=-I../include/ && make && ./hash example_string | |
| - name: Build | |
| run: | | |
| set -euo pipefail | |
| cd cmake | |
| cmake -S . -B build -DCMAKE_C_FLAGS=-I../include/ | |
| cmake --build build -j"$(nproc)" | |
| test -x build/hash || { echo "FAIL: build/hash not produced"; exit 1; } | |
| - name: Run | |
| run: | | |
| set -euo pipefail | |
| cd cmake | |
| out=$(./build/hash example_string) | |
| echo "$out" | |
| # sha256("example_string"), so this asserts wolfCrypt's answer rather | |
| # than just a zero exit | |
| want=9BFB55A8406617FF3E6767EC5D27FC6B5682C3A79C415EF6E084BF7D050273E6 | |
| case "$out" in | |
| *"$want"*) echo "verified: hash matches sha256(example_string)" ;; | |
| *) echo "FAIL: expected $want"; exit 1 ;; | |
| esac |