--- name: Zephyr # 'workflow_dispatch' allows running this workflow manually from the # 'Actions' tab # yamllint disable-line rule:truthy on: [push, pull_request, workflow_dispatch, workflow_call] # Specifies group name that stops previous wokrflows if the name matches concurrency: # eg. "Zephyr-pull_request-my_fork_branch_to_merge" # eg. "Zephyr-push-refs/heads/my_branch_merging" group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref }} cancel-in-progress: true jobs: build-linux: runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: # Using groups to avoid spamming the small results box with too # many lines. Pay attention to COMMAS. IPC_platforms: [ # - IPC3 default imx8 imx8x imx8m, tgl tgl-h, # UNSUPPORTED! Will be removed # - IPC4 default mtl, # Temporary testbed for Zephyr development. -i IPC4 tgl tgl-h, ] zephyr_revision: [ manifest_revision, "https://github.com/zephyrproject-rtos/zephyr main", ] steps: - uses: actions/checkout@v3 # Download a full clone to fix `git describe`, sof_version.h and # build reproducibility. sof.git is still small. # This is especially useful for daily builds (but not just). with: fetch-depth: 0 path: ./workspace/sof # As of December 2022 `--shallow-exclude=v3.2.0-rc3` fixes `git # describe`, Zephyr's version.h and build reproducibility while # downloading about 200MB less compared to a full clone. # # Ideally, the --shallow-exclude= argument should be regularly # bumped whenever SOF upgrades Zephyr to keep this as fast as # possible. # In a bigger Zephyr future maybe we could move to a more permanent # git fetch --shallow-since='5 months ago' because Zephyr follows # a "roughly 4-month release" but for now that saves only 100MB # https://docs.zephyrproject.org/latest/project/release_process.html - name: west clones run: pip3 install west && cd workspace/sof/ && west init -l && west update --narrow --fetch-opt=--depth=5 && git -C ../zephyr fetch --shallow-exclude=v3.2.0-rc3 - name: select zephyr revision run: cd workspace/zephyr/ && if [ 'manifest_revision' != '${{ matrix.zephyr_revision }}' ]; then git fetch ${{ matrix.zephyr_revision }} && git checkout FETCH_HEAD; fi && git log --oneline -n 5 --decorate --graph --no-abbrev-commit # Not strictly necessary but saves a lot of scrolling in the next step # TODO, research caching: # https://stackoverflow.com/questions/66421411/how-to-run-cached-docker-image-in-github-action - name: docker pull zephyrproject-rtos/zephyr-build run: docker pull ghcr.io/zephyrproject-rtos/zephyr-build:latest # https://github.com/zephyrproject-rtos/docker-image # Note: env variables can be passed to the container with # -e https_proxy=... - name: build run: cd workspace && ./sof/zephyr/docker-run.sh ./sof/zephyr/docker-build.sh --cmake-args=-DEXTRA_CFLAGS=-Werror --cmake-args=--warn-uninitialized ${{ matrix.IPC_platforms }} - name: Upload build artifacts uses: actions/upload-artifact@v3 if: ${{ matrix.zephyr_revision == 'manifest_revision' }} with: name: linux-build ${{ matrix.IPC_platforms }} path: | ${{ github.workspace }}/workspace/build-sof-staging ${{ github.workspace }}/workspace/**/compile_commands.json build-windows: runs-on: windows-latest strategy: fail-fast: false # FIXME: Create common matrix for build-linux and build-windows matrix: # Using groups to avoid spamming the small results box with too # many lines. Pay attention to COMMAS. platforms: [ # - IPC3 default imx8 imx8x imx8m, tgl tgl-h, # UNSUPPORTED! Will be removed # - IPC4 default mtl, # Very few IPC3 platforms support IPC4 too. -i IPC4 tgl tgl-h, ] steps: - uses: actions/checkout@v3 with: fetch-depth: 0 path: ./workspace/sof # Cache artifacts so we do not overload external servers with downloads # Remember to change step key if you change the tools so old cache is not restored, # or delete cache manually in Github Actions tab - name: Cache unzip id: cache-unzip uses: actions/cache@v3.0.11 with: path: unzip-5.51-1-bin.zip key: ${{ runner.os }}-cache-unzip-5-51-1 - name: Cache wget id: cache-wget uses: actions/cache@v3.0.11 with: path: wget-1.11.4-1-bin.zip key: ${{ runner.os }}-cache-wget-1-11-4-1 - name: Cache Zephyr SDK id: cache-zephyr-sdk uses: actions/cache@v3.0.11 with: path: zephyr-sdk-0.15.2_windows-x86_64.zip key: ${{ runner.os }}-cache-zephyr-sdk-0-15-2 # Unzip is needed by Zephyr SDK setup.cmd installation script - name: Download unzip if: ${{ steps.cache-unzip.outputs.cache-hit != 'true' }} run: | curl -L -o unzip-5.51-1-bin.zip ` https://gnuwin32.sourceforge.net/downlinks/unzip-bin-zip.php # Wget is needed by Zephyr SDK setup.cmd installation script - name: Download wget if: ${{ steps.cache-wget.outputs.cache-hit != 'true' }} run: | curl -L -O http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-bin.zip - name: Download Zephyr SDK if: ${{ steps.cache-zephyr-sdk.outputs.cache-hit != 'true' }} run: | # yamllint disable-line rule:line-length curl -L -O ` https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.2/zephyr-sdk-0.15.2_windows-x86_64.zip # Unzips every .zip package to directory matching its name without extension - name: Unzip downloaded packages run: 7z x *.zip -o* - name: Add unzip to system PATH run: | echo "${{ github.workspace }}/unzip-5.51-1-bin/bin" | ` Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Add wget to system PATH run: | echo "${{ github.workspace }}/wget-1.11.4-1-bin/bin" | ` Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append # Install Zephyr SDK - all toolchains including Host Tools # and registering CMake package in the registry # setup.cmd may not be called in from msys shell as it does not parse # forward slash script input arguments correctly. - name: Install Zephyr SDK run: zephyr-sdk-0.15.2_windows-x86_64/zephyr-sdk-0.15.2/setup.cmd /t all /h /c - name: Setup Python uses: actions/setup-python@v4 with: python-version: '3.8' - name: West install run: pip3 install west - name: West clone working-directory: ${{ github.workspace }}/workspace run: west init -l sof && west update # Call Setup Python again to save the PIP packages in cache - name: Setup Python uses: actions/setup-python@v4 id: cache-python with: python-version: '3.8' cache: 'pip' cache-dependency-path: workspace/zephyr/scripts/requirements.txt # All requirements will be satisfied if the restored cache matches existing state - name: Validate python PIP cache working-directory: ${{ github.workspace }}/workspace run: pip install -r zephyr/scripts/requirements.txt # MSYS2 provides gcc x64_86 toolchain & openssl - name: Initialize MSYS2 uses: msys2/setup-msys2@v2 with: msystem: MSYS install: gcc openssl-devel path-type: inherit - name: Build shell: msys2 {0} working-directory: ${{ github.workspace }}/workspace run: python sof/scripts/xtensa-build-zephyr.py --no-interactive --cmake-args=-DEXTRA_CFLAGS=-Werror --cmake-args=--warn-uninitialized ${{ matrix.platforms }} - name: Upload build artifacts uses: actions/upload-artifact@v3 with: name: windows-build ${{ matrix.platforms}} path: | ${{ github.workspace }}/workspace/build-sof-staging ${{ github.workspace }}/workspace/**/compile_commands.json