-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[github-actions] build docker image then run
arm-gcc
with it
This changes the relationship of the workflows so that the `arm-gcc` job in `build.yml` is run using the docker image generated by the docker `build-image` job. Previously, the `arm-gcc` job would just use the `:latest` tag of `siliconlabsinc/ot-efr32-dev` from DockerHub. This presents a problem when there are changes to the bootstrap script which are required for the build script to succeed. These changes would not be present in the currently published `siliconlabsinc/ot-efr32-dev:latest` since that image was build off of `SiliconLabs/ot-efr32:main`, not the current branch.
- Loading branch information
Showing
6 changed files
with
249 additions
and
112 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,11 +41,23 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
docker: | ||
name: Docker | ||
uses: ./.github/workflows/docker.yml | ||
|
||
metadata: | ||
name: Metadata | ||
uses: ./.github/workflows/metadata.yml | ||
|
||
arm-gcc: | ||
name: arm-gcc-${{ matrix.gcc_ver }} | ||
name: Arm GNU Toolchain ${{ matrix.gcc_ver }} | ||
runs-on: ubuntu-22.04 | ||
needs: [metadata, docker] | ||
continue-on-error: true | ||
permissions: | ||
packages: write | ||
container: | ||
image: siliconlabsinc/ot-efr32-dev:latest | ||
image: ${{ needs.metadata.outputs.ghcr_image }} | ||
options: --user 1001 | ||
strategy: | ||
fail-fast: false | ||
|
@@ -59,46 +71,61 @@ jobs: | |
gcc_extract_dir: arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Create LFS file hash list | ||
run: git -C third_party/silabs/gecko_sdk lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | ||
- name: Create LFS file hash list | ||
run: git -C third_party/silabs/gecko_sdk lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id | ||
|
||
- name: Restore gecko_sdk LFS cache | ||
uses: actions/cache@v4 | ||
id: lfs-cache | ||
with: | ||
path: .git/modules/third_party/silabs/gecko_sdk/lfs | ||
key: lfs-${{ hashFiles('.lfs-assets-id') }} | ||
|
||
- name: Git LFS Pull | ||
run: git -C third_party/silabs/gecko_sdk lfs pull | ||
|
||
- name: Bootstrap ARM Toolchain | ||
run: | | ||
script/bootstrap arm_toolchain ${{ matrix.gcc_download_url }} ${{ matrix.gcc_extract_dir }} | ||
- name: Build | ||
run: | | ||
export PATH=${HOME}/.local/${{ matrix.gcc_extract_dir }}/bin:$PATH | ||
script/test | ||
- name: Gather SLC generated files | ||
if: failure() | ||
run: | | ||
rm -rf artifact && mkdir artifact | ||
for b in build/*/slc; do | ||
board=$(basename $(dirname "${b}")) | ||
echo "Artifacting '${board}'" | ||
mkdir -p "artifact/${board}" | ||
mv "build/${board}/slc" "artifact/${board}" | ||
done | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
- name: Restore gecko_sdk LFS cache | ||
uses: actions/cache@v4 | ||
id: lfs-cache | ||
with: | ||
path: .git/modules/third_party/silabs/gecko_sdk/lfs | ||
key: lfs-${{ hashFiles('.lfs-assets-id') }} | ||
|
||
- name: Git LFS Pull | ||
run: git -C third_party/silabs/gecko_sdk lfs pull | ||
|
||
- name: Bootstrap ARM Toolchain | ||
run: | | ||
script/bootstrap arm_toolchain ${{ matrix.gcc_download_url }} ${{ matrix.gcc_extract_dir }} | ||
- name: Build | ||
run: | | ||
export PATH=${HOME}/.local/${{ matrix.gcc_extract_dir }}/bin:$PATH | ||
script/test | ||
- name: Gather SLC generated files | ||
if: failure() | ||
run: | | ||
rm -rf artifact && mkdir artifact | ||
for b in build/*/slc; do | ||
board=$(basename $(dirname "${b}")) | ||
echo "Artifacting '${board}'" | ||
mkdir -p "artifact/${board}" | ||
mv "build/${board}/slc" "artifact/${board}" | ||
done | ||
- uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: build-${{ matrix.gcc_ver }} | ||
path: artifact | ||
|
||
cleanup: | ||
name: Cleanup | ||
runs-on: ubuntu-22.04 | ||
needs: [metadata, docker, arm-gcc] | ||
steps: | ||
- name: Delete ot-efr32-dev image | ||
uses: bots-house/[email protected] | ||
if: always() | ||
continue-on-error: true | ||
with: | ||
name: build-${{ matrix.gcc_ver }} | ||
path: artifact | ||
owner: ${{ needs.metadata.outputs.owner }} | ||
name: ot-efr32-dev | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: ${{ github.sha }} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# | ||
# Copyright (c) 2024, The OpenThread Authors. | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions are met: | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# 3. Neither the name of the copyright holder nor the | ||
# names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
# POSSIBILITY OF SUCH DAMAGE. | ||
# | ||
|
||
name: Metadata | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
owner: | ||
description: 'The lowercase GitHub repository owner' | ||
value: ${{ jobs.metadata.outputs.owner }} | ||
date: | ||
description: 'The current date' | ||
value: ${{ jobs.metadata.outputs.date }} | ||
ghcr_image: | ||
description: 'The GHCR image name' | ||
value: ${{ jobs.metadata.outputs.ghcr_image }} | ||
|
||
jobs: | ||
metadata: | ||
name: Generate required metadata | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
owner: ${{ steps.lowercase_owner.outputs.owner }} | ||
date: ${{ steps.date.outputs.date }} | ||
ghcr_image: ${{ steps.ghcr_image.outputs.ghcr_image }} | ||
steps: | ||
- name: Lowercase GitHub repository owner | ||
id: lowercase_owner | ||
run: echo "owner=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> ${GITHUB_OUTPUT} | ||
- name: Get current date | ||
id: date | ||
run: echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> ${GITHUB_OUTPUT} | ||
- name: GHCR image name | ||
id: ghcr_image | ||
run: echo "ghcr_image=ghcr.io/${{ steps.lowercase_owner.outputs.owner }}/ot-efr32-dev:${{ github.sha }}" >> ${GITHUB_OUTPUT} | ||
|
This file contains 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
Oops, something went wrong.