1name: Hello World (Multiplatform) 2 3on: 4 push: 5 branches: 6 - main 7 - v*-branch 8 - collab-* 9 pull_request: 10 branches: 11 - main 12 - v*-branch 13 - collab-* 14 paths: 15 - 'scripts/**' 16 - '.github/workflows/hello_world_multiplatform.yaml' 17 - 'SDK_VERSION' 18 19concurrency: 20 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} 21 cancel-in-progress: true 22 23jobs: 24 build: 25 strategy: 26 fail-fast: false 27 matrix: 28 os: [ubuntu-22.04, ubuntu-24.04, macos-13, macos-14, windows-2022] 29 runs-on: ${{ matrix.os }} 30 steps: 31 - name: Checkout 32 uses: actions/checkout@v4 33 with: 34 path: zephyr 35 fetch-depth: 0 36 37 - name: Rebase 38 if: github.event_name == 'pull_request' 39 env: 40 BASE_REF: ${{ github.base_ref }} 41 PR_HEAD: ${{ github.event.pull_request.head.sha }} 42 working-directory: zephyr 43 shell: bash 44 run: | 45 git config --global user.email "actions@zephyrproject.org" 46 git config --global user.name "Github Actions" 47 rm -fr ".git/rebase-apply" 48 rm -fr ".git/rebase-merge" 49 git rebase origin/${BASE_REF} 50 git clean -f -d 51 git log --graph --oneline HEAD...${PR_HEAD} 52 53 - name: Set up Python 54 uses: actions/setup-python@v5 55 with: 56 python-version: 3.11 57 58 - name: Setup Zephyr project 59 uses: zephyrproject-rtos/action-zephyr-setup@v1 60 with: 61 app-path: zephyr 62 toolchains: all 63 64 - name: Build firmware 65 working-directory: zephyr 66 shell: bash 67 run: | 68 if [ "${{ runner.os }}" = "macOS" ]; then 69 EXTRA_TWISTER_FLAGS="-P native_sim --build-only" 70 elif [ "${{ runner.os }}" = "Windows" ]; then 71 EXTRA_TWISTER_FLAGS="-P native_sim --short-build-path -O/tmp/twister-out" 72 fi 73 ./scripts/twister --force-color --inline-logs -T samples/hello_world -T samples/cpp/hello_world -v $EXTRA_TWISTER_FLAGS 74 75 - name: Upload artifacts 76 if: failure() 77 uses: actions/upload-artifact@v4 78 with: 79 if-no-files-found: ignore 80 path: 81 zephyr/twister-out/*/samples/hello_world/sample.basic.helloworld/build.log 82 zephyr/twister-out/*/samples/cpp/hello_world/sample.cpp.helloworld/build.log 83