Add CI for the examples. #9
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: CHERIoT RTOS Tests | ||
| # The following should ensure that the workflow only runs a single set of actions | ||
| # for each PR. But it will not apply this to pushes to the main branch. | ||
| # | ||
| # Shamelessly stolen from https://github.com/microsoft/snmalloc/pull/760 with | ||
| # the addition of ${{ github.workflow }} to the group name; for details, see | ||
| # https://docs.github.com/en/enterprise-cloud@latest/actions/writing-workflows/choosing-what-your-workflow-does/control-the-concurrency-of-workflows-and-jobs | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| merge_group: | ||
| workflow_dispatch: | ||
| inputs: | ||
| rtos_commit: | ||
| description: 'Set to override default RTOS commit hash' | ||
| type: string | ||
| required: false | ||
| network_stack_commit: | ||
| description: 'Set to override default network stack commit hash' | ||
| type: string | ||
| required: false | ||
| jobs: | ||
| check-examples: | ||
| strategy: | ||
| matrix: | ||
| fail-fast: false | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: ${{ inputs.devcontainer || 'ghcr.io/cheriot-platform/devcontainer:latest' }} | ||
| options: --user 1001 | ||
| steps: | ||
| - name: Checkout repository and submodules | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
| - name: Set RTOS version | ||
| if: ${{ inputs.rtos_commit }} | ||
| run: | | ||
| cd cheriot-rtos | ||
| git checkout ${{ inputs.rtos_commit }} | ||
| git submodule update --init --recursive | ||
| - name: Set network stack version | ||
| if: ${{ inputs.network_stack_commit }} | ||
| run: | | ||
| cd network-stack | ||
| git checkout ${{ inputs.network_stack_commit }} | ||
| git submodule update --init --recursive | ||
| - name: Build examples | ||
| run: | | ||
| for example_dir in $PWD/examples/*/; do | ||
| cd $example_dir | ||
| xmake f --sdk=/cheriot-tools/ | ||
| xmake | ||
| done | ||
| - name: Run tests | ||
| run: | | ||
| for example_dir in $PWD/examples/*/; do | ||
| cd $example_dir | ||
| # Skip trying to run tests if the don't run on a simulator | ||
| if grep sail xmake.lua ; then xmake run ; fi | ||
| if grep ibex xmake.lua ; then xmake run ; fi | ||
| done | ||