Skip to content

Commit

Permalink
GHA: add test_config and update GHA
Browse files Browse the repository at this point in the history
prepare gitHub automation for unit test refactoring

Signed-off-by: Robert Gałat <[email protected]>
  • Loading branch information
RobertGalatNordic committed Dec 10, 2024
1 parent 9d16395 commit 9050c6d
Show file tree
Hide file tree
Showing 51 changed files with 193 additions and 158 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/compare_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
diff_detected: ${{steps.config_diff.outputs.diff}}
artifact_url: ${{steps.save_diff.outputs.artifact-url}}

runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:

- name: Get artifacts from current
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/on-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
get_base_commit:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
outputs:
commit_number: ${{ steps.get_commits.outputs.commit_number }}
steps:
Expand All @@ -33,16 +33,42 @@ jobs:
with:
reference_commit: "HEAD~${{needs.get_base_commit.outputs.commit_number}}"

discover_target_boards:
runs-on: ubuntu-24.04
outputs:
targets: ${{ steps.platforms.outputs.targets }}
steps:
- name: install yq
run: pip install yq

- name: Checkout
uses: actions/checkout@v4
with:
path: sidewalk

- name: get_platforms
id: platforms
run: |
result=$(yq '.common.platform_allow' sidewalk/samples/sid_end_device/sample.yaml -c)
echo "targets=$result" >> $GITHUB_OUTPUT;
echo "$result"
build_samples:
needs: [discover_target_boards]
uses: ./.github/workflows/samples_build.yml
with:
boards_to_test: ${{needs.discover_target_boards.outputs.targets}}

build_and_run_tests:
needs: [discover_target_boards]
uses: ./.github/workflows/run_tests.yml
with:
boards_to_test: ${{needs.discover_target_boards.outputs.targets}}

Post_fail_to_Teams:
needs: [verify_changes, build_samples, build_and_run_tests]
if: ${{ failure() }}
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: neonidian/teams-notify-build-status@v4
with:
Expand All @@ -62,7 +88,7 @@ jobs:

post_configuration_diff:
needs: [compare_configuration]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
if: ${{ fromJson(needs.compare_configuration.outputs.diff_detected)}}
steps:
- uses: actions/download-artifact@v4
Expand Down
30 changes: 26 additions & 4 deletions .github/workflows/on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

jobs:
Run_Configuration:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
outputs:
NRF_revision: ${{ steps.config.outputs.NRF_revision }}
steps:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
reference_commit: ${{ github.event.pull_request.base.sha }}

save_pr_number:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Save PR number to file
run: |
Expand All @@ -60,14 +60,36 @@ jobs:
path: |
PR_number
discover_target_boards:
runs-on: ubuntu-24.04
outputs:
targets: ${{ steps.platforms.outputs.targets }}
steps:
- name: install yq
run: pip install yq

- name: Checkout
uses: actions/checkout@v4
with:
path: sidewalk

- name: get_platforms
id: platforms
run: |
result=$(yq '.common.platform_allow' sidewalk/samples/sid_end_device/sample.yaml -c)
echo "targets=$result" >> $GITHUB_OUTPUT;
echo "$result"
build_samples:
needs: Run_Configuration
needs: [Run_Configuration, discover_target_boards]
uses: ./.github/workflows/samples_build.yml
with:
nrf_revision: ${{needs.Run_Configuration.outputs.NRF_revision}}
boards_to_test: ${{needs.discover_target_boards.outputs.targets}}

build_and_run_tests:
needs: Run_Configuration
needs: [Run_Configuration, discover_target_boards]
uses: ./.github/workflows/run_tests.yml
with:
nrf_revision: ${{needs.Run_Configuration.outputs.NRF_revision}}
boards_to_test: ${{needs.discover_target_boards.outputs.targets}}
2 changes: 1 addition & 1 deletion .github/workflows/on-pr_dnm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
do_not_merge:
if: ${{ contains(github.event.*.labels.*.name, 'DNM') }}
name: Prevent Merging
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check for label
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-pr_labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:

jobs:
triage:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/labeler@v5
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/on-pr_nrf_manifest_update_PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
read_pr_configuration:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
outputs:
Create_NRF_PR: ${{ steps.config.outputs.Create_NRF_PR }}
steps:
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
fi;
create-manifest-pr:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: read_pr_configuration
if: ${{ fromJson(needs.read_pr_configuration.outputs.Create_NRF_PR)}}
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-pr_publish_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

create_PR_comment:
needs: [compare_configuration]
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
issues: write
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-push-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
needs: [build_documentation, build_samples]
permissions: write-all
name: Create release page
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Download artifact
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on_docker_change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ env:

jobs:
build-and-push-image:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
env:
ARCHIVE: "sidewalk_${{inputs.documentation_tag}}.zip"

runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container:
image: ghcr.io/nrfconnect/sdk-sidewalk:main
options: --cpus 2
Expand Down
88 changes: 5 additions & 83 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,90 +8,12 @@ on:
default: "main"
boards_to_test:
type: string
required: false
default: '["nrf52840dk/nrf52840", "nrf5340dk/nrf5340/cpuapp", "nrf54l15dk/nrf54l15/cpuapp"]'
required: true
default: '["nrf52840dk/nrf52840", "nrf5340dk/nrf5340/cpuapp", "nrf54l15dk/nrf54l15/cpuapp", "nrf54l15dk/nrf54l15/cpuapp/ns", "nrf54l15dk/nrf54l10/cpuapp"]'

