Skip to content

[RSDK-7876] Update CI for FFI (#247) #1401

[RSDK-7876] Update CI for FFI (#247)

[RSDK-7876] Update CI for FFI (#247) #1401

Workflow file for this run

name: Test
on:
workflow_call:
workflow_dispatch:
pull_request:
branches: ['main']
push:
branches:
- '**'
tags-ignore:
- '**'
jobs:
changes:
name: Calculate changes
runs-on: ubuntu-latest
outputs:
src-esp32: ${{ steps.filter.outputs.src-esp32 }}
src-native: ${{ steps.filter.outputs.src-native }}
src-common: ${{ steps.filter.outputs.src-common }}
src-servers: ${{ steps.filter.outputs.src-servers }}
src-cli: ${{ steps.filter.outputs.src-cli }}
src-ffi: ${{ steps.filter.outputs.src-ffi }}
container:
image: ghcr.io/viamrobotics/micro-rdk-dev-env:amd64
steps:
- name : Checkout main branch code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: path filter
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src-esp32:
- 'micro-rdk/src/esp32/**'
src-common:
- 'micro-rdk/src/common/**'
- 'micro-rdk/src/gen/**'
src-native:
- 'micro-rdk/src/native/**'
src-servers:
- 'micro-rdk-server/**'
src-cli:
- 'micro-rdk-installer/**'
src-ffi:
- 'micro-rdk-ffi/**'
build_cli:
needs: changes
name: Tests, Format, Clippy Micro-RDK installer
if: ${{ needs.changes.outputs.src-cli == 'true'}}
runs-on: ubuntu-latest
container:
image: ghcr.io/viamrobotics/micro-rdk-dev-env:amd64
steps:
- name : Checkout main branch code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Clippy Micro-RDK Installer
run: |
bash -c 'make clippy-cli'
check_ffi:
needs: changes
name: Tests, Format, Clippy Micro-RDK FFI
if: ${{ needs.changes.outputs.src-ffi == 'true'}}
runs-on: ubuntu-latest
container:
image: ghcr.io/viamrobotics/micro-rdk-dev-env:amd64
steps:
- name : Checkout main branch code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Format Micro-RDK FFI
run: |
bash -c 'cargo fmt -p micro-rdk-ffi -- --check'
- name: Clippy Micro-RDK FFI
run: |
bash -c 'git config --global --add safe.directory /opt/esp/esp-idf && . "$IDF_PATH"/export.sh && . "$ESP_ROOT"/export-esp.sh && make clippy-ffi'
test_and_build:
needs: changes
name: Tests, Format, Clippy Micro-Rdk
if : needs.changes.outputs.src-esp32 == 'true' || needs.changes.outputs.src-common == 'true' || needs.changes.outputs.src-native == 'true' || needs.changes.outputs.src-servers == 'true'
runs-on: ubuntu-latest
container:
image: ghcr.io/viamrobotics/micro-rdk-dev-env:amd64
timeout-minutes: 20
steps:
- name : Checkout main branch code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
- name: Format
run: |
bash -c 'make format'
- name: Test
if : needs.changes.outputs.src-esp32 == 'true' || needs.changes.outputs.src-common == 'true' || needs.changes.outputs.src-native == 'true'
run: |
bash -c 'make test'
- name: ESP32 Build & Clippy
if : needs.changes.outputs.src-esp32 == 'true' || needs.changes.outputs.src-common == 'true' || needs.changes.outputs.src-servers == 'true'
run: |
bash -c 'git config --global --add safe.directory /opt/esp/esp-idf && . "$IDF_PATH"/export.sh && . "$ESP_ROOT"/export-esp.sh && make clippy-esp32'
bash -c '. "$IDF_PATH"/export.sh && . "$ESP_ROOT"/export-esp.sh && cd micro-rdk-server && cd ../ && make build-esp32-bin'
- name: Native Build & Clippy
if : needs.changes.outputs.src-native == 'true' || needs.changes.outputs.src-common == 'true' || needs.changes.outputs.src-servers == 'true'
run: |
bash -c 'make clippy-native'
bash -c 'make build-native'