2020-12-09 04:09:52 +08:00
|
|
|
name: Build with Clang/LLVM
|
|
|
|
|
|
|
|
on: pull_request_target
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
clang-build-cancel:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Cancel Previous Runs
|
|
|
|
uses: styfle/cancel-workflow-action@0.6.0
|
|
|
|
with:
|
|
|
|
access_token: ${{ github.token }}
|
|
|
|
clang-build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: clang-build-cancel
|
|
|
|
container:
|
|
|
|
image: zephyrprojectrtos/ci:v0.17.0-rc1
|
|
|
|
options: '--entrypoint /bin/bash'
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-04-22 21:57:20 +08:00
|
|
|
subset: [1, 2, 3, 4, 5]
|
2020-12-09 04:09:52 +08:00
|
|
|
env:
|
|
|
|
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.12.4
|
|
|
|
CLANG_ROOT_DIR: /usr/lib/llvm-12
|
2021-04-22 21:57:20 +08:00
|
|
|
MATRIX_SIZE: 5
|
2020-12-09 04:09:52 +08:00
|
|
|
steps:
|
|
|
|
- name: Cancel Previous Runs
|
|
|
|
uses: styfle/cancel-workflow-action@0.6.0
|
|
|
|
with:
|
|
|
|
access_token: ${{ github.token }}
|
|
|
|
- name: Update PATH for west
|
|
|
|
run: |
|
|
|
|
echo "$HOME/.local/bin" >> $GITHUB_PATH
|
|
|
|
|
|
|
|
- name: checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: west setup
|
|
|
|
run: |
|
|
|
|
west init -l . || true
|
|
|
|
west update
|
|
|
|
|
|
|
|
- name: Check Environment
|
|
|
|
run: |
|
|
|
|
cmake --version
|
|
|
|
${CLANG_ROOT_DIR}/bin/clang --version
|
|
|
|
gcc --version
|
|
|
|
ls -la
|
|
|
|
|
|
|
|
- name: Run Tests with Twister
|
|
|
|
run: |
|
|
|
|
#source zephyr-env.sh
|
|
|
|
export ZEPHYR_BASE=${PWD}
|
|
|
|
export ZEPHYR_TOOLCHAIN_VARIANT=llvm
|
2021-04-22 21:57:20 +08:00
|
|
|
./scripts/twister --inline-logs -N -v -p native_posix --subset ${{matrix.subset}}/${MATRIX_SIZE} --retry-failed 3
|
2020-12-09 04:09:52 +08:00
|
|
|
|
|
|
|
- name: Upload Unit Test Results
|
|
|
|
if: always()
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: Unit Test Results (Subset ${{ matrix.subset }})
|
|
|
|
path: twister-out/twister.xml
|
|
|
|
|
|
|
|
publish-test-results:
|
|
|
|
name: "Publish Unit Tests Results"
|
|
|
|
needs: clang-build
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
# the build-and-test job might be skipped, we don't need to run this job then
|
|
|
|
if: success() || failure()
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Download Artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
path: artifacts
|
|
|
|
|
|
|
|
- name: Display structure of downloaded files
|
|
|
|
run: ls -R
|
|
|
|
|
|
|
|
- name: Publish Unit Test Results
|
2021-04-22 22:38:48 +08:00
|
|
|
uses: EnricoMi/publish-unit-test-result-action@v1.12
|
2020-12-09 04:09:52 +08:00
|
|
|
with:
|
|
|
|
check_name: Unit Test Results
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
files: "**/twister.xml"
|
2021-04-22 22:38:48 +08:00
|
|
|
comment_on_pr: false
|