diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e09b3c5..bbe6a9f9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,7 +2,6 @@ name: CHERIoT Network-Stack CI on: push: - branches: [ main ] pull_request: branches: [ main ] workflow_dispatch: @@ -15,13 +14,13 @@ on: jobs: check-format: name: Check coding conventions - runs-on: ubuntu-latest + runs-on: the-capable-hub-aws-ci container: image: ghcr.io/cheriot-platform/devcontainer:latest - options: --user 1001 + options: --user 1000 steps: - name: Checkout repository and submodules - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: submodules: recursive - name: Check out RTOS @@ -34,18 +33,17 @@ jobs: strategy: matrix: build-type: [ debug, release ] - board: [ibex-arty-a7-100, sonata-0.2, sonata-1.1] + board: [sonata-1.3] include: - - xmake-run: false - build-type: debug build-flags: --debug-loader=y --debug-scheduler=y --debug-allocator=information --allocator-rendering=y -m debug - build-type: release build-flags: --debug-loader=n --debug-scheduler=n --debug-allocator=none -m release --stack-usage-check-allocator=y --stack-usage-check-scheduler=y fail-fast: false - runs-on: ubuntu-latest + runs-on: the-capable-hub-aws-ci container: image: ${{ inputs.devcontainer || 'ghcr.io/cheriot-platform/devcontainer:latest' }} - options: --user 1001 + options: --user 1000 steps: - name: Checkout repository and submodules uses: actions/checkout@v4 @@ -60,11 +58,18 @@ jobs: for d in examples/*/; do ( cd $d xmake f --sdk=/cheriot-tools/ --board=${{matrix.board}} ${{ matrix.build-flags }} - xmake + xmake run ); done + - name: Upload firmware artifacts + if: matrix.board == 'sonata-1.3' && matrix.build-type == 'release' + uses: actions/upload-artifact@v7 + with: + name: sonata-firmware + path: examples/*/build/**/firmware.uf2 + if-no-files-found: error all-checks: needs: [check-format,build-examples] - runs-on: ubuntu-latest + runs-on: the-capable-hub-aws-ci steps: - name: Dummy step run: true diff --git a/.github/workflows/sonata-hil-ci.yml b/.github/workflows/sonata-hil-ci.yml index 64731307..687d30b1 100644 --- a/.github/workflows/sonata-hil-ci.yml +++ b/.github/workflows/sonata-hil-ci.yml @@ -1,63 +1,52 @@ name: CHERIoT Network-Stack HIL-CI on: - push: - branches: [ main ] - pull_request: - branches: [ main ] + workflow_run: + workflows: ["CHERIoT Network-Stack CI"] + types: [completed] workflow_dispatch: inputs: - devcontainer: - description: 'Set to override default build container' + run-id: + description: 'main.yml workflow run ID to download firmware from' type: string - required: false + required: true jobs: - build-examples: - name: Build Example Projects - 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@v6 - with: - submodules: recursive - - - name: Check out RTOS - run: | - cd .. - git clone --recurse https://github.com/cheriot-platform/cheriot-rtos - - - name: Build examples for Sonata - run: | - for d in examples/*/; do ( - cd $d - xmake f --sdk=/cheriot-tools/ --board=sonata-1.3 -m release --IPv6=false - xmake run - ); done - - - name: Upload firmware artifacts - uses: actions/upload-artifact@v7 - with: - name: sonata-firmware - path: examples/*/build/**/firmware.uf2 - if-no-files-found: error - hardware-test: name: Hardware Test on Sonata - needs: build-examples + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} runs-on: [ the-capable-hub-farm, board:Sonata ] + environment: hil-hardware # Requires you to create this environment in settings + permissions: + statuses: write + actions: read + contents: read + steps: + - name: Set PR status to pending + if: github.event_name == 'workflow_run' + uses: actions/github-script@v7 + with: + script: | + github.rest.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.payload.workflow_run.head_sha, + state: 'pending', + context: 'HIL Tests (Sonata)', + description: 'Awaiting hardware testing...' + }) + - name: Checkout repository - uses: actions/checkout@v6 + uses: actions/checkout@v4 - name: Download firmware artifacts - uses: actions/download-artifact@v7 + uses: actions/download-artifact@v4 with: name: sonata-firmware path: firmware + run-id: ${{ github.event_name == 'workflow_dispatch' && inputs.run-id || github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Mount Sonata run: | @@ -76,3 +65,18 @@ jobs: - name: Flash and test all examples run: bash .github/sonata-hil/run-hil-tests.sh + + - name: Update PR status + if: always() && github.event_name == 'workflow_run' + uses: actions/github-script@v7 + with: + script: | + const state = '${{ job.status }}' === 'success' ? 'success' : 'failure'; + github.rest.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.payload.workflow_run.head_sha, + state: state, + context: 'HIL Tests (Sonata)', + description: `Hardware tests finished with status: ${state}` + }) diff --git a/examples/01.SNTP/sntp.cc b/examples/01.SNTP/sntp.cc index 1d2a8a11..e6a1927b 100644 --- a/examples/01.SNTP/sntp.cc +++ b/examples/01.SNTP/sntp.cc @@ -13,6 +13,7 @@ constexpr bool UseIPv6 = CHERIOT_RTOS_OPTION_IPv6; void __cheri_compartment("sntp_example") example() { + Debug::log("Im in here innit"); network_start(); Timeout t{MS_TO_TICKS(5000)}; while (sntp_update(&t) != 0)