jobs:
build_manual_tests:
strategy:
fail-fast: false
matrix:
subset: [1, 2, 3, 4, 5]
env:
MAX_SUBSETS: 5

runs-on: ubuntu-latest
container:
image: ghcr.io/nrfconnect/sdk-sidewalk:main
options: --cpus 2
defaults:
run:
shell: nrfutil toolchain-manager launch --install-dir /root/ncs bash -- {0}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: sidewalk

- name: update NRF
run: |
cd sidewalk && git rev-parse HEAD > /workdir/sidewalk_hash && cd .. &&
west init -m https://github.com/nrfconnect/sdk-nrf --mr main . &&
cd nrf &&
git fetch origin ${{inputs.nrf_revision}}:PR-branch &&
git checkout PR-branch &&
cd .. &&
west config manifest.group-filter +sidewalk &&
west update -n -o=--depth=1 --path-cache /workdir/ &&
cd sidewalk && git checkout `cat /workdir/sidewalk_hash` && rm -rf /workdir/sidewalk_hash
- name: Install Python dependencies
run: |
python3 -m pip install -r nrf/scripts/requirements.txt -r zephyr/scripts/requirements.txt -r sidewalk/scripts/ci/requirements.txt
- name: Twister build manual tests
run: |
source zephyr/zephyr-env.sh
west twister --testsuite-root sidewalk/tests/manual --inline-logs --overflow-as-errors --enable-size-report --show-footprint --footprint-from-buildlog -vvv --build-only --subset ${{ matrix.subset }}/${{ env.MAX_SUBSETS }}
- name: Prepare artifacts for upload
run: |
mkdir -p subsets/${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}
cp twister-out/twister.json subsets/${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: manual-tests-artifacts-${{ matrix.subset }}
path: |
subsets
twister-out/**/*sidewalk*/build.log
twister-out/**/*sidewalk*/zephyr/.config
twister-out/**/*sidewalk*/zephyr/runners.yaml
twister-out/**/*sidewalk*/zephyr/zephyr.elf
twister-out/**/*sidewalk*/zephyr/zephyr.hex
twister-out/**/*sidewalk*/zephyr/merged.hex
twister-out/**/*sidewalk*/zephyr/merged_domains.hex
twister-out/**/*sidewalk*/zephyr/*.dts
twister-out/**/*sidewalk*/zephyr/dfu_application.zip
merge_manual_tests:
needs: build_manual_tests
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
delete-merged: true
name: manual-tests-artifacts
pattern: manual-tests-artifacts-*

build_and_run_x86_tests:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container:
image: ghcr.io/nrfconnect/sdk-sidewalk:main
options: --cpus 2
Expand Down Expand Up @@ -125,7 +47,7 @@ jobs:
- name: Twister build and run x86 tests
run: |
source zephyr/zephyr-env.sh
west twister --platform native_posix --platform unit_testing --coverage --coverage-basedir sidewalk --coverage-formats html,xml --enable-ubsan --enable-lsan --enable-asan --testsuite-root sidewalk --inline-logs --overflow-as-errors -vvv
west twister --test-config sidewalk/test_config.yaml --level="Github_tests" --testsuite-root sidewalk --platform native_sim --platform native_posix --platform unit_testing --coverage --coverage-basedir sidewalk --coverage-formats html,xml --enable-ubsan --enable-lsan --enable-asan --inline-logs --overflow-as-errors -vvv
- name: Upload test results
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -167,7 +89,7 @@ jobs:

merge_tests_on_hw:
needs: build-and-test_on_hw
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
if: always()
permissions: write-all
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_tests_dut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ on:
jobs:
build_dut_tests:
name: "Build DUT tests (${{inputs.target_board}} - ${{ inputs.subset }})"
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container:
image: ghcr.io/nrfconnect/sdk-sidewalk:main
options: --cpus 2
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Build DUT test artifacts
run: |
source zephyr/zephyr-env.sh
west twister --platform ${{inputs.target_board}} --testsuite-root sidewalk --filter runnable --shuffle-tests --shuffle-tests-seed 123 --inline-logs --overflow-as-errors -vvv --prep-artifacts-for-testing --package-artifacts PACKAGE_ARTIFACTS_${{ inputs.subset }}.tar.bz2 --subset ${{ inputs.subset }}/${{ inputs.max_subsets }}
west twister --test-config sidewalk/test_config.yaml --levels="Github_tests" --platform ${{inputs.target_board}} --testsuite-root sidewalk --filter runnable --shuffle-tests --shuffle-tests-seed 123 --inline-logs --overflow-as-errors -vvv --prep-artifacts-for-testing --package-artifacts PACKAGE_ARTIFACTS_${{ inputs.subset }}.tar.bz2 --subset ${{ inputs.subset }}/${{ inputs.max_subsets }}
- name: Replace slash with underscore
id: replace
Expand Down
Loading

0 comments on commit 9050c6d

Please sign in to comment.